-
Notifications
You must be signed in to change notification settings - Fork 115
Deadlock in SERCOM::startTransmissionWIRE() #65
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
Comments
See platformio/platformio-pkg-framework-arduinosam#8 Is this issue fixed in the latest 1.2.9 core by Adafruit? We plan to update it soon. |
Bottom line up front: I'm going to work with the Arduino project for this. I attached a logic analyzer capture of the "offending" bus activity. At the end of the attached capture, the bus state in the SAMD21 SERCOM is "busy" and it never leaves that state. Looking at the signals, there is never a "stop" condition on the bus -- so the SERCOM is correct. The problem is that there is no way for a calling program to detect this condition -- and that is where I'll start with the Arduino folks. |
Please re-test with upstream version https://docs.platformio.org/en/latest/platforms/atmelsam.html#upstream |
I still have a problem with the upstream version. It showed up in a different location, but the end result is the same. DDD screen capture attached for reference. |
I didn't mean to close the issue! |
Does it work with Arduino IDE? |
If I get time, I will try it. My project is pretty tightly coupled with platformio/cmake/gitlab. I've honestly never used the Arduino IDE. In the meantime, I've got a fork and branch of ArduinoCore-samd at github that worked nicely overnight last night. |
Could you reproduce this issue with the latest release of dev/platform? |
In SERCOM.cpp the
startTransmissionWIRE()
function does some setup, transmits the slave address, and waits on completion. In the current GitHub version (cf28026aef2f65e2ddc5c631d2b01a144ff0a068), this is on line 529. There are circumstances in which the MB flag will never be set, in particular when the bus is in an "unknown" state. I've run across the case wherestartTransmissionWIRE()
deadlocks on the MB flag when addressing an SMBUS device on a SAMD21G18 MCU.A temporary fix for me was to add a check for
sercom->I2CM.INTFLAG.bit.ERROR
and return false if that is set while waiting on MB. I didn't want to mod the code and do a pull request since I don't have a good way of verifying that my changes work in all circumstances and on all supported variants.The text was updated successfully, but these errors were encountered: