Skip to main content
Dick Lin
Senior
August 16, 2018
Question

I2C HAL_I2C_Mem_Read ( ) failed

  • August 16, 2018
  • 18 replies
  • 4916 views

Hi,

I am working on I2C read EEPROM. The HAL function failed due to the I2C_FLAG_BUSY is always SET.

Is there anything I am missing in init code?

Thx

  if (I2C_WaitOnFlagUntilTimeout(hi2c, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY, tickstart) != HAL_OK)

  {

   return HAL_TIMEOUT;

  }

    This topic has been closed for replies.

    18 replies

    Dick Lin
    Dick LinAuthor
    Senior
    August 17, 2018

    You are right. I correct it OR to 0x01. Thx

    T J
    Senior III
    August 17, 2018

    works now ?

    now we find the next issue :(

    its a difficult struggle to bring up code on a new chip.

    best not to use blocking code, otherwise you will continually have issues...

    Dick Lin
    Dick LinAuthor
    Senior
    August 20, 2018

    No, I corrected the READ command after you but still failing.

    This is our existing driver for NXP MCP5777m. I just ported to STM32. Still seeing issue and it's on STM32 side for all of checking before sending I2C data out.

    I am wondering if the init code not quite right. I am using MXCube code.

    Thx

    andrew239955_stm1_stmicro_com
    Associate II
    June 6, 2023

    This is often because you don't have pull-ups on the SDA and/or SCL lines (4.7k-10k). You can also enable the internal pull-ups in the MCU itself.

    S.Ma
    Principal
    June 7, 2023


    _legacyfs_online_stmicro_images_0693W00000dDHLSQA4.png24AA02E48/25E48/24AA02E64/25E64 Data Sheet (microchip.com)

    Notice the Restart bit in the middle? That is true I2C.

    It does not match your reference shared document.

    Same device, really?