-
Notifications
You must be signed in to change notification settings - Fork 1.7k
NEXUSX: USE_DSHOT_DMAR, use TIM2 instead of TIM5 #11129
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
NEXUSX: USE_DSHOT_DMAR, use TIM2 instead of TIM5 #11129
Conversation
Apparently DSHOT_DMAR can only work with max 4 timers. With the previous timer setup this caused a limit of 7 motors. The new setup increases it 9. However, it costs some flexibility. The new default config sets up TIM1 as MOTOR by default, creating sane defaults for platforms with 1 or 4 motors.
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
|
Before I merge this, can you please comment just very briefly on whether you think the suggestions from the bot are useful? |
|
Suggestion 1 is physically impossible, TIM1 cannot be used on the RPM and TLM pins. See the second table in the readme https://github.com/iNavFlight/inav/blob/master/src/main/target/NEXUSX/README.md Suggestion 2 makes no sense as TIM1 will always be mapped. It is defined that way in |
Sometimes the bot reminds me of my boss. 😁 |
User description
Activate
USE_DSHOT_DMARfor target NEXUSX.Also move pins labelled "RPM" and "TLM" (PA2 and PA3) to timer2 instead of timer5.
This lifts the previous limitation of 7 motor outputs. Apparently, DSHOT_DMAR can only handle 4 timers for motors.
The move causes the pin labelled "TAIL" to be on the same timer as "RPM" and "TLM", removing a small amount of flexibility.
However, it is still possible to have 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 motors without wasting a pin to timer limitations if the user selects clever timer assignments in the mixer tab.
Furthermore, this PR sets TIM1 as MOTOR by default, which is mapped to the "ESC" pin.
This creates sane defaults for platforms with 1 and 4 motors without user intervention.
This PR is the result of investigation of changes proposed in #11120
I have tested:
PR Type
Enhancement
Description
Enable DSHOT_DMAR support for NEXUSX target
Reassign RPM and TLM pins from TIM5 to TIM2
Increases motor output limit from 7 to 9
Set TIM1 as default motor output for sane defaults
Diagram Walkthrough
File Walkthrough
target.h
Enable DSHOT_DMAR feature flagsrc/main/target/NEXUSX/target.h
USE_DSHOT_DMARdefine to enable DSHOT DMA supporttarget.c
Reassign RPM and TLM pins to TIM2src/main/target/NEXUSX/target.c
max
config.c
Configure TIM1 as default motor outputsrc/main/target/NEXUSX/config.c