Skip to main content
Visitor II
March 29, 2025
Question

STM32 I2C interupt not being pended

  • March 29, 2025
  • 2 replies
  • 391 views

I am trying to write my own I2C driver but I have been having an issue that after sending the start condition both SCL and SDA lines go low and stay that way. After some painful debugging I realize that the I2C event interrupt handler is not being called, which I rely upon to write to the data register.

I tried to set pending the interrupt manually and the handler was invoked and a byte got send through, so I know that for some reason the hardware is just not pending it. I don't know why that is. Can anyone help?

    This topic has been closed for replies.

    2 replies

    Super User
    March 29, 2025

    Read out and check/post the I2C registers content.

    A generic "interrupt does not fire" checklist here.

    JW

    HoangHungAuthor
    Visitor II
    March 29, 2025

    Thank you for the reply. These are the values of the i2c registers.

    I2C2_CR1       0x00000401 = PE | ACK

    I2C2_CR2       0x00000324 = ITERREN | ITEVTEN | FREQ (=36)
    I2C2_OAR1    0x00000000
    I2C2_OAR2    0x00000000
    I2C2_SR1       0x00000001 = SB
    I2C2_SR2       0x00000003 = MSL | BUSY
    I2C2_CCR      0x000000B4 = CCR (=180)
    I2C2_TRISE   0x00000025

    The checklist did not add much.

     

    Super User
    March 30, 2025

    As both SB and ITEVTEN are set, and you're confident there's nothing else from the checklist which would prevent the interrupt to run, I am out of ideas, sorry.

    JW

    PS. You are aware of the fact that many 'F103 these days are counterfeit, aren't you.