Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Nano 33 IoT I2C Problem
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Nano 33 IoT I2C Problem

by Badbunny on Sun Aug 09, 2020 9:38 pm

I am still having difficulty in trying to get the Nano 33 IoT to communicate using the I2C with another Nano 33 IoT. The specific problem I am experiencing is that data just stops receiving at the master. When this occurs a reset of the Nano is needed. Reseting either the slave or master will resume activity (I would think reseting the master is what would be needed but reseting the slave seems to do the same thing). During data transfer some of the data is corrupted, displaying a space or reverse "?" or even an "!" at times.

I have reloaded the IDE along with the SAMD Core for the Nano 33 IoT. Thinking hardware could be a problem, I used an MPU6050 to see if I could communicate with it over I2C and was successfull for each of the Nano 33 IoT's. They each were able to keep a connection and return raw data using the Wire library for over 45 minutes each.

I am powering from a laptop computer via USB. I measured voltage on the 3.3V pin and have 3.289 volts I don't think I have a problem here. I am allowing the on board 4700 Ohm resistors to serve as pull-up resistors. I suppose I could remove one of the resistors by desoldering but I am not sure that will help and it also may have other effects for I2C communications I do not know about which may be occurring on the Nano 33 IoT board.

I also performed an additional test where I used two Nano's (older model) to communicate using the I2C using the same setup. The only difference being the hardware and software. They worked well and were very stable even after reducing the delay() time in the example and also increasing the clock to 400000 (setClock(400000)). I had never done this setup beforef and I wanted to see how things would perform.

My code I am using for the slave_sender and master_reader is from the example included with the Wire library.

I adjusted the code at the master and noticed that the data stops when the "wire.available()" is no longer available. Even when the code executes the next statement in the loop, "Wire.requestFrom(2, 6)", no further data is available. The result is the connection just stops. To correct this problem I inserted "Wire.begin()" after the wire is no longer available. By doing this I have been able to keep the connection sending the "hello ". It is as if I pressed the reset buton and it started again. I guess you could call this a workaround for the problem I am having but I don't like it.

I am wondering if it is something in the library - I am not that familiar with the library and find it difficult to follow. Could it be a timing problem? I have played around with the "delay()" statements on both the slave and master and it did not help.

I have included my code for master and slave and output results I am getting.

Maybe someone could try to reproduce or offer an explanation for why it is behaving the way it does. I am not sure what to try next.

slave_sender1.ino
(757 Bytes) Not downloaded yet


master_reader1.ino
(975 Bytes) Not downloaded yet


Master_Output.JPG
Master_Output.JPG (53.23 KiB) Viewed 59 times

Badbunny
 
Posts: 6
Joined: Sun Aug 09, 2020 9:16 pm

Re: Nano 33 IoT I2C Problem

by adafruit_support_bill on Mon Aug 10, 2020 5:45 am

Please post some photos showing your soldering and connections.

adafruit_support_bill
 
Posts: 78748
Joined: Sat Feb 07, 2009 10:11 am

Re: Nano 33 IoT I2C Problem

by Badbunny on Mon Aug 10, 2020 1:37 pm

Image00001.jpg
Master
Image00001.jpg (586.72 KiB) Viewed 53 times



Red and Blue wires are for the I2C connection. Green is common ground. Additional Red, Blue and Green are for scope.
Attachments
Image00003.jpg
Setup along side each other
Image00003.jpg (678.97 KiB) Viewed 53 times
Image00002.jpg
Slave
Image00002.jpg (698.28 KiB) Viewed 53 times

Badbunny
 
Posts: 6
Joined: Sun Aug 09, 2020 9:16 pm

Re: Nano 33 IoT I2C Problem

by adafruit_support_bill on Mon Aug 10, 2020 1:57 pm

Where does the second set of i2c bus wires go? How long is the bus in total (sum of all legs of the bus)?

The wire library is known to hang if there are marginal connections or other bus issues.

2 sets of 4.7K pullups is a little on the 'strong' side. You could try disabling one set.

adafruit_support_bill
 
Posts: 78748
Joined: Sat Feb 07, 2009 10:11 am

Re: Nano 33 IoT I2C Problem

by Badbunny on Tue Aug 11, 2020 10:36 am

Thanks for the quick response.

The second set of I2C wires go to the scope. The bus length is under 8 inches. I have operated with and without the scope connection and it seems to have made no difference. It is not possible to disable the pullup resistors on the Nano 33 IoT board. They are hard soldered on the board (https://content.arduino.cc/assets/NANO33IoTV2.0_sch.pdf). I have thought of desoldering the pullup resistors from one of the boards but before I went and did that I wanted to see what others thought and also if anyone has been able to get the two Nano 33 IoT's to communicate just like the two older Nano's. I also considered moving the I2C port pins to a differnt SERCOM but it looks like none are available without including a 4700 Ohm pullup.

I have attached scope display. The first is viewed under normal activity when I am getting good data. The second is during failure when wire.available() is lost. I seem to be getting 1000ns or less rise time and voltage is reaching the 3 volt peak needed to signal a logic 1. It just seems to suddenly dropout. I also notice no consistent time for when this dropout occurs. It may occur within 3 seconds after reset/start or 10 seconds, or 30 seconds. Nothing consistent that would indicate a buffer overflow someplace.

Normal Activity.jpg
Normal
Normal Activity.jpg (143.95 KiB) Viewed 42 times


Wire Not Available on Scope.jpg
Wire.available() NOT AVAILABLE
Wire Not Available on Scope.jpg (155.56 KiB) Viewed 42 times

Badbunny
 
Posts: 6
Joined: Sun Aug 09, 2020 9:16 pm

Re: Nano 33 IoT I2C Problem

by adafruit_support_bill on Tue Aug 11, 2020 11:07 am

The waveforms don't look bad. Not sure what the issue might be. We don't carry the Nanos and don't have any experience with them. Those are Arduino products so your best source for advice would be the Arduino forums.

adafruit_support_bill
 
Posts: 78748
Joined: Sat Feb 07, 2009 10:11 am

Re: Nano 33 IoT I2C Problem

by Badbunny on Tue Aug 11, 2020 12:07 pm

Thanks. I have been asking on the Arduino forum but have not got any solutions or advice. Appreciate your attention.

It has been a good processor/board and this is the first real challenge I have met. I like having the WiFi on board (which I have used and works well) and the ARM architechure has several additional features most immediatly noticable is the increased RAM, low power, faster processor, and flexible/additional serial communications. Since SAMD is different from AVR, users need to check and make sure libraries are available before jumping in to the SAMD.

I'm still hoping for a solution which someone can offer.

Badbunny
 
Posts: 6
Joined: Sun Aug 09, 2020 9:16 pm

Re: Nano 33 IoT I2C Problem

by Badbunny on Wed Aug 12, 2020 5:16 pm

I Found A Solution!!!!

I disconnected the scope (I thought I had done before). After disconnecting the scope I did not get any interference or lock-ups. I am not clear why this worked - maybe capacitance of the scope leads effected things?

I was able to connect two nano 33 IoT to communicate with each other and I extended the SDA/SCL data lines to 30 inches (although the ground line remains at 8 inches). I also operated with Wire.setClock(400000). I used minimal delay(10) times. I obtained a rather quick connection that was error free and did not lock up.

I am going to attach a MPU6050 and see if I can get it to work also.

Attached is the slave and master code I am using in this little stress test.

Thanks Much!!!
Attachments
two_way_slave.txt
(1.41 KiB) Downloaded 1 time
two_way_master.txt
(676 Bytes) Not downloaded yet

Badbunny
 
Posts: 6
Joined: Sun Aug 09, 2020 9:16 pm

Re: Nano 33 IoT I2C Problem

by adafruit_support_bill on Wed Aug 12, 2020 6:24 pm

Good to hear that it is working. I'm surprised that the scope probe load would have that effect. Especially since the waveforms look reasonably good.

adafruit_support_bill
 
Posts: 78748
Joined: Sat Feb 07, 2009 10:11 am

Re: Nano 33 IoT I2C Problem

by Badbunny on Wed Aug 12, 2020 8:40 pm

Me too! I just noticed it would work with the scope for awhile but eventually things stopped.

Badbunny
 
Posts: 6
Joined: Sun Aug 09, 2020 9:16 pm

Please be positive and constructive with your questions and comments.