[riot-devel] I2C - Arduino <-> SAMR21-xpro

ALESSANDRO NICOLI alessandro.nicoli at studenti.unipr.it
Fri Aug 5 16:23:18 CEST 2016


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 :
<code>
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;
}
</code>


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


Thanks all !

*best regards, *
*Alessandro*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20160805/5643391b/attachment.html>


More information about the devel mailing list