Enabling NeoPixels kills the PWM signal on all AUX outputs

I have a Pixhawk 2.4.8 FC on a hexacopter running AP ver 4.0.0. I have BRD_PWM_COUNT set to 4, so that AUX 1 to 4 are PWM outputs.

Connected to the AUX 2 output is an Arduino Pro Mini programmed to read the PWM signal and change the flashing sequence of some LEDs used for navigation visibility. The change of flashing sequence is controlled from the ground Tx by the Trainer switch through channel 7. This all works fine … :slightly_smiling_face:

Connected to the AUX 3 output are 7 NeoPixels to display the colour sequence of the internal LED.

But, when I set NTF_LED_TYPES to 455 and SERVO_FUNCTION11 to 120 to enable the NeoPixels on AUX 3, the NeoPixels work fine, but the navigation LEDs connected to AUX 2 don’t work. In fact, checking the signal on AUX 2 with a CRO reveals that there is no longer a PWM pulse at all … :slightly_frowning_face:

So it would appear that enabling the NeoPixels disables the PWM output signal, somehow?

The original Wiki instructions said that:


But, I discovered by trial and error that the NeoPixels would ONLY work if they were connected to a PWM output and not a GPIO output, contrary to the above note.

Now, either I am doing some thing wrong, or there is a bug in the NeoPixel code that means that it won’t work on a GPIO output, but will work on a PWM output, but it disables the PWM output to the other AUX outputs.

To me it seems logical that the NeoPixels should only work on a GPIO output since they expect a very different data signal than what PWM is.

This is due to the pwm grouping. Its not documented very well sorry.

All pins in each group must be doing the same type of PWM, so NeoPixel and normal PWM cannot be in the same group. You could use 5 and 6 for NeoPixels as they are in a different group. However this would require setting BRD_PWM_COUNT back to 6.

NeoPixels don’t work on GPIO because the need an internal timer to do the serial output. Its basically a interrupt driven protocol.

1 Like

@iampete, I am not sure what you mean by “groups”?

Are you saying that AUX 1 to 4 are in a “group” and 5 & 6 are in a separate “group”? Or, are there 3 groups of 2 outputs?

So, if I set BRD_PWM_COUNT to 6 and put the NeoPixels on AUX 5, then AUX 1 to 4 will be PWM and AUX 5 & 6 will both not output PWM? Can AUX 6 be used for anyting else but NeoPixels?

UPDATE: It’s OK, I have just read the GitHub link you included and I have answered my own queries … :face_with_hand_over_mouth: I guessed that it was something I was doing wrong, but couldn’t figure out what it was …

I wanted to add some additional clarity from my hacking on a KakuteF7.

Luckily the KakuteF7 has a readme that details the PWM groups. Once I saw this, RCOut values like this

RCOut: DS1200:1-3 NeoP:4-5 PWM:6

made a lot more sense. After reading, and since I’m using DShot, the first and second PWM groups must be DShot. Therefore, you’re only left with SERVO6 as an available output for NeoP. Well, the KakuteF7 hwdef has some options that’ll allow you to make the LED pad PWM(7). This PWM is a member of a 4th PWM group (TIM4_CHx). By default, the hwdef is setup to have a PWM output for the BZ pad; that’s in TIM4 too!

Going back to the rule that each member of a group shares the same output type, I commented out the define for the BZ pad, and uncommented the define that makes the BZ pad PWM(8). Well, now that I have two PWMs in the same group, I set SERVO7 to “120”, and sure enough, this became my RCOut:

RCOut: DS1200:1-5 PWM:6 NeoP:7-8

This change resulted in the LED pad successfully driving WS2812 NeoPixels. I have yet to address the issue of an actual buzzer on the BZ pad. Next steps.

HI Peter
Hope that you well.
Im trying to get a Ws2812 Neopixel to work as an external LED on the HOLYBRO Mini Pixhawk

Settings as follow:
ntf_led_type set to neopixel
servo6 set to 120
Ive tried brd_count set to 4, 0, and 8

Do I need to set the relay
I have 5V powering the rails on the break out board pins.

Cant get it to work, so any advice would help.

This is the link to the neopixel I’m trying to use. Maybe the LED is the wrong type?

https://www.robotics.org.za/HW-2812-4?search=WS2812

Thanks

Gary

The key thing to look out for is the new RC out message in the mission planner messages tab.

You should see something like:

RCOut: PWM:1-4 NeoP:5-6

You have to abide by the PWM groupings, so both 5 and 6 will be Neopixels. BRD_PWM_COUNT should be larger than 6.

If that is working it could just be a signal level issue. There is a fix for that outlined on the wiki.

https://ardupilot.org/copter/docs/common-serial-led-neopixel.html

1 Like