AT32F425
Series Reference Manual
2022.03.30
Page 135
Ver 2.01
Figure 11-17 SM Bus master receive timing
Master to Slave
Slave to Master
S = Start
A = Acknowledge
P = Stop
SMBus master receiver N bytes +PEC
Initial setting flow :
1. I2C_CTRL2_CNT = N+ 1
2. I2C_CTRL2_SADDR = slave address
3. I2C_CTRL2_ASTOPEN = 1
4. I2C_CTRL1_PECEN = 1
5. I2C_CTRL2_PECTEN = 1
6. I2C_CTRL2_GENSTART = 1
EV1. I2C_STS_ADDRF = 1, set I2C_CLR_ADDRC
EV2. I2C_STS_RDBF, read Data1
EV3. I2C_STS_RDBF, read Data2
EV4. I2C_STS_RDBF, read DataN
EV5. I2C_STS_RDBF, read PEC
EV6. I2C_STS_STOPF=1, set I2C_CLR_STOPC
Address
S
r/w
A
Data1
A
Data2
NA P
EV2
EV6
RDBF
A
PEC
EV3
EV5
EV1
Initial setting
DataN
A
EV4
SCL
Stretch
11.4.7 SMBus slave communication flow
The SMBus is similar to the I
2
C in terms of slave communication flow.
1.
I
2
C
clock initialization (by setting the I2C_CLKCTRL register)
―
I
2
C
clock divider: DIV[7: 0]
―
Data hold time (t
H D ; D A T
):
SDAD[3: 0]
―
Data setup time (t
S U ; D AT
)
: SCLD[3: 0]
The register can be configured by means of Artery_I2C_Timing_Configuration tool.
2.
Set local address
―
Set 7-bit address mode: by setting ADDR1MODE = 0 in the I2C_OADDR register
―
Set address 1: by setting the ADDR1 bit in the I2C_OADDR1 register
―
Enable address 1: by setting ADDR1EN=1 in the I2C_OADDR1 register
3.
SMBus-related initialization
―
Select SMBus host: device default address acknowledged (0b1100001x) by setting
DEVADDREN=1
―
Enable PEC calculation: Set PECEN=1 in the I2C_CTRL1 register
―
Set slave byte control mode:
Slave transmit: disable byte control mode by setting SCTRL=0 in the I2C_CTRL1 register
Slave receive: enable byte control mode by setting SCTRL=1 in the I2C_CTRL1 register
4.
Wait for address matching
When the local address is received, the ADDRF bit is set in the I2C_STS register. The data transfer
direction can be obtained by read access to the SDIR bit in the I2C_STS register. When SDIR=0,
it indicates that the slave is receiving data, where as SDIR=1 indicates that the slave is sending
data. The ADDR[6:0 bit of the I2C_STS register indicates what kind of address has been received,
which is particularly helpful in the case when the dual address mode is used and the address 2
mode mask bit is set.
Enable PEC transfer: by setting PECTEN=1 in the I2C_CTRL2 register
Set the number of data to be transferred:
―
Slave transmit: by setting CNT=N in the I2C_CTRL2 register
―
Slave receive: by setting CNT=1 in the I2C_CTRL2 register
Set reload mode:
―
Slave transmit:
by setting RLDEN
=0 in the
I2C_
CTRL2
register
―
Slave receive: by setting RLDEN=1 in the I2C_CTRL2 register