Skip to main content
askari.nima
Associate III
January 16, 2015
Question

HAL and I2c problem

  • January 16, 2015
  • 11 replies
  • 1481 views
Posted on January 16, 2015 at 12:42

I connect mpu6050 to i2c3 and make a project with stm32cube and enable i2c3.

but cant detect sensor.

for(i=0 ; i<255 ; i++)

    {

        test = HAL_I2C_IsDeviceReady(&hi2c3,i,10,100);

        if(test == HAL_OK)

            break;

    }

return always HAL_BUSY 

my board is stm32f4discovery

#i-can''t-help-you-with-that
    This topic has been closed for replies.

    11 replies

    askari.nima
    Associate III
    January 16, 2015
    Posted on January 16, 2015 at 16:56

    please answer me

    Tesla DeLorean
    Guru
    January 16, 2015
    Posted on January 16, 2015 at 19:58

    please answer me

    Do you think you've provided enough circuit or software details for anyone to replicate your experiment?
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    askari.nima
    Associate III
    January 17, 2015
    Posted on January 17, 2015 at 12:22

    my answer is why when i want to read or write from i2c bus , all HAL_I2c_...  function return me HAL_BUSY.

    I enable I2c 3 in stm32f4cube and make project in keil.

    I connect SDA and SCL pin to MPU6050 sensor.

    I test this hardware with another program an it work property.

    My problem in HAL_DRIVER

    askari.nima
    Associate III
    January 19, 2015
    Posted on January 19, 2015 at 08:16

    I'm waiting for your answer.

    thanks

    serkodog
    Associate II
    January 19, 2015
    Posted on January 19, 2015 at 10:01

    Hi! Try to add some delay between your cycles.

    serkodog
    Associate II
    January 19, 2015
    Posted on January 19, 2015 at 10:05

    It is from function ''HAL_I2C_IsDeviceReady'' description:

    This function is used with Memory devices.

    askari.nima
    Associate III
    January 19, 2015
    Posted on January 19, 2015 at 10:19

    I try delay . but not work.

    I see a simple code to use sensor with Hal memory write function.

    This program must be check all i2c address on port and return if exist

    askari.nima
    Associate III
    January 20, 2015
    Posted on January 20, 2015 at 07:01

    Please Help me Clive1.

    askari.nima
    Associate III
    January 20, 2015
    Posted on January 20, 2015 at 21:08

    askari.nima
    Associate III
    January 21, 2015
    Posted on January 21, 2015 at 10:51

    I see in debug mode , when  execute Init I2c function , Busy flag going to  Set.