Skip to main content
Associate
October 3, 2024
Question

I2C Communication Protocol

I am currently working on I2C communication with the STM32G030F6P6 microcontroller and developing a library for slave mode. I encountered an issue where, after the master transmits a command, the slave receives and processes the data, responding accordingly. However, when the command doesn't match the expected input and the master sends a receive request, clock stretching occurs. If anyone has insights on how to handle or resolve this, I would appreciate your suggestions

This topic has been closed for replies.

4 replies

ST Technical Moderator
October 3, 2024

Hello @dhirrajsharma, 

Did you check the Errata sheet related to your device?

Try enable the I2C listen mode to handle address match events.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
Associate
October 6, 2024
 
 
Senior III
October 7, 2024

What you can try to to implement a reply as "no info available" equivalent reply, so that i2c bus is  happy and the master knows that particular slave do not have that functionality implemented.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate
October 6, 2024

What will happen if the master requests data from the slave, but the slave does not have a function for transmission? In the transfer direction for transmission, I have enabled the listen mode, which results in a NACK and pulls up both the SDA and SCL lines. If the master attempts to transmit or request data again, the status shows HAL_BUSY, or the master gets stuck in the transmitting state.