-
-
Notifications
You must be signed in to change notification settings - Fork 265
ESP32 NeoMethods
The ESP32 platforms requires hardware support to be able to reliably send the data stream. While a bit bang method is provided, it is not recommended.
The ESP32 and the ESP32S2 both have some pins dedicated for input only. The following NeoMethods are restricted to use only output pins.
For the ESP32 all pins below 34 are output pins. You will still need to check your board to make sure any of these pins are available. Esp32 Dev Pin Map
For the ESP32S2 all pins other than 46 are output pins. Again, please check your specific board for available pins.
The bitbang method has further restrictions in that it will only support pins below 32.
If you notice any flickering related to network activity and/or high CPU load you might want to look into ESP32 and RTOS tasks
ESP32C3 and ESP32S3 do not support I2S at this time; RMT method is used by default for these platforms.
All methods for the ESP32 platform will follow this template for the methods name. The LED names are the same from the simple names and will not be listed in full below as we will focus on the hardware details on this page.
"NeoEsp32<insert hardware detail><insert LED name>Method"
The I2S hardware is used to send the data. This method uses very little CPU for actually sending the data to NeoPixels but it requires an extra buffer for the I2S DMA to read from. Thus, there is a tradeoff of CPU use versus memory use. The extra buffer needed is four times the size of the primary pixel buffer.
NOTE: ESP32S3 and ESP32C3 do not support I2S method at this time. You must use the RMT methods for these.
A single I2S peripheral can send a single channel (pin) or it can send a collection of parallel channels. Each of these have different methods.
- I2s0 - Uses the I2S 0 peripheral, an example would be NeoEsp32I2s0Ws2812xMethod.
- I2s1 - Uses the I2S 1 peripheral, an example would be NeoEsp32I2s1Ws2812xMethod.
- I2sN - An example would be NeoEsp32I2sNWs2812xMethod. The I2S peripheral to use is defined at runtime as an argument on the NeoPixelBus constructor.
NOTE: The ESP32S2 only supports one I2S hardware bus. Thus you can only use the NeoEsp32I2s0*Method types.
These methods can be instanced more than once, up to the number of channels specified. They consume memory for the length of the longest instance multiplied by the number of channels, so use the least number of channels that you need.
- I2s0X8 - Uses the I2S 0 peripheral in 8 channel parallel mode, an example would be NeoEsp32I2s0X8Ws2812xMethod.
- I2s0X16 - Uses the I2S 0 peripheral in 16 channel parallel mode, an example would be NeoEsp32I2s0X16Ws2812xMethod.
- I2s1X8 - Uses the I2S 1 peripheral in 8 channel parallel mode, an example would be NeoEsp32I2s1X8Ws2812xMethod.
- I2s1X16 - Uses the I2S 1 peripheral in 16 channel parallel mode, an example would be NeoEsp32I2s1X16Ws2812xMethod.
NOTE: The ESP32S2 only supports one i2s hardware bus. Thus you can only use the NeoEsp32I2s0*Method types.
NOTE: You must call Show() on ALL constructed channels before it will send the data. It's a single action to send all the parallel channels. Every time a Show() on a channel is called, it registers that it is ready but waits until the last one is called before actually sending the data.
The RMT peripheral is used to send data to the NeoPixels. Thus, this method uses very little CPU for actually sending the data to NeoPixels but it requires an extra buffer for hardware to read from. This extra buffer is the same size as the primary buffer. Due to the use of a ISR to translate and fill the RMT hardware output buffer, there are many interrupts fired to keep that small DMA output buffer filled. Some have found this to be an issue when other features of their sketch also trigger a high volume of interrupts.
- Rmt0 - Uses the RMT channel 0. An example would be NeoEsp32Rmt0Ws2812xMethod.
- Rmt1 - Uses the RMT channel 1. An example would be NeoEsp32Rmt1Ws2812xMethod.
- Rmt2 - Uses the RMT channel 2. An example would be NeoEsp32Rmt2Ws2812xMethod.
- Rmt3 - Uses the RMT channel 3. An example would be NeoEsp32Rmt3Ws2812xMethod.
- Rmt4 - Uses the RMT channel 4. An example would be NeoEsp32Rmt4Ws2812xMethod.
- Rmt5 - Uses the RMT channel 5. An example would be NeoEsp32Rmt5Ws2812xMethod.
- Rmt6 - Uses the RMT channel 6. An example would be NeoEsp32Rmt6Ws2812xMethod.
- Rmt7 - Uses the RMT channel 7. An example would be NeoEsp32Rmt7Ws2812xMethod.
- RmtN - Uses the RMT but allows the channel selection to be done at runtime. An example would be NeoEsp32RmtNWs2812xMethod. The RMT channel to use is defined at runtime as an argument on the NeoPixelBus constructor.
NOTE: Even though the ESP32 has 8 channels of RMT hardware, using beyond 4 has shown to cause sending delays.
NOTE: The ESP32S2 and ESP32S3 only supports 4 channels of RMT hardware, so only channels 0-3 are available.
NOTE: The ESP32C3 only supports 2 channels of RMT hardware, so only channels 0 and 1 are available.
NOTE: NeoEsp32Rmt# Methods supports any available pin below 34.
The bit bang methods only support pins below 32. Even though 33 and 34 are also output pins, they are not supported.
- BitBang - An example would be NeoEsp32BitBangWs2812xMethod.
This method uses only the CPU to send data to the NeoPixels. But due to core interrupts it is not stable when used with more than a few pixels. It has been reported that using xTaskCreatePinnedToCore()
will greatly help.
It is not recommended to use this method except for comparing results with the other methods. For very short runs of pixels it may be possible to use this method without ill effects. If it fails, the pixels may not be correctly set. Use this instead of Neo800KbpsMethod to force your sketch to use the Bit Banging to send data.