hpwit / I2SClockLessLedDriveresp32s3

esp32s3 IS2 led driver
14 stars 6 forks source link

ESP32C3 #5

Open xjimenez59 opened 9 months ago

xjimenez59 commented 9 months ago

Hi , thanks for your awesome work on various area (i am using also esp32Artnet and Fastled) ; Your DMA solution to free the CPU from handling LED display is just smart and elegant.

It works flawlessly with the Xiao ESP32S3 of course; But i am considering using the Xiao ESP32C3 (only one core and no PSRAM, only "normal" RAM) , as only one core should be enough ; I have two issues trying to compile on the c3 :

Do you have any hint i could work on to address that issue ? (or maybe it is just not possible)

Regards, Xavier

hpwit commented 9 months ago

Hello Thank you for using my libraries. Whith which version of artnet are you using my driver for the s3 ? If you can share a bit more detail of your builds it would be appreciated.

Unfortunately this library will not compile for the c3 as the processor is not the same. The c3 doesn't have a lcd interface like the s3. I would have to look at the c3 capabilities and write a modified driver. Maybe not that much modification.

Regards

xjimenez59 commented 9 months ago

Hi , i am using artnetESP32V2 :-) I have dropped my code in this repo in case it is of interest for any one. Please don't judge too hardly , the code wasn't meant to be public :-)

For history, i first started sending data to the leds via Fastled immediately upon arrival from wifi via artnet. But i discovered the udp frames don't arrive reguarly : i got some huge 200ms delays from time to time, then suddenly 7ms for the next frame etc ; leading to packet losses and preventing fluid led display.

I then decided to separate the two flows : one to receive Artnet frames and push the data in a queue ; the second flow do send on a regular basis (each 50ms) the data to the led driver, picking from the queue. If the queu length gets low, i slow down the led refresh rate to give a chance to artnet to refill the queue.

I tried with interrupts, but got many "wdt panic" issues : the esp32c3 has only one core , and Fastled disables interrupts while displaying so i guess this is too much for the c3. I then used the same technique as in the EVERYXXX macros in fastled to handle the refresh rate , and had much better results. But still had wdt issues from time to time .

Then i discovered the I2SClocklessLedDriver library and its DMA solution to drive the leds. Works fine on the s3 using only one core !

If any one is interested, i slightly modified the library to allow "config time led init" , instead of "compile time" , as i needed to configure the device with a web page. It has a little cost, i suppose, but i have tested it successfully (more or less 500 leds to drive)