Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Conversation

@jepler
Copy link

@jepler jepler commented Feb 10, 2021

When the CAN peripheral of the SAM E5x enters "bus off" state, an explicit recovery step is required. Before sending or attempting to receive a packet, check if the bus has entered BUS_OFF state and if so reinitialize the peripheral.

This PR seems to have additional things in it because I placed the change on the branch we're requesting to merge into sandeepmistry/arduino-CAN, and cherry-picked things from our main branch into this branch so that our pull request there is complete.

Testing performed: I didn't have two working retail version Feather M4 CAN boards so I can't test traffic between them. However, with debug statements enabled I see that it is entering and completing the "bus off recovery" steps, which are copied from our CircuitPython implementation where we are confident it is working; and I can see that the board is continually driving the CAN H/L lines rather than stopping when it enters BUS_OFF the first time.

This partially addresses #1. The other problems with undefined pin names would be better reported against the BSP, https://github.com/adafruit/ArduinoCore-samd -- though I didn't reproduce the problem, after I updated the BSP using Library Manager the named pins were available. I tried to make sure I'm not using a git version of ArduinoCore-samd but it's possible I made an error.

@ashishsk can you let us know if this helps with the bus recovery problem and open a fresh issue in https://github.com/adafruit/ArduinoCore-samd if you're still having trouble with the pin definitions?

ladyada and others added 6 commits February 10, 2021 09:18
.. but remove some that are not of use to me
When the bus enters BUS_OFF state, and we try to send or receive a
packet, ask the peripheral to perform a bus recovery.

.. remove the unused/unimplemented private reset() method while we're
tinkering in the header.

This should at least partially address #1.
@ladyada ladyada merged commit 5b52a14 into master Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants