Skip to main content
Visitor II
October 3, 2024
Question

I2C Communication Protocol

  • October 3, 2024
  • 2 replies
  • 972 views

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.

    2 replies

    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.

    Visitor II
    October 6, 2024
     
     
    Graduate II
    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.

    Visitor II
    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.