Commit 5b65c50
committed
Fix hang while waiting for CAN heartbeat on multi-ODrive systems
When using the Teensy's built-in CAN peripheral, pumpEvents will
effectively only process the 16 messages in the Teensy's CAN mailbox.
This is in contrast to the MCP2515, which uses an interrupt, and the
Arduino R4 CAN peripheral, which is dequeued to up to 100 messages.
Previously, we delayed for 100ms after (unsuccessfully) processing
incoming messages for a heartbeat message. As a result, when using
systems with more than one ODrive, and/or an extremely high number
of messages per second, the Teensy's mailbox will fill before the
heartbeat is recieved, and thus discard future messages.
This issue is exacerbated by the default 100ms period of the ODrive's
heartbeat message -- in short, the ODrive would always send a heartbeat
message at the same time relative to the Teensy reading the mailbox, so
unless the timing was such that the heartbeat was in the first 16
messages during the delay, it would be missed. For most users, minute
differences in the ODrive and Teensy's clock accuracy would cause a
timing skew that would eventually bring correct this, however this could
take up to 30 minutes, if not indefinitely long.1 parent 5e8ecf7 commit 5b65c50
File tree
3 files changed
+4
-2
lines changed- examples/SineWaveCAN
3 files changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
1 | 4 | | |
2 | 5 | | |
3 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | 227 | | |
229 | 228 | | |
230 | 229 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
0 commit comments