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

Alexandre Abadie alexandre.abadie at inria.fr
Fri Aug 5 16:52:02 CEST 2016


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 

----- Mail original -----

> 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

> _______________________________________________
> devel mailing list
> devel at riot-os.org
> https://lists.riot-os.org/mailman/listinfo/devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20160805/296d4ede/attachment.html>


More information about the devel mailing list