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:


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

<DEV-ID> – 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

<DEV-#> – 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.

<COMMANDs> – 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

other useful commands are:

1. CHANGE DEVICE ADDRESS, MOD-IO2 have jumper when you connect it the MOD-IO2 address switch from the default 0xA0 to the temporary 0xF0 (to not mess with the other devices on the I2C bus) and you can assign any address to it wih the command:

$ ./i2c-tool -w 0 0×48 4 0×02 0xF0 0xB0 <new-address>

./i2c-tool -w 0 0×48 4 0×02 0xA0 0×01 <data>

./i2c-tool -w 0 0×48 4 0×02 0xA0 0×02 <data>

./i2c-tool -w 0 0×48 3 0×02 0xA0 0×03
./i2c-tool -r 0 0×48 1

./i2c-tool -w 0 0×48 4 0×02 0xA0 0×04 <data>

./i2c-tool -w 0 0×48 3 0×02 0xA0 [0x10|0x11|0x12|0x13|0x17]
./i2c-tool -r 0 0×48 2

where 0×10 – analog input 0
0×11 – analog input 1
0×12 – analog input 2
0×13 – analog input 3
0×17 – analog input 7

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 564 other followers

%d bloggers like this: