I2C - Arduino <-> SAMR21-xpro

Hi all, There is someone who tried to interface arduino to RIOT (the board in my case is SAMR21-xpro) through the I2C ?

I would config the Arduino as MASTER (i’ve already did it with wire.h) and samr21 as SLAVE.

I did a code like this :

int main(void) { puts(“I2C Reader”);

/* define own shell commands */ //char line_buf[SHELL_DEFAULT_BUFSIZE]; //shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);

char data; int read=0;

while(1){ puts(“waiting for data…”);

i2c_poweron(0); do{ read = i2c_read_byte(0, 8, data); if(read==-1) { puts(“ERROR : UNDEFINED DEVICE”); break; }else if(read>0) printf(“data arrived : %c”,data);

}while(read<1); }

return 0; }

Arduino will send 5 byte at time, but the samr21 doesn’t receive nothing…any ideas?

Thanks all !

Hi Alessandro,

Unfortunately, the current I2C API in RIOT only supports the master mode so you won’t be able to use your samr21-xpro as slave on this kind of bus.

I don’t know how complex it is to add support for this feature btw.

Cheers,

Alex