Skip to content

fix bidir dshot for NXP i.MXRT boards#25854

Merged
dakejahl merged 1 commit intoPX4:mainfrom
321thijs123:main
Nov 3, 2025
Merged

fix bidir dshot for NXP i.MXRT boards#25854
dakejahl merged 1 commit intoPX4:mainfrom
321thijs123:main

Conversation

@321thijs123
Copy link
Contributor

@321thijs123 321thijs123 commented Nov 1, 2025

Solved Problem

When attempting to use bidirectional dshot on a NXP MR-VMU-RT1176 Flight Controller (FMUv6X-RT) I found that the esc_status messages would never get published. This seems to be due to bdshot_recv_mask being used to check the number of ready erpms, while this mask seem to always be set to zero before this is done.

Fixes #25853

Solution

  • Check bdshot_parsed_recv_mask instead of bdshot_recv_mask when counting the number of ready erpms.

Changelog Entry

For release notes:

Bugfix: esc_status never gets published for nxp xrt boards

@PetervdPerk-NXP
Copy link
Member

Looks to be a regression from #23863 just tested on my hardware and this fixes it.
@321thijs123 could you remove the merge commit and use rebase instead?

@dakejahl I've found another regression caused by #23863 as well.
This code you added waits for all motors, I suppose this is for your round-robin code.

// We wait until all are ready.
if (up_bdshot_num_erpm_ready() < _num_motors) {
return 0;
}

But this breaks Dshot based ESC esc_online_flags detection, i.e. motor unplugs esc_status doesn't get published anymore because up_bdshot_num_erpm_ready != _num_motors.

Could we rename up_bdshot_num_erpm_ready to up_bdshot_erpm_ready which is returns a boolean true/false and then you move your round-robin code to your underlying dshot driver. This keeps the esc_online_flags functionality intact.

@321thijs123
Copy link
Contributor Author

321thijs123 commented Nov 3, 2025

@PetervdPerk-NXP I removed the merge commit and used rebase now.

Copy link
Member

@PetervdPerk-NXP PetervdPerk-NXP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for your contribution @321thijs123

@PetervdPerk-NXP PetervdPerk-NXP changed the title fix bidir dshot for nxp xrt boards fix bidir dshot for NXP i.MXRT boards Nov 3, 2025
@dakejahl
Copy link
Contributor

dakejahl commented Nov 3, 2025

But this breaks Dshot based ESC esc_online_flags detection, i.e. motor unplugs esc_status doesn't get published anymore because up_bdshot_num_erpm_ready != _num_motors.
Could we rename up_bdshot_num_erpm_ready to up_bdshot_erpm_ready which is returns a boolean true/false and then you move your round-robin code to your underlying dshot driver. This keeps the esc_online_flags functionality intact.

These issues are fixed in #25848. It's quite a huge PR that I doubt anyone will review. I'm still trying to figure out if it's possible to break it into pieces.

Going to merge this in the meantime to fix the issues now. Thanks!

@dakejahl dakejahl merged commit c44e0be into PX4:main Nov 3, 2025
65 of 67 checks passed
JaapSkinner pushed a commit to UoA-DTRG/PX4-Autopilot that referenced this pull request Nov 26, 2025
Cherry-picked from upstream PX4/PX4-Autopilot PR PX4#25854
Commit: c44e0be
Fixes: PX4#25853

When attempting to use bidirectional dshot on NXP i.MXRT boards,
esc_status messages would never get published. This was due to
bdshot_recv_mask being used to check the number of ready erpms,
while this mask is always set to zero before the check.

Fixed by checking bdshot_parsed_recv_mask instead.
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.

[Bug] NXP FMUv6X-RT bidir dshot never publishing esc_status

3 participants