Senior
February 22, 2017
Question
STM32F334 with 24C32 EEPROM I2C Read/Write
- February 22, 2017
- 7 replies
- 7824 views
Posted on February 22, 2017 at 09:59
Hi,
Trying to get I2C communication between a F334 and a 24C32 EEPROM working,
The read and write functions do return correctly, but the reads do not match what
has been written to the EEPROM. Struggling to find the issue at hand and in the
thought that someone could possibly lend me a hand on this issue, which would
be very helpful. The EEPROM's address lines are all grounded, which effectively
puts the EEPROM at an address of 0xA0
The output I am reading in a terminal, which says:
-------------= I2C1 REG dump =------------- I2C_CR1 : 0x01 I2C_CR2 : 0x20404a1 I2C_OAR1 : 0x8000 I2C_OAR2 : 0x00 I2C_TIMINGR : 0x10c08dcf I2C_TIMEOUTR: 0x00 I2C_ISR : 0x01 I2C_ICR : 0x00 I2C_PECR : 0x00 I2C_RXDR : 0xff I2C_TXDR : 0x00 ------------------------------------------- Data: ff ff ff ff -------------= I2C1 REG dump =------------- I2C_CR1 : 0x01 I2C_CR2 : 0x20404a1 I2C_OAR1 : 0x8000 I2C_OAR2 : 0x00 I2C_TIMINGR : 0x10c08dcf I2C_TIMEOUTR: 0x00 I2C_ISR : 0x01 I2C_ICR : 0x00 I2C_PECR : 0x00 I2C_RXDR : 0xff I2C_TXDR : 0x00 ------------------------------------------- Data: ff ff ff ffwhich doesnt reflect what I have written. I was expecting 0x00, 0x01, 0x02, 0x03
as expected as in:
i2c_wr(0xa0, 0x00, 0x00);
i2c_wr(0xa0, 0x01, 0x01); i2c_wr(0xa0, 0x02, 0x02); i2c_wr(0xa0, 0x03, 0x03);instead of 0xff, 0xff, 0xff, 0xff.
Any thoughts/suggestions ?
Thanks.
#stm32f334-i2c Note: this post was migrated and contained many threaded conversations, some content may be missing.