Skip to main content
Visitor II
June 22, 2024
Question

interrupt is not working for I2C

  • June 22, 2024
  • 1 reply
  • 853 views

Hello,

we are using the I2C in STM32L431 as below configuration

  1. STM32L431RCT6 as Master in I2C bus
  2. STM32L431RBT6 as Slave in I2C bus

in all .ioc file we enabled the event and error interrupt for both controllers

Master will send query to slave for some data after every 1 sec.

if slave does only I2C communication, then the query is received by slave. but if slave does some other tasks also then query is not received by slave.

during testing we found that Slave is not getting the interrupt.  HAL_I2C_SlaveRxCpltCallback() is not called.

Pls help me to solve it.

my code of slave(I2C_S_Reply) and master(I2C_M_Read) is attached with the 

 

    This topic has been closed for replies.

    1 reply

    Graduate II
    June 25, 2024

    KarlYamashita_0-1719277886452.png

     

    uint16_t Device_Add = 36 << 1;
    ABD_DelhiAuthor
    Visitor II
    June 26, 2024

    Thanks Karl,

    Master is sending the data to slave, slave received the data in while(1).

    But we want to receive data on interrupt basis.

    during debugging none of the following functions were called in receive or transmit condition.

    HAL_I2C_MasterRxCpltCallback()

    HAL_I2C_MasterTxCpltCallback()

    HAL_I2C_SlaveRxCpltCallback()

    HAL_I2C_SlaveTxCpltCallback{()

    Pls help us to get data on interrupt.

    code of both controller was attached with the original post