I2C Slave ISSUE on STM32L0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-09-27 08:06 AM
Hi everyone,
I am trying to develop a Master-Slave system using two Nucleo-L053R8 boards. The first one is the master, which sends a command to the Slave board whenever the onboard button is pushed. Each time a new message is received, the slave board toggles the state of the onboard LED.
I can manage to send and receive properly only the first message, then the second message remains "stuck" on the I2C bus. If I reset the slave board, then the message is received.
TO ME, it seems that the interrupt flags of the slave ISR are not cleared. Therefore it is stuck in there (which is what I see when I do debugging). The while loop in the main is empty.
Here is the ISR of the Slave:
void HAL_I2C_SlaveRxCpltCallback(I2C_HandleTypeDef *hi2c1)
{
if(data_rx_i2c==0xAA)
HAL_GPIO_TogglePin(GPIOA,LD2_Pin);
}
I have disabled code optimization in Atollic True Studio, to make sure it does not interfere.
Does anyone have any suggestion or tip?
Thank you in advance