Shop OBEX P1 Docs P2 Docs Learn Events
I2C reset (part of protocol or by device/manufacturer only?) — Parallax Forums

I2C reset (part of protocol or by device/manufacturer only?)

ZootZoot Posts: 2,227
edited 2009-04-22 22:45 in General Discussion
I have had a only a bare handful of projects where under certain circumstances an I2C slave may "lockup" (generally by not releasing SCL if a lockup happens during clock stretching -- masters that do not timeout under these circumstances usually fall into their own endless loop as well because SCL never goes high). There are workarounds of course: polling SCL, bit-banging I2C routines to ensure that I2C transactions timeout while waiting for a slave to release a line, power cycling the slave, etc.

However, I came across this tidbit in a datasheet from Atmel (an I2C 32kbit SOIC EEPROM) and was wondering if this is part of the I2C protocol proper, or just a (widely-used?) convention followed by some manufacturers but not necessarily all.
doc said...
After an interruption in protocol, power loss or system reset, any 2-
wire part can be reset by following these steps:
(a) Clock up to 9 cycles, (b) look for SDA high in each cycle while SCL is high and then
(c) create a start condition as SDA is high.

Anybody know about this?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST

1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php

Comments

  • InSilicoInSilico Posts: 52
    edited 2009-04-22 05:51
    According to the I2C spec:
    I2C-bus compatible devices must reset their bus logic
    on receipt of a START or repeated START condition
    such that they all anticipate the sending of a slave
    address, even if these START conditions are not
    positioned according to the proper format.
    So·a·START condition is basically the same thing as a reset. I don't see anywhere in the spec that says 9 clock cycles need to precede that. Maybe it's a workaround for some I2C devices with bugs in the silicon that prevents a proper reset after receipt of a START condition.
  • BeanBean Posts: 8,129
    edited 2009-04-22 11:32
    The 9 clocks are needed in case the other device is sending a zero byte (hence holding SDA low for eight clocks).
    You don't HAVE to send all 9 clocks, after each clock you are just looking for SDA to go high.
    If SDA doesn't go high after 9 clocks, then something is really screwed up.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There is a fine line between arrogance and confidence. Make sure you don't cross it...

    ·
  • ZootZoot Posts: 2,227
    edited 2009-04-22 12:41
    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • OwenSOwenS Posts: 173
    edited 2009-04-22 22:45
    If SDA is low for 9 clocks, thats where SMBus comes in: The hardware in SMBus devices must reset if SDA is held low for a certain amount of clocks IIRC
Sign In or Register to comment.