Inter-integrated circuit interface (I2C)
The SMBus Host address (0b0001 000) is enabled by calling I2C_Init() function and
setting I2C_Mode member of I2C_InitTypeDef() structure to I2C_Mode_SMBusHost.
The Alert Response Address (0b0001 100) is enabled using I2C_SMBusAlertCmd()
function.
To detect cumulative SCL stretch in master and slave mode, TIMEOUTB should be
configured (in accordance to SMBus specification) using I2C_TimeoutBConfig() function
then I2C_ExtendedClockTimeoutCmd() function should be called to enable the detection.
SCL low timeout is detected by configuring TIMEOUTB using I2C_TimeoutBConfig()
function followed by the call of I2C_ClockTimeoutCmd(). When adding to this procedure
the call of I2C_IdleClockTimeoutCmd() function, Bus Idle condition (both SCL and SDA
high) is detected also.
ï‚· I2C_SMBusAlertCmd()
ï‚· I2C_ClockTimeoutCmd()
ï‚· I2C_ExtendedClockTimeoutCmd()
ï‚· I2C_IdleClockTimeoutCmd()
ï‚· I2C_TimeoutAConfig()
ï‚· I2C_TimeoutBConfig()
ï‚· I2C_CalculatePEC()
ï‚· I2C_PECRequestCmd()
ï‚· I2C_GetPEC()
13.2.5 I2C registers management functions
This section provides a functions that allow user the management of I2C registers.
ï‚· I2C_ReadRegister()
13.2.6 Data transfers management functions
This subsection provides a set of functions allowing to manage the I2C data transfers.
The read access of the I2C_RXDR register can be done using the I2C_ReceiveData()
function and returns the received value. Whereas a write access to the I2C_TXDR can be
done using I2C_SendData() function and stores the written data into TXDR.
ï‚· I2C_SendData()
ï‚· I2C_ReceiveData()
13.2.7 DMA transfers management functions
This section provides two functions that can be used only in DMA mode.
In DMA Mode, the I2C communication can be managed by 2 DMA Channel requests:
1. I2C_DMAReq_Tx: specifies the Tx buffer DMA transfer request.
2. I2C_DMAReq_Rx: specifies the Rx buffer DMA transfer request.
In this Mode it is advised to use the following function:
ï‚· I2C_DMACmd(I2C_TypeDef* I2Cx, uint32_t I2C_DMAReq, FunctionalState
NewState);
ï‚· I2C_DMACmd()