0
\$\begingroup\$

I have a 24FC01, 1 kbit EEPROM on my board. The SDA and SCL lines are pulled up to 3.3V through two 2k resistors. I'm using a STM32F407 MCU to read and write data to the EEPROM. Using the HAL libraries, I'm trying to check if the device is ready using HAL_I2C_IsDeviceReady(&i2c2, 0x50, 2, 100) function. However, this fails and returns false. The I2C is configured in CubeMX with 100 kHz clock speed and 7-bit addressing. What am I missing?

\$\endgroup\$
2
\$\begingroup\$

The STM32 HAL uses 8-bit addresses. Use 0xA0.

\$\endgroup\$
3
\$\begingroup\$

From the HAL source code:

DevAddress Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface

n.b. shifted to the left by one bit.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.