Motors spinup momentarily on arming

Hi everyone,

Iā€™m making an experimental aircraft using the stock PX4 multicopter code. However, the ESCs Iā€™m using are reversible, i.e. PWM 1500Āµs is stopped, 2000Āµs is full up and 1000Āµs is full reverse. In order to make this work, Iā€™ve made a custom airframe and mixer; Iā€™ve pasted the first motor output mixer below. PWM_DISARMED is set to 1500, and my throttle stick is sprung to centre. Iā€™m not using any auto functions - only stabilise mode.

Now, my problem is, that about 60% of the time, when I arm, the motor output shoots to 1000Āµs for half a second or so, then back to 1500Āµs, where my stick is. This causes the motors to spin in full reverse momentarily upon arming. Very scary!

The logs didnā€™t show anything on OUT0_Out0, but I did discover that if I activate the kill switch, then arm, the motor waits until I deactivate the kill switch, then they spin up momentarily. and allows it to be captured by the logs.

Does anybody have any idea whatā€™s going on? Any help would be much appreciated!

Thank you,
Patrick

M: 2
O: 10000 10000 0 -10000 10000
S: 3 0 10000 10000 0 -10000 10000
S: 0 3 -20000 -20000 10000 -10000 10000

Iā€™m curious what ESC you are using? Iā€™ve been looking for a reversible ESC for a while and they are surprisingly few of them (other than the car ones with the extra wire). Sorry Iā€™m not much help on the PWM glitchesā€¦

3D ESCs are surprisingly few, until we realised somethingā€¦ read onā€¦

We started out using HobbyWing Xrotor Pro 4A 3D ESCs. The worked pretty well, however they have an annoying ā€œsoft startā€ if you leave the throttle at neutral for a few seconds, so now we use Cobra S-class 80A HV ESCs with BLHeli installed.

Any ESC that supports BLHeli can be programmed to be reversible, even if it doesnā€™t say it in the description. Make sure you get the appropriate USB programmer, then load up BLHeli Suite, and set the direction to bi-directional. Boom, you have a reversible ESC :slight_smile:

Hi @pleschinski

What you see is most likely the PWM ramp up logic, which is here: https://github.com/PX4/Firmware/blob/master/src/modules/systemlib/pwm_limit/pwm_limit.c#L136.
The code has not beed designed for your use-case, but Iā€™m generally interested in adding support to PX4 for reversible ESCs.

You can test skipping the ramp up by setting PWM_LIMIT_STATE_ON in https://github.com/PX4/Firmware/blob/master/src/modules/systemlib/pwm_limit/pwm_limit.c#L82.

Thank you so much @bkueng, that seems to have fixed it!

Good! Do you want to open an upstream issue (https://github.com/PX4/Firmware/issues), so we can discuss a general solution?
Do you require other changes?

Iā€™m not sure but it can be related to a bug Iā€™ve found Throttle spike on arming (is it a bug?) . In my case autopilot sent bigger PWM to ESCs a second after arming and then returned values to expected ones.

Iā€™ve opened an issue. The aircraft is working beautifully, I donā€™t believe any other changes are required.
Thanks again!

Cool - do you have a video? :slight_smile:

I have heaps of videos :slight_smile: None that Iā€™m allowed to show, unfortunately. Intellectual property. Sorry!

Just a suggestion of maybe point you to how itā€™s handled in a different applicationā€¦ Checkout Vertical Technologiesā€™ DeltaQuad airframe setup. Reverse thrust is setup in a different PWM port.

Good luck.

Thatā€™s really interestingā€¦ how do they reverse the motor using a different port?

I donā€™t know but Iā€™m sure itā€™s in the code. You may want to try to get with @sanderux whoā€™s the maintainer of that airframe.

Good luck.