SOLVED - Motor not running Plane 4.1.0 BLHeli_S DSHOT300 MatekF405

Hi all,

I’m trying to setup Plane 4.1.0 on a MatekF405. I have a BLHeli_S ESC connected to S1, and BLHeli Passthrough is working. I have completed the setup, and assigned throttle to channel 1. However, I haven’t been able to get the motor to spin.

All of the buttons on the Motor Test page in Mission Planner are greyed out, and force arming followed by increasing throttle does nothing.

I feel like I’m missing something simple, but I haven’t been able to figure it out.

Any help appreciated!

Relevant parameters:
SERVO_BLH_3DMASK,0 SERVO_BLH_AUTO,0 SERVO_BLH_DEBUG,1 SERVO_BLH_MASK,1 SERVO_BLH_OTYPE,5 SERVO_BLH_POLES,12 SERVO_BLH_PORT,0 SERVO_BLH_RVMASK,0 SERVO_BLH_TEST,0 SERVO_BLH_TMOUT,0 SERVO_BLH_TRATE,10 SERVO_DSHOT_ESC,1 SERVO_DSHOT_RATE,0 SERVO1_FUNCTION,70 SERVO1_MAX,2000 SERVO1_MIN,1000 SERVO1_REVERSED,0 SERVO1_TRIM,1000

It’s definitely some sort of configuration problem, as I flashed iNav to the board without changing anything else and the motor works correctly with the same DSHOT configuration. Back to AP 4.1.0 now and still no luck.

Your setup looks correct. I have that board here so I can try.

What is SCHED_LOOP_RATE set to?

Thank you for the reply!

SCHED_LOOP_RATE is 50. (Default)

I have been trying to troubleshoot this for two days now and tried many configurations, but here is the most recent parameter list from after flashing back from iNav.
MATEKF405 Plane 100121.param (19.4 KB)

Can you try setting SCHED_LOOP_RATE to 400 and see if that helps?

And if that does not work then try setting SERVO_DSHOT_RATE to 5 together with the change above. If that works try reducing these parameters to the lowest values that work - the output rate is SCHED_LOOP_RATE x SERVO_DSHOT_RATE

One other thing to try is different dshot types - DSHOT600 is the one that gets the most testing

Finally success, thank you!

I tried adjusting SCHED_LOOP_RATE and SERVO_DSHOT_RATE first as you recommended, but high scheduler rates caused MissionPlanner to become less responsive and there was still no motor output. I progressively lowered the scheduling rate trying each sensible DSHOT rate without success. I also tried both DSHOT600 and DSHOT300.

Next, using your formula, I tried keeping the scheduler rate at 50 and increasing the DSHOT rate to 20 to get to 1kHz, but that didn’t work. So I tried bumping the scheduler up to 100 and lowered DSHOT to 10 which worked!

Any suggestions for further optimization? Is this just a limitation of the F405 processor?

My current settings are:
SCHED_LOOP_RATE = 100
SERVO_DSHOT_RATE = 10
SERVO_BLH_OTYPE = 5

The issue is in the ESC firmware but is triggered by the timing that we use, so its very flight controller and ESC dependent. You will probably find that a different ESC with that flight controller is fine. Also BLHeli_S, since it doesn’t have a proper UART, is also very timing sensitive, BLHeli32 is more stable.

1 Like

I don’t understand why the default of SERVO_DSHOT_RATE = 0 didn’t work, as that is supposed to fix the DSHOT rate at 1kHz.

How would I go about further optimizing the scheduler and DSHOT rates? Can I use the output of SCHED_DEBUG to see how close I am to the limit?

Regardless, thank you again for your help! I’m just glad I got this ESC/FC combo working.

Generally faster makes it more likely that the ESCs recognize the signal. I’m kind of surprised though that 0 didn’t work but 100 x 10 did - doesn’t make much sense to me. The only difference is that you get very regular output.

Ok, I had a look at the code. For SCHED_LOOP_RATE <= 100 the dshot rate is ignored and you get a fixed 1Khz output. So my guess is that at 100Hz you are actually getting just over and that’s why it is making a difference. To be sure though I think set it to something like 120 and then adjust SERVO_DSHOT_RATE accordingly

1 Like

What are the relative impacts on CPU usage of SCHED_LOOP_RATE and SERVO_DSHOT_RATE? I assume the scheduler rate has a much higher impact, but how would setting SERVO_DSHOT_RATE = 40 affect things? I’ll keep experimenting to see what works best for this FC/ESC combo, as I want to make sure the ESC communication is robust without needlessly wasting CPU cycles.

Is there an equivalent of the BetaFlight tasks command I can run in Mission Planner to quantify CPU usage by different processes?

Quadplane and Copter run much faster loop rates and are fine - both default to 400Hz. I would say its better to have a higher looprate and lower dshot rate.

To get CPU usage you need to rebuild from source with a particular option

When I tried 400Hz previously, MavLink became very slow (over USB) and took a much longer time to download parameters than at 50Hz. Do any other settings need to be changed to run at 400Hz?

Without a custom build fw:
Isn’t PM.Load in the log files a good indication of the CPU load?
PM.Load

It only tells you about the relative task load within the main thread. Dshot runs in a different thread.

1 Like

Hi @andyp1per,

Thanks for the explanation.

To close this out, I’ve settled on the following settings:
SCHED_LOOP_RATE = 100
SERVO_DSHOT_RATE = 20
SERVO_BLH_OTYPE = 5

This results in a DSHOT output rate of 2kHz, which seems to be playing well with my BLHeli_S ESC.

could you tell me how to set DSHOT600?