Hi all,
I have built a autopilot/flight controller for RC vehicles using the Teensy 3.6, which is currently flying a small quadcopter. It has some WS2812 leds connected to pin 2 of the Teensy which I currently drive with FastLED, but since there's so much stuff going on in flight this causes a lot of flickering from interrupts disrupting the timing. I am looking for some way to drive the LED's without that limitation, specifically on pin 2 which doesn't have serial or SPI peripherals on it.
To that end I've been looking at the OctoWS2811 code, and like the approach! The problem is that it's doing 8-bit DMA transfers directly to the GPIO control registers, affecting all 8 port D pins. Setting the rest of the pins as inputs would prevent anything from happening, but my board requires some of them to be outputs. I thought about reading the current state of the GPIOD_PDOR register and modifying the buffer contents to result in the right state for the "unwanted" pins, but even if there'd be a good way to do it (interrupt before DMA transfer instead of after?), it would require CPU time taking away most of the benefit in addition to just feeling silly.
I'm not very familiar yet with the inner workings of the chip and it's capabilities so I'd appreciate opinions on whether it's even possible to have non-blocking WS2811 waveform on pin 2 of the teensy 3.6 without affecting other pins I know the Betaflight flight control software somehow drives these leds using DMA without blocking 8 ports with somewhat similar STM chips, but I haven't been able to decrypt that code yet..
Thanks,
Jopj
I have built a autopilot/flight controller for RC vehicles using the Teensy 3.6, which is currently flying a small quadcopter. It has some WS2812 leds connected to pin 2 of the Teensy which I currently drive with FastLED, but since there's so much stuff going on in flight this causes a lot of flickering from interrupts disrupting the timing. I am looking for some way to drive the LED's without that limitation, specifically on pin 2 which doesn't have serial or SPI peripherals on it.
To that end I've been looking at the OctoWS2811 code, and like the approach! The problem is that it's doing 8-bit DMA transfers directly to the GPIO control registers, affecting all 8 port D pins. Setting the rest of the pins as inputs would prevent anything from happening, but my board requires some of them to be outputs. I thought about reading the current state of the GPIOD_PDOR register and modifying the buffer contents to result in the right state for the "unwanted" pins, but even if there'd be a good way to do it (interrupt before DMA transfer instead of after?), it would require CPU time taking away most of the benefit in addition to just feeling silly.
I'm not very familiar yet with the inner workings of the chip and it's capabilities so I'd appreciate opinions on whether it's even possible to have non-blocking WS2811 waveform on pin 2 of the teensy 3.6 without affecting other pins I know the Betaflight flight control software somehow drives these leds using DMA without blocking 8 ports with somewhat similar STM chips, but I haven't been able to decrypt that code yet..
Thanks,
Jopj