I should write a driver to interface 24fc256 eeprom on a STM32F767 MCU. I have also got experiances and working codes with this eeprom with previous versions of ChibiOS on F4. Only the ChibiOS master branch contains support to this MCU and that is why i am using the most recent version of the master.
Code: Select all
static const I2CConfig i2cfg = {
STM32_TIMINGR_PRESC(10U) |
STM32_TIMINGR_SCLDEL(9U) | STM32_TIMINGR_SDADEL(9U) |
STM32_TIMINGR_SCLH(21U) | STM32_TIMINGR_SCLL(24U),
0, // CR1
0, // CR2
NULL // Receive callback
};
uint8_t tx[2] = {0};
uint8_t buff = 0x00;
tx[0] = 0x00; //msb addr
tx[1] = 0x00; //lsb addr
i2cAcquireBus(&I2CD1);
i2cmsg = i2cMasterTransmitTimeout(&I2CD1, 0x50, tx, 2, &buff, 1, TIME_INFINITE);
i2cReleaseBus(&I2CD1);
I tried to read one byte from the address 0x0000 but i did not receive anything. The i2cmsg returns 0, the i2cGetErrors() returns 0. Everything seems fine. I measured the i2c bus (i attached the image) and i saw that the sent memory address is not what i expect (0x0000). I tried to modify to another address but the sent message via the i2c bus is static and doesn't react any modification.
Did i did something wrong? Do you have any idea what is the problem?
Thank you very much,
Richard