0

Feather M0 I2C Slave
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Feather M0 I2C Slave

by lyzadanger on Thu Feb 09, 2017 1:41 pm

Hello! I have several Feather M0s on-hand and am working on a project. I know full well that the Feather M0's I2C works great "in general" as a master, as I'm using one or two of the feathers to read data off of I2C sensors. But...I am having one heck of a time getting a Feather M0 to behave as a slave device to any other master. My end goal is to use a Tessel 2 to do I2C reads off of a Feather—the Feather is acting as a gateway to a LoRA network of of other Feathers/LoRA radios. It was all coming together wonderfully until I needed to read I2C data off of the Feather.

At this point I've whittled my debug setup down to two Feather M0s, connected on their I2C pins, and the most basic Arduino Wire example sketches for master reader/slave writer: https://www.arduino.cc/en/Tutorial/MasterReader. It's not working—and by "not working," I mean that the slave feather is not registering request events and the master feather is (correspondingly) not getting any responses from the slave. I've tried a bunch of things including pull-up resistors (currently using 4.7kΩ),
Code: Select all | TOGGLE FULL SIZE
Wire.setClock
, etc. This is a pretty basic set-up. I must be overlooking something profoundly obvious?

lyzadanger
 
Posts: 2
Joined: Thu Oct 24, 2013 11:01 pm

Re: Feather M0 I2C Slave

by lyzadanger on Mon Feb 13, 2017 11:23 am

After some more days of work, I am coming to the hunch that this is a chip-level problem and I don't know that's there's a workaround. Given that the M0 sees a fair amount of use in the context of Arduino Zeros (i.e. Zeros are powered by M0s), I did some more Googling and found a lot of similar forum posts, e.g. https://forum.arduino.cc/index.php?topic=350872.0, leading me to think that there's something about the M0's architecture that makes it just not work as an I2C slave.

This is a pity. As a "workaround", I've subbed in an Arduino Uno as my project's "gateway/server"—that works, technically, but the memory constraints are driving me a bit nuts. But at least it works as advertised as an I2C slave.

lyzadanger
 
Posts: 2
Joined: Thu Oct 24, 2013 11:01 pm

Re: Feather M0 I2C Slave

by dhalbert on Mon Feb 13, 2017 1:46 pm

Atmel provides some (non-Arduino) sample code for the D21 to be a slave:
http://www.atmel.com/Images/Atmel-42258 ... T07627.pdf
See page 160 ff. and an example on page 216 in the app note above.

EDIT: Also this, which may just be another version of the chapter in the note above:
http://www.atmel.com/Images/Atmel-42116 ... T03254.pdf

I have not tried this -- I just did some searching in the Atmel forums and found the reference above:
https://community.atmel.com/forum/set-m ... 2c%20slave
https://community.atmel.com/forum/sam-d ... 2c%20slave

You may have found some kind of issue in the SAMD Arduino library. If you want to pursue this, you could post an issue with a test case:
https://github.com/arduino/ArduinoCore-samd/issues

dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Re: Feather M0 I2C Slave

by siddiq on Wed May 09, 2018 3:54 pm

lyzadanger wrote:After some more days of work, I am coming to the hunch that this is a chip-level problem and I don't know that's there's a workaround. Given that the M0 sees a fair amount of use in the context of Arduino Zeros (i.e. Zeros are powered by M0s), I did some more Googling and found a lot of similar forum posts, e.g. https://forum.arduino.cc/index.php?topic=350872.0, leading me to think that there's something about the M0's architecture that makes it just not work as an I2C slave.

This is a pity. As a "workaround", I've subbed in an Arduino Uno as my project's "gateway/server"—that works, technically, but the memory constraints are driving me a bit nuts. But at least it works as advertised as an I2C slave.

Hi lyzadanger,

I am working on a project where in Feather M0 is used as a slave, and the issue is something similar. Honestly i am yet to debug the issue.
What has been explained is that only a byte is received back as the response from the slave.

Please let me know if the original problem has already been fixed, that will give me confidence in identifying my particular problem.

siddiq
 
Posts: 1
Joined: Wed May 09, 2018 3:49 pm

Please be positive and constructive with your questions and comments.