620
/
838
Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
1.
In DMA_PADDRx register set the address of the I2C_DAT register. In every I2C_STS1.RXDATEN event, data
will send from address to storage area.
2.
In DMA_MADDRx register set the memory area address. In every I2C_STS1.RXDATEN event,data will send
from I2C_DAT register to storage area.
3.
In DMA_TXNUMx register set the number of need to be transferred. In every I2C_STS1.RXDATEN event the
number-1 until 0.
4.
In DMA_CHCFGx register set PRIOLVL[0:1] to configure the priority of channel.
5.
In DMA_CHCFGx register clear DIR to configure when ocurrs a interrupt request whether received half data
or all data is received.
6.
In the DMA_CHCFGx register set CHEN bit to activate the channle.
7.
When DMA tansfer data is done, DMA need to send EOT/EOT_1 signal to I2C indicate this transfer is done, if
interrupt is enbale, DMA ocurrs a interrupt.
Note: If DMA is used for receiving, do not set I2C_CTRL2.BUFINTEN bit.
22.3.5
Packet error check
Setting the I2C_CTRL1.PECEN bit to 1 enables the PEC function. PEC uses CRC-8 algorithm to calculate all
information bytes including address and read/write bits.it can improve the reliability of communication. The CRC-8
polynomial uses by the PEC calculator is C(x) = x
8
+ x
2
+ x + 1.
In transmit mode, software sets I2C_CTRL1.PEC transfer bit in the last I2C_STS1.TXDATE event, and then PEC
will be transferred in the last byte. In receiving mode, software sets I2C_CTRL1.PEC transfer bit after the last
I2C_STS1.RXDATNE event, and then receives the PEC byte and compares the received PEC byte to the internally
calculated PEC value. If it is not equal to the internally calculated PEC value, the receiver needs to send a NACK. If
it is host receiver mode, NACK will be sent after PEC regardless of the calculated result. It should pay attention that
I2C_CTRL1.PEC bit has to be set before receiving.
If both DMA and PEC calculator are activated, I2C will automatically send or check the PEC value.
In transfer mode, when I2C interface receives EOT signal from DMA controller, it will automatically send PEC
following the last byte. In receiving mode, when I2C interface receives an EOT_1 signal from DMA, it will
automatically consider the next byte as PEC and compare it with the internally calculated PEC. It will happen a DMA
request after receiving PEC.
In order to allow intermediate PEC transfer, I2C_CTRL2.DMALAST bit is used to determine whether it is the last
DMA transfer. And if it does the last DMA request of the master receiver, NACK will be sent automatically after
receiving the last byte.
When arbitration is lost, PEC calculation is invalid.