AnsweredAssumed Answered


Question asked by Marco Costa on May 7, 2018
Latest reply on Jun 14, 2018 by Clive Two.Zero

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));
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);
  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. 


The complete source code:
Circuit : // The jumper has been set on