Closed rbagdazian closed 2 months ago
Hello Unfortunately it will not work. This will not duplicate the signal 8 times. If you plug directly without the external hardware you will not see anything. Can I ask you why you need so much memory ? 256 leds are really not a lot especially for an esp32. If you really need more memory go for an esp with psram. Regards Yves
Hello Yves, Thank you for answering my question. I have been using the I2SClocklessLedDriver library but have run into a problem which ix why asked the question. I am working on a project for a client who wanted a sound reactive led display and BluetoothSpeaker in a single ESP32 board. Everything works as expected as long as I keep the NUM_LEDS_PER_STRIP at 200 or less. If I set the value to 300 to match my LED strip length, the processor goes into a panic reset condition forever. I agree that this is not a lot of leds. I am writing a simple pattern of four CRGB values that repeats across the length of the strip which was why I was wondering if it was possible to have the DMA perform the pattern replication for me.
Here is a snippet of code that shows what I'm doing: (The audio support and FFT support are from pschatzmann's libraries ) I haven't worked with psram before. I will look into that.
Thank you for your kind help.
//////////////////////////////////////
#include "AudioTools.h"
#include "AudioLibs/AudioKit.h"
#include "AudioLibs/AudioA2DP.h"
#include "AudioLibs/AudioRealFFT.h" // or AudioKissFFT
#include "AudioLibs/FFT/FFTWindows.h"
#include "BluetoothSerial.h"
#define FULL_DMA_BUFFER //this will enable the full dma buffer
//#include "FastLED.h"
#define I2S_DEVICE 1
#define NUM_LEDS_PER_STRIP 200
#define NUMSTRIPS 2 // up to 16
#include "I2SClocklessLedDriver.h"
//here we have 3 colors per pixel
uint8_t leds[NUMSTRIPS*NUM_LEDS_PER_STRIP*3];
int mypins[2]= {5,23}; // 25, 21 }; //{0,2,4,5,12,13,14,15,16,18,19,21,22,23,25,26};
BluetoothA2DPSink a2dp_sink;
AudioKitStream kit;
AudioRealFFT fft; // or AudioKissFFT
I2SClocklessLedDriver CLed;
BluetoothSerial SerialBT;
.
.
.
void setup() {
Serial.begin(115200);
.
.
.
// add LEDs
CLed.initled(leds,&mypins[0],NUMSTRIPS,NUM_LEDS_PER_STRIP, ORDER_RGB);
.
.
}
void loop() {
.
.
CLed.showPixelsFromBuffer(WAIT);
.
.
}
I will have a look asap and let you know.
So far my testing seems to indicate its a memory problem. At one point a couple of months ago it was working, but then I had to switch development computers. I built a new development environment using vscode with the esp-idf plug-in and platformio plug-in. That was when I started having problems. I don't know if something significant changed in the esp-idf release that would account for the failure. I also think I saw a similar problem in the FullBufferLoop example program when I was doing some testing.
Hello I kinda doubt it's an issue with the memory It has to do with the fact that you have the show in the loop. And I don't know if there is not a conflict between that and the fact that it's updating the leds for too long. I would try to test NO_WAIT and also move the show to the second core.
I hadn't considered the loop taking too long. Thanks for these suggestions. I'll give them a try. I did find that my board does have psram (4mb). Is it true that if I execute the initled method in setup, that all memory has been allocated for dma support? If I leave the call to show out of the loop and leave everything else as is, I think it would be correct to conclude that memory isn't the problem. Thanks again!
Hello again Yves, I seem to have narrowed things down to the I2SClocklessLEDDriver and some other part of my design not getting along well. I removed all code from my loop() function and just performed the initled call in the setup routine. When setting the number of leds to 300, the system crashes if I place the call after all of the other bluetooth and i2s setup necessary to implement the bluetooth speaker functionality, but if I place the initled call before the calls to perform the bluetooth and i2s setup, the system doesn't crash, but the speaker functionality is broken.
I was reviewing your code for both of the I2SClockless drivers and saw that in the functions I2SReset, I2SReset_DMA, and I2SReset_FIFO, that these routines operate on I2S0 even if the I2S_DEVICE is set to 1. I was wondering if this is correct. Shouldn't they select the I2S0 or I2S1 device based on which device has been selected previously by the I2S_DEVICE statement? I am using I2S 1 in my case so as to leave I2S 0 for the audio output channel.
Thanks again, Richard
Thank you for providing this excellent concept. If I connect the ws2812 strip without the additional hardware logic directly to the esp32 output pin, will my pattern be replicated 8 times on the strip? As an example if my pattern is a CRGB array of length 32, will this driver actually cause the pattern to program a strip of 32x8 or 256 leds if no external hardware is added? I want to do this to save on memory requirements.
Thank you!