Skip to main content
pranathi1091
Associate III
November 29, 2012
Question

Busy flag Set in I2C

  • November 29, 2012
  • 19 replies
  • 2888 views
Posted on November 29, 2012 at 06:22

The original post was too long to process during our migration. Please click on the attachment to read the original post.
    This topic has been closed for replies.

    19 replies

    pranathi1091
    Associate III
    November 29, 2012
    Posted on November 29, 2012 at 09:36

    Hello all,

    I did observe this while testing.

    I am able to generate start condition, (SB is set)

    and when i send the address , i get Acknoweledge failure.

    Could any one let me know what might be the cause for this.

    Or is there any problem with my code.

    Thanks

    frankmeyer9
    Associate III
    November 29, 2012
    Posted on November 29, 2012 at 11:25

    I did observe this while testing.

     

    Good idea.

    ...and when i send the address , i get Acknoweledge failure.

     

    You probably mean, SDA stays high while the 9.th SCL clock. Just for reference, make sure you measure all signals at least once ALSO on the slave side, i.e. on the pins of your sensor IC.

    Your sensor might not feel addressed. I2C addresses are often specified as 7 bit, while the LSB is used to differ between read and write access. Some specs. implicitly assume you to left-shift this value by one bit. Check this with the address you see on the bus.

    pranathi1091
    Associate III
    November 29, 2012
    Posted on November 29, 2012 at 13:05

    Thanks

    I could see the Data register its 0x40 which is my slave address

    Is this a clock issue or timing?

    Tesla DeLorean
    Guru
    November 29, 2012
    Posted on November 29, 2012 at 13:27

    I2C needs the pins in Open-Drain (OD) not Push-Pull (PP)

    If the I2C is BUSY someone on the bus is driving it LOW.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    frankmeyer9
    Associate III
    November 29, 2012
    Posted on November 29, 2012 at 13:45

    Is this a clock issue or timing?

    Not obviously, albeit you use an undisclosed define I2C_SPEED. I would start with standard speed.

    But I would check the address first. Is 0x40 the correct address of the sensor (TI wouldn't let me see the datasheet...) ?

    Is it specified there as 7 bit or 8 bit value ?

    And using the scope, you should see the address you are sending in the bus.

    pranathi1091
    Associate III
    November 29, 2012
    Posted on November 29, 2012 at 14:01

    Thanks

    I am using 2MHz . 7 bit address with a bit inteded to read or write is what is given in the data sheet

    pranathi1091
    Associate III
    November 29, 2012
    Posted on November 29, 2012 at 14:35

    Is it possible to watch the data i send on SDA in GPIO to which it is connected?

    If yes, i cannot see any thing in my ODR register, its always 0.

    frankmeyer9
    Associate III
    November 29, 2012
    Posted on November 29, 2012 at 14:55

    Is it possible to watch the data i send on SDA in GPIO to which it is connected?

     

    No, no way I know of.

    i2c is a serial protocol, the value written to the data register is serialized by the i2c peripheral, and streamed out over SCL/SDA.

    You will need a scope to see what actually happens on the bus.

    And, as said, I would start with 100kHz (i2c ''standard'' speed).

    pranathi1091
    Associate III
    November 29, 2012
    Posted on November 29, 2012 at 15:19

    Thanks

    Il check with it and get back if the problem still persists.

    Tesla DeLorean
    Guru
    November 29, 2012
    Posted on November 29, 2012 at 15:58

    Did you fix the pin driver issue?

    You can read the GPIO pin state using registers.

    You can tri-state the pin, and let the external 4K7 resistor pull up the lines. If it is not going high, then and external device on the bus is driving/clamping it low. Probe the circuit figure out which.

    You can clock confused I2C slave devices by driving the SCL manually, most slaves don't have an async reset, so if they get in odd states you must clock them out.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..