Overview
Ameba series products support Philips I2C interface, which is a two-wire, low-speed, synchronous serial communication bus, supporting multi-master/multi-slave.
Features
Two-wire I2C serial interface: a serial data line (SDA) and a serial clock (SCL)
Master or Slave I2C operation
Transmitter or Receiver
Transmit and receive FIFOs with depth of 16 and width of 12-bit
Multi-master ability including bus arbitration scheme
7-bit or 10-bit addressing mode
Clock stretch in master/slave mode
Supports General Call, NULL DATA, START BYTE transfer protocol
Component parameters for configurable software driver support (programmable SDA hold time, slave address, SCL duty cycle, etc.)
Filter to eliminate the glitches on the signal of SDA and SCL, programmable digital noise Filter
Operation mode:
Polling
Interrupt
DMA mode
Speed Modes
Support three speed modes:
Standard Speed (SS), up to 100Kbps
Fast Speed (FS), up to 400Kbps
High Speed (HS), up to 3.4Mbps
Note
For more information about I2C IP clock and speed mode, please reference <User Menual>.
Operating Modes
I2C Configurable Operating Modes
Polling Mode
This is the most basic operating mode. The CPU polls the I2C status registers and reads or writes the FIFO buffer as needed to send and receive data.
Suited for small-scale data transfers with low real-time requirements.
Interrupt Mode
When configured trigger conditions are met, the I2C hardware sends an interrupt signal to notify the CPU to handle the relevant tasks.
This method reduces the need for frequent polling, lowering CPU usage and improving response speed.
DMA Mode
Through an I2C and DMA handshake mechanism, the DMA controller handles data transfers, reducing the CPU’s processing load.
Suitable for applications that require handling large amounts of data.
Supported ICs are shown in the following table.
Ameba SoC |
RTL8721Dx |
RTL8720E |
RTL8726E |
RTL8713E |
RTL8730E |
RTL8721F |
---|---|---|---|---|---|---|
Supported |
Y |
N |
N |
N |
N |
Y |
Note
For considerations when using DMA mode for transfers, please refer to the DMA and Cache section.
Application Examples
The SDK provides two types of functional examples to help developers understand and use I2C functionality:
Mbed Examples
Path:
{SDK}\component\example\peripheral\mbed\I2C\{demo}
Demonstrates how to implement I2C control in the mbed environment.
Raw Examples
Path:
{SDK}\component\example\peripheral\raw\I2C\{demo}
Illustrates how to directly control I2C without abstraction layers.
Below is a brief description of the features of the raw examples:
-
demonstrates how to use I2C as
master
inpolling
mode. -
demonstrates how to use I2C as
slave
inpolling
mode. -
demonstrates how to use I2C as
master
ininterrupt
mode. -
demonstrates how to use I2C as
slave
ininterrupt
mode. -
demonstrates how to use I2C in
DMA
mode.
Note
To see which chips are supported by the examples, refer to the README.md
file in the example’s path.
API Reference
For detailed information and usage of related APIs, refer to {SDK}\component\soc\amebaxxxx\fwlib\include\ameba_i2c.h
.