Skip to content
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

Fixing: Drone CAN Crashdump on boot #269

Merged
merged 2 commits into from
Dec 14, 2024

Conversation

loki077
Copy link
Contributor

@loki077 loki077 commented Dec 14, 2024

Cherry picking PR: ArduPilot/ardupilot#28859

Also, removing the CAN_LOGLEVEL from default which was set to 4 - LOG-ALL to now autopilot default which is None.
As this anyway doesn't give any helpful information for us to use/troubleshoot.

tridge and others added 2 commits December 14, 2024 13:34
the AP_CANManager::log_text() gets called from debug logging in
AP_DroneCAN. It is a method on a common AP_CANManager object which is
shared by multiple AP_DroneCAN threads.

if two threads call the debug log messages at the same time then we
can end up with _log_pos greater than LOG_BUFFER_SIZE (1024) and
overwrite past the end of the buffer

in the crash_dump we have for this case the next piece of memory was
hal.can[0], and the overwrite of the buffer had corrupted the
MessageRam_ structurre in the ChibiOS CAN interface code. That led to
a hardfault on receive of a CAN message

Note that this issue only happens if CAN_LOGLEVEL is set to greater
than zero, and the default is zero. So users can avoid the bug by
checking they have not changed CAN_LOGLEVEL.

Also, this is likely an issue that only happens on startup, as once
the two AP_DroneCAN threads are fully running they have the same
thread priority so can't pre-empt each other. During startup some
messages are sent from the main thread which has a different priority
to the AP_DroneCAN threads, and can thus trigger this issue
@robertlong13
Copy link
Collaborator

As this anyway doesn't give any helpful information for us to use/troubleshoot.

To expand on this, this parameter does not add anything extra to our logs. It adds a textfile to @sys which can be manually downloaded over MAVFTP and then reviewed. If we ever need to do some kind of debugging like that, we can just enable the parameter.

@loki077 loki077 merged commit 66e8e02 into CxPilot-7 Dec 14, 2024
47 checks passed
@loki077 loki077 deleted the feature/SW-495-cx-pilot-7-0-0-o-10-crashdump branch December 14, 2024 06:32
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.

3 participants