cancel
Showing results for 
Search instead for 
Did you mean: 

interrupt is not working for I2C

ABD_Delhi
Associate

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 

 

2 REPLIES 2
Karl Yamashita
Lead II

KarlYamashita_0-1719277886452.png

 

uint16_t Device_Add = 36 << 1;
If you find my answers useful, click the accept button so that way others can see the solution.

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