esp32: RMT timing glitches
I am getting semi-random glitches in the RMT output. I am trying to use it to drive Neopixels and I get wrong pulse lengths sometimes. The glitches occur less frequently when I have longer delays between writing the pulses and if I write less data. I say semi-randomly because when I am running an animation for the Neopixels it has a high tendency to glitch at the same time and the same LEDs seem to be glitching when repeating the run.
Here are two captures at the position that the glitch first occurs. The first 300 us are fine, then I start getting pulses that are longer than expected. In total it adds up to 70 us more (from 560 us).
Bad frame:
<img width="939" alt="Bildschirmfoto 2020-02-08 um 14 45 45" src="https://user-images.githubusercontent.com/11031419/74086417-f089fb80-4a82-11ea-9f96-d31a989ae814.png">
Good frame:
<img width="939" alt="Bildschirmfoto 2020-02-08 um 14 45 55" src="https://user-images.githubusercontent.com/11031419/74086421-f67fdc80-4a82-11ea-8555-22facd5c2f01.png">
Interestingly I also see the power go up at the end. Right now I have a level shifter attached to the output, because my first guess was that this was responsible for the glitches.
<img width="430" alt="Bildschirmfoto 2020-02-08 um 14 53 03" src="https://user-images.githubusercontent.com/11031419/74086436-0eeff700-4a83-11ea-8fdd-8c0c2008a983.png">
Some people here are reporting similar problems: https://esp32.com/viewtopic.php?f=2&t=3980&start=10
Disabling power management did however not resolve the it.
esp32/machine_bitstream: Reinstate bit-bang implementation.
The new esp32 bitstream/neopixel driver based on RMT can have glitches when WiFi is enabled. It's not currently known why this happens, but for now here is a patch which reinstates the previous bit-bang implementation.
It's now possible to select bit-bang or RMT via:
esp32.RMT.bitstream_channel(channel_to_use_for_bitstream)
The default is to use bit-banging.