I2SClocklessLedDriver icon indicating copy to clipboard operation
I2SClocklessLedDriver copied to clipboard

DMA mode takes up 60k of ram just for a single 300 led strip!!!!!

Open chrisdoel opened this issue 2 years ago • 15 comments

Hi, this library is absolutely perfect for me. I've been experiencing many issues with glitching when using BLE and driving LEDs at the same time. However, when I define FULL_DMA_BUFFER, 60kB of ram is consumed and I am already running low on ram on this project :(

Is this caused by a bug? I understand that we need 3x the bytes of the led strip data, but in my case this would be less than 1kB

chrisdoel avatar Nov 11 '22 20:11 chrisdoel

Hello sorry for the late reply the FULL_DMA is indeed memory hungry. THe DMA size should be nb_of_leds_per_strip x 3 x 8 x 2 x 3 hence in your case 43.2k this is strangethat you have 60k can you share your code ? Indeed the issue with the DMA is that for 300leds or 300*16 leds the amont of ram taken is the same I will have a closer look at it maybe I have a mistep somewhere

hpwit avatar Nov 30 '22 12:11 hpwit

I2S1 support to 8 pins. so if we need up to 8 parallel data and we use I2S 1 instead 0 then we can use save 50% memory.

DMA size should be nb_of_leds_per_strip x 3 x 8 x 3

pls guide me how to use I2S 1 in this driver?

thanks

jagspaul avatar Jul 02 '23 05:07 jagspaul

For existing 16 bit width driver (I2S 0) with FULL_DMA, what is the maximum limit of nb_of_leds_per_strip?

Can I go for 1024 or 2048 Leds per strip?

Thanks & regards

jagspaul avatar Jul 02 '23 05:07 jagspaul

Hello if you’re using full dma buffer it will depend of your memory.

hpwit avatar Jul 02 '23 06:07 hpwit

HelloIt’s not responsible of the i2s used. I need a change of code to not use 16 but 8 buffer size. I can make it a choice. YvesOn 2 Jul 2023, at 07:51, Jagadish Paul @.***> wrote: I2S1 support to 8 pins. so if we need up to 8 parallel data and we use I2S 1 instead 0 then we can use save 50% memory. DMA size should be nb_of_leds_per_strip x 3 x 8 x 3 pls guide me how to use I2S 1 in this driver? thanks

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

hpwit avatar Jul 02 '23 06:07 hpwit

Sorry for not to understand your reply correctly.

  1. Did you mean that it is not possible to use I2S 1 instead I2s 0. if so then can you explain the reason? As per my knowledge I2S 1 has a offset of pin from I2S 0. Other things almost same.
  2. Are you going to change you code in such a manner that with I2S 0 & within 8 strip you will manage the code it use 8 bit buffer instead of 16 bit? Thnaks

jagspaul avatar Jul 02 '23 06:07 jagspaul

ill depend of your memor

I want to know value of nb_of_leds_per_strip for existin memory of ESP32.

jagspaul avatar Jul 02 '23 06:07 jagspaul

If you use full dma I think around 2200leds per strip

hpwit avatar Jul 02 '23 07:07 hpwit

Can I ask you what you are trying to achieve?

hpwit avatar Jul 02 '23 07:07 hpwit

full dma I think around 2200leds per strip

It sounds good.

I will to build 8 data parallel controller with 2048 pixels per data line. Total capacity 16k pixels.

On Sun, 2 Jul, 2023, 1:00 pm hpwit, @.***> wrote:

Can I ask you what you are trying to achieve?

— Reply to this email directly, view it on GitHub https://github.com/hpwit/I2SClocklessLedDriver/issues/11#issuecomment-1616421420, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD5AG6RYY63AQ3N5BCVIKLXOEPQBANCNFSM6AAAAAAR55M56Y . You are receiving this because you commented.Message ID: @.***>

jagspaul avatar Jul 04 '23 04:07 jagspaul

If you do this you will to have enough ram for much of the rest. Can I suggest 2 things ?

  1. use the Virtual driver to use more pins and have a better refresh rate because now you're refresh rate is 16fps !! without counting the time to transpose the entire screen.
  2. do not use full dma buffer in your case
  3. if you're afraid that you will have interrupt issues look at this https://youtu.be/sYtVOU8Hpss If I may ask what will this will be used for ?

hpwit avatar Jul 04 '23 06:07 hpwit

Thanks for you reply.

I will try as you suggested.

Sir one question I have.

Can you explain please how frame rate increase in virtual driver rather than direct parallel driver?

As I understand in both the cases matrix transpose is done.

Thanks and regards

On Tue, 4 Jul, 2023, 12:06 pm hpwit, @.***> wrote:

If you do this you will to have enough ram for much of the rest. Can I suggest 2 things ?

  1. use the Virtual driver to use more pins and have a better refresh rate because now you're refresh rate is 16fps !! without counting the time to transpose the entire screen.
  2. do not use full dma buffer in your case
  3. if you're afraid that you will have interrupt issues look at this https://youtu.be/sYtVOU8Hpss If I may ask what will this will be used for ?

— Reply to this email directly, view it on GitHub https://github.com/hpwit/I2SClocklessLedDriver/issues/11#issuecomment-1619592139, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD5AG62N2CAYP654EPXLITXOO2XTANCNFSM6AAAAAAR55M56Y . You are receiving this because you commented.Message ID: @.***>

jagspaul avatar Jul 04 '23 21:07 jagspaul

Hello The frame rate increases because you can have more parallel pins. I a nutshell the virtual driver allows you to drive 8 strips individually per pin of the esp32 using a shift register. Hence you can drive your 16k less over 32 strips of 512 leds. Using 6 pins of the esp32 (4 data 1 latch 1data) Hence the fps will be 65 instead of 16.

hpwit avatar Jul 05 '23 04:07 hpwit

Ok, thanks for the clarification.

On Wed, 5 Jul, 2023, 10:23 am hpwit, @.***> wrote:

Hello The frame rate increases because you can have more parallel pins. I a nutshell the virtual driver allows you to drive 8 strips individually per pin of the esp32 using a shift register. Hence you can drive your 16k less over 32 strips of 512 leds. Using 6 pins of the esp32 (4 data 1 latch 1data) Hence the fps will be 65 instead of 16.

— Reply to this email directly, view it on GitHub https://github.com/hpwit/I2SClocklessLedDriver/issues/11#issuecomment-1621023981, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD5AG3HKF6IJ7LY2VKOAULXOTXNFANCNFSM6AAAAAAR55M56Y . You are receiving this because you commented.Message ID: @.***>

jagspaul avatar Jul 05 '23 05:07 jagspaul

If you use full dma I think around 2200leds per strip

Remember that the target is moving, too. 16MB Octal PSRAM ESP32-S3 boards can be made/found, though they're not exactly at the $5 point like the 8's are. 32MB's on latest wafer has been proven to work by people mounting their own SPIRAM chips, e.g. https://github.com/huming2207/jumbo-s3

Neither of these are exactly common yet and I don't know if you won't run out of gas before just multiplying by 2 forever, but new hardware is always on the way.

As inexpensive as these parts are, and given the price premium of the more dense parts, if the 8MB limit is a real drag, multiple chips remains the easiest solution for most people.

"Two chips in the hand is worth one on the way."

robertlipe avatar Nov 20 '23 05:11 robertlipe