Replies: 4 comments
-
It's not implemented, you'd have to sort the queue every time you insert a message in it. With the right data structure (some sorted tree) that could still be efficient (even so, CAN is quite slow anyways). You can always just make it an option of the driver module, just like the buffer size is an option. For our use-case we use CAN as a backend for communication (similar to UAVCAN) and the 29-bit message isn't really structured well for use of priority, so we just do a FIFO. |
Beta Was this translation helpful? Give feedback.
-
According to this, STMs TX mailboxes is indeed prioritized, but can be reconfigured otherwise:
|
Beta Was this translation helpful? Give feedback.
-
You’re welcome to add this behavior, perhaps guarded by an lbuild option, since priority behavior may be implementation defined (AVRs and Hosted, Adapters, etc). We don‘t have a Priority Queue in modm, but the stdlib does: https://en.cppreference.com/w/cpp/container/priority_queue. That should suffice enough for now. |
Beta Was this translation helpful? Give feedback.
-
We plan to integrate UAVCAN support into modm, which seems to require this feature. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
While reading through CAN driver's docs (a very lack thereof) and it's source code, I was wondering.
Is there a way to prioritize messages by their ID's with
CAN::sendMessage()
?Should such prioritization happen?
Suppose, a device on CAN bus has two (or more) tasks. Each task send a heartbeat message with different ID (and therefore - priority) using
CAN::sendMessage()
. Suppose also this bus is a very busy one - with lots of other devices sending messages with higher (or equal) priority, than the highest priority of all taks on this device.Example: Two tasks, sending (1)
Msg(pr:0x10, len:8)
(2)Msg(pr:0x20, len:1)
:Task (2) occures more frequent, but has a lower priority.
Task (1) occures less frequent, but has a higher priority.
Is there a way to ensure that task (1) will always get it's message transmitted on time?
Beta Was this translation helpful? Give feedback.
All reactions