[En-Nut-Discussion] TWI and Ethernut
bernard.fouche at kuantic.com
Tue Jan 22 16:23:02 CET 2008
FYI we use here very often I2C/TWI with Ethernet 2.1b as an I2C master
with different I2C slaves (I/O expanders like PCF8574 or ADC like
ADS7828) and it works fine. If you are using a multi-threaded
application, think about using some semaphore to handle the bus sharing
The API is simple to use, however the I2C addresses will be left shifted
once by the underlying code. So if your target I2C address is, for
instance 0x4E, you must provide to the API 0x4E>>1, hence 0x27. Using
slow transmission speed and an oscilloscope makes it easy to check the
I2C transaction if the target device does not answer.
Don't forget the pull-ups on SDA and SCL.
Marcel Comos wrote:
> Has anyone use TWI aka. I2C on Ethernut 2.1?
> I try use an external ADC and an external DAC.
> But I don't know how I can start the transmission so can anyone help with an
> example code of using TWI?
More information about the En-Nut-Discussion