STM8L I2C
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:
I2C_GenerateSTART
(
I2C1,
ENABLE)
;
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:
- I2C_Send7bitAddress
(
I2C1,
(
uint8_t
)
I2C_Slave_Adress,
I2C_Direction_Receiver)
;
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:
Circuit :
// The jumper has been set on#i2c #eeprom #m24lr04e-r #stm8l-discovery #nfc