-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Disarm PWM ESCs before reboot #24290
base: main
Are you sure you want to change the base?
Conversation
6ee2765
to
208f710
Compare
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 8 byte (0 %)]
px4_fmu-v6x [Total VM Diff: 16 byte (0 %)]
Updated: 2025-02-05T16:04:21 |
017151e
to
83bce44
Compare
EDIT: I kind of like option 3 to first send disarm, but we'd probably still want the low level board reset timing as well. |
boards/px4/fmu-v5x/src/init.cpp
Outdated
if (status >= 0) { | ||
up_mdelay(6); | ||
up_mdelay(400); |
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.
Why 400 milliseconds? Wouldn't even 20 milliseconds be sufficient for almost all real usage?
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.
I have the threshold from: boards/px4/fmu-v3/src/init.c
, where there is an up_mdelay(400);
After some experiments with a APD F3X I set the threshold to 100ms as this avoided it from spinning. Lower values caused it to still spin.
Hi @dagar,
I actually solved it first via the shutdown hook. The problem with that solution is, that it does not solve the issue for any kind of unexpected resets. For example when the board gets resetted via a hard fault, the motor would still spin up.
Rolled it out to all boards that did not already have a higher threshold defined.
I did have a look at the px4io. The reset behavior is different in the sense, that the ESC can't pull up the PWM Pins of the IO to 3.3V during reset due to electrical characteristics of the STM32F1, which results in a voltage of ~1.1V on the PWM signal during reset. So I don't see a direct problem, can however add a similar logic in another PR. |
83bce44
to
db86e7b
Compare
Solved Problem
Rebooting can be dangerous when using PWM, as depending on how fast the system reboots a valid PWM pulse can be created. This can happen due to the following reason:
Solution
Changelog Entry
For release notes:
Test coverage