AnsweredAssumed Answered

STM8L I2C

Question asked by Marco Costa on May 7, 2018

Hello, i have a STM8L Discovery board with a stm8l152C6T6 microcontroller. I'm currently trying to communicate with a M24LR04E (NFC) board through an I2C connection.

I've done some tests using the "generateStart" function, that appears to be working fine:
  1. I2C_GenerateSTART(I2C1,ENABLE);  
  2.        while(!I2C_CheckEvent(I2C1,I2C_EVENT_MASTER_MODE_SELECT));
  3.  
 
However, when trying to send data to the board through "send7bits" function, my code get stuck on the next "while" construction without any apparent reason:
  1.  I2C_Send7bitAddress(I2C1,(uint8_t)I2C_Slave_Adress,I2C_Direction_Receiver);
  2.      
  3. while(!I2C_CheckEvent(I2C1,I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED));//This while never stops
Additionally, I've tried other examples available through ST documentation ("I2C EEPROM" / "I2C TWOBOARDS") without success.
Any clue regarding what is happening will be very appreciated. 

 

Thanks!
The complete source code: https://pastebin.com/rWdKa06s
Circuit : https://imgur.com/a/xHU4z5T // The jumper has been set on

Outcomes