Skip to main content
Pedram
Associate III
September 6, 2017
Question

I2C Busy flag always set

  • September 6, 2017
  • 2 replies
  • 1141 views
Posted on September 06, 2017 at 16:16

Hello

i using STM32F103ZET6 & STM32CubeMX V4.22.0 & Firmware F1 V1.6

i want Send Data Via I2c But HAL_I2C_Master_Transmit Return HAL_BUSY 

i Remove My I2c device (AT24C512) but Still 

HAL_I2C_Master_Transmit  Return 

HAL_BUSY 

How can I fix this problem?

Thank

    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    September 6, 2017
    Posted on September 06, 2017 at 16:25

    Do you have external pull up resistors on the SDA/SCL pins?

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Pedram
    PedramAuthor
    Associate III
    September 6, 2017
    Posted on September 06, 2017 at 16:31

    yes i do , i using resistors 10k on sda/scl 

    But HAL_I2C_Master_Transmit Return HAL_BUSY 
    Tesla DeLorean
    Guru
    September 6, 2017
    Posted on September 06, 2017 at 16:50

    Ok, then look at how the pins vs peripheral are initialized, the F1 parts were always a bit awkward in terms of when the I2C bus was enabled wrt the state of the pins. Not familiar with HAL implementation on the F1.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Pedram
    PedramAuthor
    Associate III
    September 6, 2017
    Posted on September 06, 2017 at 17:07

    I thought I found the problem

    When I comment on the code below, it works correctly and 

    HAL_I2C_Master_Transmit

     Return HAL_TIMEOUT

    __HAL_AFIO_REMAP_I2C1_ENABLE();

    but why ?