But the i2c program doesnt work together with robostix, does it?

2007/6/19, Dave Hylands <dhylands@gmail.com>:
Hi Agustin,

> I was seeing the codes relates with i2c-io and the AVR data sheet in the
> section Two wire serial interface, and i have some questions:
> When i downloaded the i2c-io program i saw the info related ths is exactly
> the same that http://docwiki.gumstix.org/I2c-io however the
> i2c-io prgram have a option related with ADC in switch case  I2C_IO_GET_ADC,
> can i used it or why dont appear in the commands supported.

When you do:

i2c-io 0x0b get D.3

it will call the function (on the gumstix) I2C_IO_GetGPIO which gets
translated into I2C_IO_GET_GPIO on the robostix. On the other hand
when you do:

i2c-io get ADC.3

it will call the function I2C_IO_GetADC which gets translates into
I2C_IO_GET_ADC on the robostix.

> Other thing that i was waiting to see is a machine state during the i2c-
> interrupt in main program
> what happed when TSWR have values like $A8, $B0, $B8, $C8, $C0 or $60, $68,
> $70, $78, $80, etc
> Im a beginner with this protocol, i would like to know how this program
> works in general.

The state machine for being a slave can be found in the file
robostix/common/i2c-slave.c The function I2C_SlaveHandler uses the
constants rather than hard coded numbers, so you'll see stuff like:

        if (( status == TW_SR_SLA_ACK )             // 0x60 - SLA+W
received ACK sent
        ||  ( status == TW_SR_ARB_LOST_SLA_ACK )    // 0x68 - SLA+W
received while trying to send SLA+R
        ||  ( status == TW_SR_GCALL_ACK )           // 0x70 - GCA+W
received, ACK sent
        ||  ( status == TW_SR_ARB_LOST_GCALL_ACK )) // 0x78 - CGA+W
received, ACK sent (while trying to send SLA+R/W)

> Finally question wich programs i need to modify in order to send more than
> 16 bits

Write more than 16 bits where?

The i2c program has a --count option which allows an arbitrary number
of bytes to be read.

When writing, you can do something like:

i2c 0x68 wb 10 0x123456789abcdef0

will write 8 bytes starting at register 10.

Dave Hylands
Vancouver, BC, Canada

This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
gumstix-users mailing list