-
Notifications
You must be signed in to change notification settings - Fork 13.9k
vtol: reduce schedule frequency, which causes DSHOT150 problems #24727
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
Conversation
14c65e1
to
b2795bc
Compare
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 40 byte (0 %)]
px4_fmu-v6x [Total VM Diff: 40 byte (0 %)]
Updated: 2025-04-17T15:54:47 |
Nice work, @alexcekay, I think my issue #24230 might be a bit related to this but then it affects the fixed wing (fw). |
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.
This looks reasonable, and thanks for the in-depth investigation!
- I see no case where we send only thrust and not torque, so having the callback on torque only is ok
- In transition mode the virtual_mc_torque is always published, so no need to have the additional callback on the virtual_fw_torque
Did you by chance make a CPU load comparison w/ and w/o this fix?
Sure, did a first CPU load test with the following setup
So the peak CPU usage is reduced by ~2%. A second CPU load test with the following setup
In the longer run the average CPU usage is also reduced by ~2%. |
We will do some additional flight testing. Afterwards we can merge this. |
I agree with fixing the VTOL scheduling in the first place, but shouldn't we also have some protection in the dshot driver? |
b2795bc
to
53376a2
Compare
Hi @dagar, |
FYI IMXRT doesn't do DMA for dshot and bdshot, it's just "smart" shifter that implements the protocol. |
53376a2
to
51c38d6
Compare
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.
Schedules the task loop at the beginning once, then initializes the callback at the beginning once and then updates whenever the VTOL mode changes. Registration is only on torque setpoint (thrust is published together with it, is it published before torque?) and only on the fixed-wing one while not hovering or transitioning. Should do what was intended.
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.
With the risk you'll hate me I added my nit-pick refactors. Take them or not I'm fine either way.
Hi @MaEtUgR,
Otherwise the enum is most likely zero-initialized as it is in the class scope (and thus not containing a valid
Yes exactly it is published before torque. |
3121c2e
to
0a6e380
Compare
Ideally we'd protect the timer DMA directly and not clobber anything existing already in route, but even if we just caught the schedule early in the Run() and pushed it back a few millseconds it would probably be good enough. |
@alexcekay I can help with the dshot driver. Feel free to ping me on Discord and we can discuss it |
Solved Problem
Specific ADP ESCs lost communication when switching from MC -> FW in case of using DSHOT150. When switching back from FW -> MC the motors would still not spin.
The communication loss is due to incorrect DSHOT messages on the wire. As can be seen multiple DSHOT frames got packed into one large stream:

The cause of this is that a DSHOT transmission is started while an old one was still in progress. This occured only on DSHOT150 as the other ones are quick enough for this to not happen. The reason for this is a extremly fast scheduling of the DSHOT driver:

All this could be traced back to
vtol_att_control
being called too often due to it having configured 4 topic callbacks which are triggered byMulticopterRateControl
andFixedwingRateControl
which are triggered by an update ofvehicle_angular_velocity
. So one update ofvehicle_angular_velocity
causes a burst of 4 schedules ofvtol_att_control
.Solution
Depending on the VTOL mode only the relevant callbacks are registered. In addition only the
torque
topics are subscribed as they are published after thethrust
topics.Changelog Entry
For release notes:
Test coverage