2025-02-24 05:01 PM - edited 2025-02-24 07:14 PM
I am using STM32C031C6 MCU connected to an NTAG5 IC via I²C. The MCU is configured as an I²C master transmitter and master receiver. Polling mode is used to transmit and receive data to/from the NTAG5.
Below is the code I am using to write and read I²C data. Currently, I have not considered any error conditions such as BERR, ARLO, etc., as described in section 23.4.16 (Error conditions) of the RM0490 STM32C0x1 reference manual.
I am not sure how to generate these errors and whether it is necessary to handle them in a setup with one master and one slave. If error handling is required, what actions should be taken, such as generating a STOP condition, clearing errors etc?
Could you please provide guidance on how to generate & handle these error conditions and whether it is necessary to implement error handling in this scenario?
Also is it better to reset I2C peripheral in case timeout happens?
Thank you!