Skip to content

Conversation

@berman00
Copy link

Currently, libcanard only calls the should_accept function on the first frame of a multiframe transfer. This means that the following frames will cause a CANARD_ERROR_RX_MISSED_START. I would be better if it returned a CANARD_ERROR_RX_NOT_WANTED instead, which is a better description of the problem.

The reason I came across this was that I connected a microcontroller with libcanard to a Flight controller running Ardupilot. I don't care about the ardupilot messages, so my should_accept function ignores them. However, I do care about possible errors on the CAN bus to monitor the health of the system, so I keep track of CANARD_ERROR_RX_MISSED_START as well as other CAN bus related errors. The way it is currently implemented, it is impossible to distinguish between a missed started because of an unwanted multiframe message or a missed start caused by an actual problem with the system. With this change all unwanted frames are ignored.

Here is the output of the serial monitor that I was using to debug.

Before the change:

before fix

I was logging all received messages through libcanard, as well as CANARD_ERROR_RX_NOT_WANTED and CANARD_ERROR_RX_MISSED_START. The microcontroller is connected to an ardupilot flight controller that is sendig a bunch of ardupilot messages, which I don't care about. As you can see, both errors are present.

After the change

after fix

Now only the CANARD_ERROR_RX_NOT_WANTED is the only error present, which in my application I can safely ignore.

@tridge tridge force-pushed the feature/ignore_all branch from 4379e8f to 81c212f Compare July 11, 2025 23:39
@tridge tridge force-pushed the feature/ignore_all branch from 81c212f to 588e4fd Compare July 11, 2025 23:52
@tridge
Copy link
Member

tridge commented Jul 11, 2025

@berman00 I've force-pushed the change to do it the more efficient way

@tridge tridge merged commit 8515ef3 into dronecan:master Jul 12, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants