Inter-integrated Circuit (I2C) Interface
User Manual All information provided in this document is subject to legal disclaimers. © REALTEK 2019. All rights reserved.
259
Fast Speed Mode (400K):
IC_FS_SCL_HCNT =
6∗2500
(6+13)∗100
= 7
IC_FS_SCL_LCNT =
13∗2500
(6+13)∗100
= 17
Note:
Since slave may stretch SCL line, the actual speed is a little bit smaller then 100K/400K if we set the above calculated values. In order to
reach the accurate speed, calculated values should be reduced a little according to test results.
13.2.10
Programmable SDA Hold Time
As each application will encounter differing board delays, I
2
C contains a software programmable register IC_SDA_HOLD (0x7C) to enable
dynamic adjustment of the SDA hold time.
When I
2
C acts as a master transmitter, the hold time is 6 ic_clk periods if IC_SDA_HOLD is smaller than or equal to 6; the hold time is equal to
value of IC_SDA_HOLD ic_clk periods if IC_SDA_HOLD is larger than 6.
When I
2
C acts as a slave transmitter, the hold time is IC_SD 5 to IC_SD 6 ic_clk periods.
Note:
The 8
th
bit of data is not under control of IC_SDA_HOLD, since after 8
th
SCL clock negative edge, receiver controls the SDA line to respond
ACK or NACK.
The IC_SDA_HOLD register can be programmed only when I
2
C is disabled (IC_ENABLE=0).
13.2.11
DMA Controller Interface
There are two DMA modes of I
2
C discussed in the following sections:
16-bit FIFO (DMA legacy)
8-bit FIFO with transfer control register.
13.2.11.1
DMA Legacy Control Mode
The Ameba-D I
2
C has an optional built-in DMA capability; it has a handshaking interface to a DMA Controller to request and control transfers.
The APB bus is used to perform the data transfer to or from the DMA.
13.2.11.1.1
Enabling the DMA Controller Interface
To enable the DMA Controller interface on the Ameba-D I
2
C, you must write the DMA Control Register (IC_DMA_CR). Writing a 1 into the
TDMAE bit field of IC_DMA_CR register enables the I
2
C transmit handshaking interface. Writing a 1 into the RDMAE bit field of the IC_DMA_CR
register enables the I
2
C receive handshaking interface.
13.2.11.1.2
Transmit Watermark Level Select
During I
2
C serial transfers, transmit FIFO requests are made to the DMA Controller whenever the number of entries in the transmit FIFO is less
than or equal to the DMA Transmit Data Level Register (IC_DMA_TDLR) value; this is known as the watermark level. The DMA Controller
responds by writing a burst of data to the transmit FIFO buffer.
Data should be fetched from the DMA often enough for the transmit FIFO to perform serial transfers continuously; that is, when the FIFO
begins to empty another DMA request should be triggered. Otherwise, the FIFO will run out of data causing a STOP to be inserted on the I
2
C
bus. To prevent this condition, the user must set the watermark level correctly.
The goal in choosing a watermark level is to minimize the number of transactions per block, while at the same time keeping the probability of
an underflow condition to an acceptable level. For optimal operation, DMA.CTL
x
.DEST_MSIZE should be set at the FIFO level that triggers a
transmit DMA request; that is:
Realtek confidential files
The document authorized to
SZ99iot
2019-05-15 10:08:03