Problem in Copter 4.3 with the subsytem led preventing the drone from startup

Hello everyone .
I want to report an issue we are experiencing with the use of Copter-4.3.
In order not to repeat myself during this post , I am giving you the link of the issue I created ( this has been added to the official issue list of Copter-4.3 by @rmackay9 :

To update it to date, the problem is also present in the official Copter-4.3.1.

The Issue:######################

The problem occurs on a luminousbee5 drone , which has vanilla Ardupilot Copter-4.3 firmware on it , but not with vanilla Ardupilot Copter-4.2.3 firmware.

When using the led subsystem via a lua script(lua_led_testing.zip),(or with other systems) , to turn on a number of leds, equal to or greater, than 44 , the entire drone stops working , thus preventing connection to it via USB or UDP with Mission Planner .

As you can see from the screen below , the whole system seems to freeze or go into error , after printing the debug message from the lua script : LEDs started , and after turning on the LEDs.
image
I want to specify that the lua script used for this test has already been tested and is working with Copter 4.2.3.

The possible problem and the partial solution found : ######################

By researching various parameters in Ardupilot we realized , that by varying a particular parameter the problem is triggered .

The parameter is SCHED_LOOP_RATE , if this parameter is set to 800 , the problem I described above occurs . HOWEVER , if you set this parameter to 400 , the problem disappears and the drone starts up normally.And we can connect to the drone without any problem , from Mission Planner via usb.

Also with the SCHED_LOOP_RATE parameter set to 400 , every combination with the SERVO_DSHOT_RATE parameter do not create the problem described.
By setting the parameter SCHED_LOOP_RATE to 800 , every combination with the parameter SERVO_DSHOT_RATE create the described problem.

With Copter-4.2.3, on the other hand, there was never any problem even keeping the parameter to SCHED_LOOP_RATE set to 800.

The tests done with the various frequencies:######################

We then did various tests of combinations between the parameter SCHED_LOOP_RATE and SERVO_DSHOT_RATE and these are the results :

LOOP_RATE |DSHOT_RATE |RESULT
400------------- 400--------------- WORKING BUT ONLY 41 LED TURN ON
400------------- 800--------------- WORKING BUT ONLY 41 LED TURN ON
400------------- 1600------------- WORKING BUT ONLY 20 LED TURN ON
400------------- 1000------------- WORKING BUT ONLY 32 LED TURN ON
800------------- 800--------------- DONā€™T WORK(CRASH)
800------------- 1000------------- DONā€™T WORK(CRASH)
400------------- 1600------------- DONā€™T WORK(CRASH)

#########################################################################

So I ask the main developers of ardupilot to investigate about this problem to arrive at a solution .
Thanks to all :slight_smile:

Since in 4.2.3 it does not happen with loop rate at 800 and in 4.3 at 400 it works but no longer with loop rate 800 it makes me suspicious of the ā€œlong loopsā€ and increased computation occupancy that is emerging in 4.3. @rmackay9 just posted this alpha version, it would be very interesting to try it out Internal errors 0x100000 I:921 flow_of_ctr Twitching motion in loiter during forward flight - #83 by Axel1

I have sent our hwdefs to @rmackay9 privately on discord . We are waiting for his reply

@Davide_Lentini @Giorgio_Rinolfi,

Iā€™ve added Luminousbee5-custom binaries over on the other topic.

I get the impression from AndyPiper that this is all unrelated but letā€™s see.

Txs for helping testing.

1 Like

Iā€™ve already indicated that this is a limitation due to the width of the gap between dshot pulses. You are unfortunately not going to be able to have more than 44 LEDs without major rework. There was a bug in 4.2 in this area which meant instead we could not send dshot pulses (very bad) which has been fixed in 4.3.

yes there are two issues that are happening here. The first one is that with 4.2.3 we have 41 LEDs working even using main loop rate at 800 while with the new 4.3 it is NOT working anymore as described in this topic. That is why it might be interesting to try the new 4.3 linked above by Randy.
The second issue is deeper and concerns the current limit of Ardupilot to drive more than 41-44 led with main loop 800 as you described in depth.

From andyp1per reply in GitHub issue :

At 400Hz the maximum slot you will be allowed is 2.5ms at 800Hz maximum allowed is 1.25ms. Default dshot rate is 1Khz so maximum allowed is 1ms. Dshot is constrained to be minimum 800Hz, so you only ever get 1.25ms maximum - but you never get that because dshot pulses get prioritized over LEDs - so the most you can ever hope for is 1.25ms - dshot pulse time.

And :

The solution here is to have a thread-per-timer - then the LEDs can run for as long as you want without disrupting dshot