EasyManuals Logo

ST STM32F31xx User Manual

ST STM32F31xx
584 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #252 background imageLoading...
Page #252 background image
Inter-integrated circuit interface (I2C)
UM1581
252/584
DocID023800 Rev 1
13.2.8 Interrupts and flags management functions
This section provides functions allowing to configure the I2C Interrupts sources and check
or clear the flags or pending bits status. The user should identify which mode will be used
in his application to manage the communication: Polling mode, Interrupt mode or DMA
mode(refer I2C_Group6) .
Polling Mode
In Polling Mode, the I2C communication can be managed by 15 flags:
1. I2C_FLAG_TXE: to indicate the status of Transmit data register empty flag.
2. I2C_FLAG_TXIS: to indicate the status of Transmit interrupt status flag .
3. I2C_FLAG_RXNE: to indicate the status of Receive data register not empty flag.
4. I2C_FLAG_ADDR: to indicate the status of Address matched flag (slave mode).
5. I2C_FLAG_NACKF: to indicate the status of NACK received flag.
6. I2C_FLAG_STOPF: to indicate the status of STOP detection flag.
7. I2C_FLAG_TC: to indicate the status of Transfer complete flag(master mode).
8. I2C_FLAG_TCR: to indicate the status of Transfer complete reload flag.
9. I2C_FLAG_BERR: to indicate the status of Bus error flag.
10. I2C_FLAG_ARLO: to indicate the status of Arbitration lost flag.
11. I2C_FLAG_OVR: to indicate the status of Overrun/Underrun flag.
12. I2C_FLAG_PECERR: to indicate the status of PEC error in reception flag.
13. I2C_FLAG_TIMEOUT: to indicate the status of Timeout or Tlow detection flag.
14. I2C_FLAG_ALERT: to indicate the status of SMBus Alert flag.
15. I2C_FLAG_BUSY: to indicate the status of Bus busy flag.
In this Mode it is advised to use the following functions:
ï‚· FlagStatus I2C_GetFlagStatus(I2C_TypeDef* I2Cx, uint32_t I2C_FLAG);
ï‚· void I2C_ClearFlag(I2C_TypeDef* I2Cx, uint32_t I2C_FLAG);
Do not use the BUSY flag to handle each data transmission or reception.It is
better to use the TXIS and RXNE flags instead.
Interrupt Mode
In Interrupt Mode, the I2C communication can be managed by 7 interrupt sources and 15
pending bits:
Interrupt Source:
1. I2C_IT_ERRI: specifies the interrupt source for the Error interrupt.
2. I2C_IT_TCI: specifies the interrupt source for the Transfer Complete interrupt.
3. I2C_IT_STOPI: specifies the interrupt source for the Stop Detection interrupt.
4. I2C_IT_NACKI: specifies the interrupt source for the Not Acknowledge received
interrupt.
5. I2C_IT_ADDRI: specifies the interrupt source for the Address Match interrupt.
6. I2C_IT_RXI: specifies the interrupt source for the RX interrupt.
7. I2C_IT_TXI: specifies the interrupt source for the TX interrupt.
Pending Bits:
1. I2C_IT_TXIS: to indicate the status of Transmit interrupt status flag.
2. I2C_IT_RXNE: to indicate the status of Receive data register not empty flag.
3. I2C_IT_ADDR: to indicate the status of Address matched flag (slave mode).

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the ST STM32F31xx and is the answer not in the manual?

ST STM32F31xx Specifications

General IconGeneral
BrandST
ModelSTM32F31xx
CategoryMicrocontrollers
LanguageEnglish

Related product manuals