Skip to content

I2C - random crash - Nano #6047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kb- opened this issue Mar 7, 2017 · 4 comments
Closed

I2C - random crash - Nano #6047

kb- opened this issue Mar 7, 2017 · 4 comments
Labels
Architecture: SAMD Applies only to the SAMD microcontrollers (Zero, etc.) Library: Wire The Wire Arduino library Type: Duplicate Another item already exists for this topic

Comments

@kb-
Copy link

kb- commented Mar 7, 2017

I'm running I2C transfer tests on a multi master setup (2 Nano masters and one slave). test code

The tests consist in transferring data both ways between the masters and the slave at an average 10 ms interval. I added collision handling to my code and checked the bus signal with a logic analyzer to be sure it's not overcrowded.
Data is transmitted fine with with a few (1 per 100k) retries when collisions occur, but one of the masters ends up crashing after a random amount of transfers (70 000 on average). I added timeouts to every loop in my code and in Wire.cpp to avoid endless loops but the crashes still occur, I'm thinking of a bug hidden deeper in the Arduino code.

I don't think the problem is material related because setting a different Arduino as slave leads to a different master ending up crashing.

I don't notice crashes with transfers between one master and one slave (an overnight test with 3 million successful transfers, same code with 6 ms interval)

@wmarkow
Copy link

wmarkow commented Apr 9, 2018

You can use ArduinoCrashMonitor library to find the source code line which makes your Arduino to crash (hang). It helped me a lot when investigating I2C endless loops in my project.

@matthijskooijman
Copy link
Collaborator

A similar project I wrote a while ago is https://github.com/3devo/AvrMemoryAnalyzer, which additionally allows generating an (approximate) stack trace using an offline analyzer written in Python, but doesn't have as polished Arduino code as the ArduinoCrashMonitor. Incidentally I also wrote that code to debug some I2c-related lockups :-)

@kb-
Copy link
Author

kb- commented Apr 9, 2018

Tricky I2C!
Thank you. These won't work for me unfortunately since the microchips of my boards are ARM based (SAMD21). I'll try them if I need to do some debugging on my Arduino 2560 tho.
I was looking into using the watchdog timer as well, but then decided to use OpenOCD with a Raspberry PI as a debugger.

I'm still having issues with this project. I started posting here since it's related to the SAMD library arduino/ArduinoCore-samd#222 (comment)

@per1234
Copy link
Collaborator

per1234 commented Apr 10, 2018

Closing as duplicate of arduino/ArduinoCore-samd#222. Please only create one issue per topic.

In the Arduino world when you say "Nano" we're going to assume you're talking about an Arduino Nano board, which is ATmega328P-based so in the future please refrain from the use of that term when referring to a board other than the Arduino Nano.

@per1234 per1234 closed this as completed Apr 10, 2018
@per1234 per1234 added Library: Wire The Wire Arduino library Type: Duplicate Another item already exists for this topic Architecture: SAMD Applies only to the SAMD microcontrollers (Zero, etc.) labels Apr 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture: SAMD Applies only to the SAMD microcontrollers (Zero, etc.) Library: Wire The Wire Arduino library Type: Duplicate Another item already exists for this topic
Projects
None yet
Development

No branches or pull requests

4 participants