This is the mail archive of the ecos-devel@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

CYG_I2C_BITBANG_SDA_OUTPUT


Hi Bart

I've a college who is implementing a BitBang I2C bus driver. He has
discovered that the documentation is missing something. It does not
describe the use of CYG_I2C_BITBANG_SDA_OUTPUT. 

Setting the SDA to an output is clear. However does it have to take
care of how it is driven, ie High/Low? eg consider the code:

    // We have read the last bit. SDA is still an input, SCL is low.
    // We need to switch SDA to an output and send the ack/nak
    (*banger)(mash, CYG_I2C_BITBANG_SDA_OUTPUT);
    (*banger)(mash, nak ? CYG_I2C_BITBANG_SDA_HIGH : CYG_I2C_BITBANG_SDA_LOW);

If the last driven state of SDA was high, and nak is false, it could
be that the call for CYG_I2C_BITBANG_SDA_OUTPUT sets SDA to high, and
then the next statement puts it low again, causing a short spike. Is
this a problem? Should it first read the current state of SDA, set the
drive level and then flip it to an output?

     Thanks
        Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]