-
Notifications
You must be signed in to change notification settings - Fork 1.4k
nuttx/can: in trunk support to Send message cancel mechanism. #17694
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
nuttx/can: in trunk support to Send message cancel mechanism. #17694
Conversation
2f1e894 to
180f5f9
Compare
|
@OceanfromXiaomi fix: |
63c1bf3 to
aef5984
Compare
Done |
aef5984 to
1c9a2d1
Compare
acassis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OceanfromXiaomi please update the Documentation: https://nuttx.apache.org/docs/latest/components/drivers/character/can.html to include this new functionality
1c9a2d1 to
45c74c9
Compare
Done, @acassis |
85327d4 to
a72f46f
Compare
Introduce a single configuration option to provide strict transmit priority ordering based on CAN ID. The intention is to expose the user-visible behavior (strict TX priority ordering) rather than the underlying implementation details. Strict priority ordering is only meaningful when hardware transmit buffer cancellation is available, so splitting this functionality into separate configuration options was misleading and could result in partially effective or incorrect configurations. Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
a72f46f to
7291cec
Compare
michallenc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
add the logic about "cancel mechanism" of sending can/canfd message based priority list.
Summary
This PR is intended to resolve the CAN message priority inversion issue that can occur during CAN frame transmission.
It fundamentally addresses the problem of CAN message priority inversion, thereby avoiding communication latency or errors caused by priority inversion.
The solution manages CAN message transmission by introducing a cancel mechanism combined with a linked list, along with predefined cancel conditions (can_txneed_cancel), to control and reorder CAN frame transmission as needed.
Impact
If users want to use this scheme, they only need to enable CONFIG_CAN_TXCANCEL.
This scheme does not affect the build process, security, or compatibility.
A new dev_cancel interface is introduced, which is used to cancel the transmission of CAN messages that are already queued in the CAN driver’s hardware transmit buffer.
Testing
This scheme has been applied in an automotive basic-software project and has undergone long-term testing and validation; it does not break existing code.
The scheme also ran stably on development boards based on the Cortex-M7 architecture.
Test procedure:
Observed behavior:
the high-priority message (ID 0x111) appears on the bus first, followed by the low-priority message (ID 0x222).