Wednesday, October 24, 2012

Working with iMX233-OLinuXino and MOD-IO2

UEXT connector allow many and different devices to be attached to it.

To may they all work together without collisions I2C protocol is used to address them.

The protocol is like this:



– this is the unique OLIMEX I2C address which is 0×48 this address is used to talk to all Olimex UEXT modules.

– this is the ID of every UEXT module TYPE which is attached to the I2C bus, for instance if we want to talk to MOD-IO2 this ID is 0×02

– as we can have many MOD-IO2 connected on the I2C but this is the MOD-IO2 address number which we talk to, each MOD-IO2 by default have address 0xA0, this address can be re-programmed to other value so many MOD-IO2 to be connected together.

– allow specific command to be sent to the UEXT module like switch relays, read GPIOs, read AINx etc.

Set-relay command is 0×40, Set-new-address command is 0xB0, read AIN0 is 0×10 read AIN7 is 0×17 and so on.



if we use I2CTOOL we can talk easily to MOD-IO2 connected to iMX233-OLinuXino, for instance to switch both relays ON we can do:

$ ./i2c-tool -w 0 0×48 4 0×02 0xA0 0×40 0×03

where -w means I2C write, 0 – this is I2C channel we write to channel 0, 0×48 is OLIMEX I2C address, 4 is number of bytes to follow, 0×02 is MOD-IO2 ID, 0xA0 is default MOD-IO2 address, 0×40 is set-relay command, 0×03 is set both relays

No comments: