Fastled and wifi
Posted: Fri May 29, 2020 9:34 pm
I'm trying to drive leds with Fastled by sending the data via UDP packets via wifi.
The size of the UDP packet is 1024B, that's the biggest that should confortably pass trough all the common routers. So I need 4 packets to get 1024 RGB leds (plus some headers)
I want to move the part that receives the packets on one core leave the other to Fastled.show(), so to maximize the resources for the frame drawing. So I made a double buffer architecture, where loop() receives the data, put them in a led buffer and when the buffer is complete it memcopy and notifies (via semaphore) the "fastled" routine that the next frame is ready.
I did put the "fastled" routine on core 0 and it kinda worked, but sometimes the leds would flicker. After ruling out everyting else, I came to the conclusion that it was the WiFi routines on core 0 that were interrupting Fastled.show() causing the flicker. (It's kind of a known behaviour).
Then I did put my "fastled" routine in core 1 and moved the UDP part in a new routine in core 0. But this seems to make the software crash with a dump. My guess here is that my UDP handling interrupts the wifi routines and causes issues.
Is there a way to read big packets from wifi on Core 1?
The size of the UDP packet is 1024B, that's the biggest that should confortably pass trough all the common routers. So I need 4 packets to get 1024 RGB leds (plus some headers)
I want to move the part that receives the packets on one core leave the other to Fastled.show(), so to maximize the resources for the frame drawing. So I made a double buffer architecture, where loop() receives the data, put them in a led buffer and when the buffer is complete it memcopy and notifies (via semaphore) the "fastled" routine that the next frame is ready.
I did put the "fastled" routine on core 0 and it kinda worked, but sometimes the leds would flicker. After ruling out everyting else, I came to the conclusion that it was the WiFi routines on core 0 that were interrupting Fastled.show() causing the flicker. (It's kind of a known behaviour).
Then I did put my "fastled" routine in core 1 and moved the UDP part in a new routine in core 0. But this seems to make the software crash with a dump. My guess here is that my UDP handling interrupts the wifi routines and causes issues.
Is there a way to read big packets from wifi on Core 1?