Shop OBEX P1 Docs P2 Docs Learn Events
I2C initialization phase from pasm driver — Parallax Forums

I2C initialization phase from pasm driver

mathkmathk Posts: 1
edited 2012-12-02 19:57 in General Discussion
Hi All

From the code of the I2C driver it look like there is an initialize method that send one byte 0 on the wire.
This byte is send before the start sequence. When using this library to drive a device like the MCP4725 DAC it does not cause any issue but in the data sheet there is no reference to this initialize sequence.
Is that sequence part of the I2C specification that I am not aware of?

Thanks

Comments

  • SRLMSRLM Posts: 5,045
    edited 2012-12-02 16:46
    Just to clarify: the word "start" has a particular meaning in relation to I2C: it's the start of a data transmission, when the SDA line is pulled low while the SCL line is still high.

    From the object, this is what the initialize function does:
    '' This routine puts the I2C bus in a known state. It issues up to nine clock
    '' pulses waiting for the input to be in a high state. It exits with the clock
    '' driven high and the data floating in the high state for the minimum high
    '' clock time.

    It's not part of the I2C specification. However, this object that you linked to doesn't follow the specification exactly: it assumes no pullups on the lines. I suspect that the initialize routine is part of fulfilling that assumption.
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-12-02 19:57
    The Pasm I2C Driver is basically a one-to-one mapping of Mike Green's Basic I2C Driver from Spin to PASM. In the Spin version, the initialize method is used to put the devices on the I2C bus in an idle state. I assume Mike did this because it's possible that an I2C device could have been left in an unknown state from some previous I2C accesses, perhaps with a different driver. The PASM version of the driver also uses the initialize method to start the PASM cog. As SRLM stated, START has another function related to I2C, so it is not used to start the PASM cog.
Sign In or Register to comment.