Open guirespi opened 1 year ago
RMT and Wi-Fi have issue working together, see led_strip - RMT-based driver for WS2812B/SK6812/APA106 LED strips — esp-idf-lib 1.0 documentation.
If you try to use this driver simultaneously with Wi-Fi, you may encounter RMT transmission bugs. To avoid them, simply initialize device from the task bound to the second processor core.
More information about it here : LED Strip Driver.
If the RMT hardware can't be assist by DMA, the driver will going into interrupt very frequently, thus result in a high CPU usage. What's worse, if the RMT interrupt is delayed or not serviced in time (e.g. if Wi-Fi interrupt happens on the same CPU core), the RMT transaction will be corrupted and the LEDs will display incorrect colors. If you want to use RMT to drive a large number of LEDs, you'd better to enable the DMA feature if possible.
You can run the task interacting with your led strip on another core by using xTaskCreatePinnedToCore().
I'll try it in my example and will comment the results.
Hi @guirespi, could you please share the latest status of this issue? Thanks.
Hi @Sherry616, I've already separated the WIFI and RMT tasks into different cores. The bug is less frequent but still happen. It's been a couple months since I worked on the project that uses the RMT driver and WIFI, but, I remember I use Nimble BLE too. So, do I need to keep the Nimble task in another core too?
There're some limitations you may want to know when using the RMT driver. https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/rmt.html#faq Although this documentation is written for the new RMT driver which only appears in the esp-idf v5.x
For the legacy driver you're using the esp-idf v4.x, I would provide the following suggestions:
rmt_config_t::mem_block_num
BTW, can you use a logic analyzer to capture the signal on the RMT GPIO when it fails to blink the LED? Can you also provide your crash log?
Hi,
For now it's quite difficult to use the logic analyzer on the project. The logs were provided in this issue, the program just stops waiting for an interruption.
Regards.
Answers checklist.
IDF version.
v4.4.2
Operating System used.
Windows
How did you build your project?
Eclipse IDE
If you are using Windows, please specify command line type.
None
Development Kit.
ESP32 WROVER KIT
Power Supply used.
USB
What is the expected behavior?
Wi-fi and RMT driver for WS2812 should coexist without freezing the program. The code I made starts a task that constantly creates and delete anoter task that turn the WS2812 leds.
What is the actual behavior?
When try to connect to an non existent SSID and the RMT driver is used to turn on and turn off a WS2812 led strip, the program freezes. Neither Wi-fi or led strip do something after.
Steps to reproduce.
Compile and run the following code . The base is the 'station' project in the examples folder (esp_idf>examples>wifi>getting_started). Then I add the component led_strip (esp_idf>examples>common_components) to the components folder.
This a draft code, the production code uses a different implementation of led_strip component but, I achieve to recreate the same scenario with espressif's components. In the production code, the program freezes after several hours of use and it is always at the use of the RMT driver.
This is the code I use in the 'station_example_main.c' file. In using the ESP-IDF v4.4.2.
Debug Logs.
More Information.
I don't know if this is related to #7602 but, I tried the same code with an S3 and stills freezes or crash.