AT32F425
Series Reference Manual
2022.03.30
Page 131
Ver 2.01
Slave receive byte control
In slave receive mode, the slave receive byte control mode (SCTRL=1) can be used to control
ACK/NACK signals of each received byte. Refer to section 11.4.2 for more information.
Table 11-5 SM Bus mode configuration
Transfer mode
PECEN
PECTEN
RLDEN
ASTOPEN
SCTRL
Master
receive/tSTOP
1
1
0
1
-
Master receive/transmit
+RESTART
1
1
0
0
-
Slave receive
1
1
1
-
1
Slave transmit
1
1
0
-
-
How to use the interface in SMBus mode
1.
Set SMBus default address acknowledgement:
HADDREN=1: Master default address acknowledged (
0b0001000x)
DEVADDREN=1: Device default address acknowledged (
0b1100001x)
2.
Configure PEC
3.
Slave receive byte control mode can be enabled (with SCTRL bit in the I2C_CTRL1) in slave
mode, if necessary
4.
Other configurations follow the
I
2
C
However, the detailed SMBus protocol implementation should be handled by software, since the I
2
C
interface is only enabled to recognize the addresses of SMBus protocols.
11.4.6 SMBus master communication flow
The SMBus is similar to the I
2
C in terms of master 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]
―
SCL high duration: SCLH[7: 0]
―
SCL low duration: SCLL[7: 0]
The register can be configured by means of Artery_I2C_Timing_Configuration tool.
2.
SMBus-related initialization
―
Select SMBus host: host default address acknowledged (0b0001000x) by setting HADDREN=1
―
Enable PEC calculation: Set PECEN=1 in the I2C_CTRL1 register
―
Enable PEC transfer: Set PECTEN=1 in the I2C_CTRL2 register
3.
Set the number of bytes to be transferred
―
Disable
reload mode by setting RLDEN=0 in the I2C_CTRL2 register
―
Set CNT[7:0]=N in the I2C_CTRL2 register
The number of bytes to be transferred is <255 in SMBus mode at one time.
4.
End of data transfer
―
ASTOPEN=0: stop data transfer by software. After the completion of data transfer, the TDC is
set in the I2C_STS register, and GENSTOP=1 or GENSTART=1 is written by software to send
a STOP or START condition
―
ASTOPEN=1: data transfer is stopped automatically. A STOP condition is sent at the end of
data transfer
5.
Set slave address
―
Set slave address value (by setting the SADDR bit in the I2C_CTRL2 register)
―
Set 7-bit slave address mode (by setting the ADDR10=0 in the I2C_CTRL2 register)