You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also, as a sanity check - make sure you haven’t gotten clock and data wired backwards (the behavior you’re describing is not dissimilar to what happens when the clock and data lines have been swapped)
The code that I pushed for the ESP32 is mainly for clockless chips, like the WS2812 family. It was adapted directly from the ESP8266 code, with modifications mainly to handle interrupts. I would not expect to see problems with LEDs that have an explicit clock signal, but I'm pretty new to this stuff (and to hacking FastLED).
Also: the pins you're using should be fine, but there are so many weird exceptions on this processor. I have gotten things to work reliably on GPIO 18 and 19.
Tried with level converter, works just the same on the 8266 with level converter.
With the esp32 and a level converter using pins 18 and 19, works exactly the same, first 2 led's are white and then third flickers.
( tried switching clock and data line to make sure its correct - no colour the other way )
Using FastLED version 3.001.006
"No hardware SPI pins defined. All SPI access will default to bitbanged output"
Thanks for trying. I use a WEMOS Lolin32 clone and a 30A 5V power supply. All 18 strips have 5V and GND individually fed in from the strip start. The script ran on an ESP8266 (ModeMCU clone), but it was flickering etc. like hell because of interrupts. I wanted to use WiFi / Websockets, so figured I should try with an ESP32 to get a stable display. I don't use a level converter, but all my other projects (that have less LEDs though and no parallel output) never needed one...
I have commented out everything except the LED driving code in my script.
// LED strip setup
#define CALIBRATION_TEMPERATURE TypicalLEDStrip
#define MAX_BRIGHTNESS 255 // 0-255
#define LED_PIN_STRIP1 19 // Define LED data port pin for upper half strip
#define LED_PIN_STRIP2 23 // Define LED data port pin for lower half strip
//initialise LED-array
#define NUM_STRIPS 2 // We have two strips, one for the upper half, one for the lower
#define NUM_LEDS_WIDTH 30
#define NUM_LEDS_HEIGHT 18
#define NUM_LEDS (NUM_LEDS_WIDTH*NUM_LEDS_HEIGHT) // Number of LEDs (my configuration is 30*18=540)
#define NUM_LEDS_PER_STRIP (NUM_LEDS/NUM_STRIPS) // 30*18/2=270 LEDs per strip
#define MAX_FRAME_RATE 30 // Maximum 30Hz update rate
CRGB leds[NUM_LEDS];
void setupLEDs() {
// clear led color buffer to black
memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
// initialize FastLed library for the WS2812B strip
FastLED.addLeds<WS2812B, LED_PIN_STRIP1, GRB>(leds, 0, NUM_LEDS_PER_STRIP); // first half is at pin 19 and starts at array index 0
FastLED.addLeds<WS2812B, LED_PIN_STRIP2, GRB>(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP); // second half is at pin 23 and starts at array index 270
FastLED.setTemperature(CALIBRATION_TEMPERATURE);
FastLED.setBrightness(MAX_BRIGHTNESS);
FastLED.setDither(DISABLE_DITHER);
}
void initialLEDflash() {
LEDS.showColor(CRGB(127, 0, 0));
delay(333);
LEDS.showColor(CRGB(0, 127, 0));
delay(333);
LEDS.showColor(CRGB(0, 0, 127));
delay(333);
LEDS.showColor(CRGB(0, 0, 0));
}
void setup() {
setupLEDs();
initialLEDflash();
}
void loop() {
// update display if new data arrived, but only with max. 30Hz
EVERY_N_MILLISECONDS(1000 / MAX_FRAME_RATE) {
LEDS.showColor(CHSV(led_color++, 255, 128));
}
}
@HorstBaerbel Can you try something out for me? Instead of using showColor, can you call fill_solid to set the color, then call FastLED.show() separately.
I found the problem using my (handheld, small and crappy) oscilloscope. I seem to have shorted out pin 19 to GND on the prototype board and were no signals on pin 19. Thanks for the help and sorry for the hassle!
Parallel mode with 540 LEDs is pretty smooth now on the ESP32. Without frame rate limiting (no "EVERY_N_MILLISECONDS") I see a flicker every ~20-30s, but at 60Hz it seems to be gone. Nice work!
I am working on a POV project, that is using 4 single strips of apa102 leds rotation around the core.
The used controller is a ESP32, because it's quite cheap and offers a good performance and Bluetooth + Wifi. We are using 4 different strips to display a 70 x 200 image, because of the 4 different stripes we can run at lower RPM and therefore have less noise, but still have a flicker free and bright image.
The issue that we are facing is, that we had to realise, that we can't display 70 x 200 at around 320 RPM, we were only getting to 109 columns displayed. We checked everything to find the reason for this. Then we found out that we had only 6 MHz speed for updating the LEDs... The SPI for the ESP32 seems not to be supported by the FastLED library :-(
With other ways it was possible to get a high SPI rate with the ESP32, but we would still like to use the FastLED library, because we are used to it and it makes things more easy :-)
Is there any chance that the SPI support for the ESP32 will be added?
Adding hardware SPI for esp32 is on the “will eventually get done” list - but I don’t have a timeframe for it yet (and no one has submitted support for it)
Adding hardware SPI for esp32 is on the “will eventually get done” list - but I don’t have a timeframe for it yet (and no one has submitted support for it)
@focalintent Thanks for your quick reply.
Okay sad to hear that it's officially not supported. Is there any known branch that have SPI support for the ESP32?
The ESP32 is a perfect platform for POV project, it's cheap, has a lot of performance, BT and Wifi and so on. But without that SPI support it can't be used like that with FastLED.
Well I will try to get into it and create some ESP32 solution for FastLED, but I think I could need some support for this.
@hamburgtech I tried to add hardware SPI but FastLED is a big project and I'm not familiar with its code base. I ended up writing a simple sketch for ESP32 to take advantage of hardware SPI for my purposes (Hyperion) as the APA102s I'm using are really simple to control over SPI.
== Porting fastspi.h ==
This is where you define the low level interface to the hardware SPI system (including a writePixels method that does a bunch of housekeeping for writing led data). Use the fastspi_nop.h file as a reference for the methods that need to be implemented. There are ofteh other useful methods that can help with the internals of the SPI code, I recommend taking a look at how the various platforms implement their SPI classes.
The biggest part will be getting the control registers for configuring the SPI output and determining the right register settings for various clock speeds and then writing data into the registers.
As far as I know, no one has done this for the esp’s yet.
I got myself a strip of 150 SK9822 LEDs and this #504 (comment) fixed the issue for me
// write the BIT'th bit out via spi, setting the data pin then strobing the clcoktemplate<uint8_tBIT>__attribute__((always_inline, hot)) inlinestaticvoidwriteBit(uint8_tb) {
//cli();if(b& (1 << BIT)) {
FastPin<DATA_PIN>::hi();
#ifdefESP32FastPin<CLOCK_PIN>::lo(); // kick a different register, block premature optimizations?#endifFastPin<CLOCK_PIN>::hi(); CLOCK_HI_DELAY;
FastPin<CLOCK_PIN>::lo(); CLOCK_LO_DELAY;
} else {
FastPin<DATA_PIN>::lo();
FastPin<CLOCK_PIN>::hi(); CLOCK_HI_DELAY;
FastPin<CLOCK_PIN>::lo(); CLOCK_LO_DELAY;
}
//sei();
}
Same here. I'm working with SK9822 LEDs and #504 fixed the issue when using a LOLIN32. Interestingly, I didn't need to add this register kick-in hack when programing an LOLIN32 Lite. Maybe it's due to a different chip version?
Closing this off - just checked in a more reliable version of this fix.
@haaslukas what platforms you do and don't need it on depends heavily on what the hi/lo methods in FastLED compile down to, in terms of low level statements/IR as well as how I/o registers are defined/implemented. My guess is on the esp32 the adjacent FastPin<DATA_PIN>::hi() and FastPin<CLOCK_PIN>::hi() (which both write to the same register) resulted in something that was literally:
(*out_reg) = 0x01;
(*out_reg) = 0x02;
It's possible that the compiler version you were using with the LOLIN32 lite either had slightly different register definitions that didn't create this situation, and/or had slightly different compiler versions (or options defined in the platform) that didn't quite so aggressively optimize out.
Activity
focalintent commentedon Sep 27, 2017
@samguyer any thoughts for @PhilColbert? I don't have any esp32 based setups here to test with, so I'm mostly relying on sam's pull request :)
samguyer commentedon Sep 27, 2017
@PhilColbert Which pin are you using? I have found that the ESP32 is very finicky about the pins.
PhilColbert commentedon Sep 27, 2017
Hi
Thanks for the reply, tried 13,14 and 25,26 so far....
Seemingly same result, first 2 leds on white, 3rd flashes....
Thanks
gnkarn commentedon Sep 27, 2017
You should try the level converter first , also in an ESP 8266 before anything else .
PhilColbert commentedon Sep 27, 2017
Yes, will do :)
thanks
focalintent commentedon Sep 27, 2017
Also, as a sanity check - make sure you haven’t gotten clock and data wired backwards (the behavior you’re describing is not dissimilar to what happens when the clock and data lines have been swapped)
PhilColbert commentedon Sep 27, 2017
:) Tried it both ways.... first thing to check that one, been there done that before several times, with them reversed, nothing comes out.
Thanks tho, will try Level converter soon first.
samguyer commentedon Sep 27, 2017
The code that I pushed for the ESP32 is mainly for clockless chips, like the WS2812 family. It was adapted directly from the ESP8266 code, with modifications mainly to handle interrupts. I would not expect to see problems with LEDs that have an explicit clock signal, but I'm pretty new to this stuff (and to hacking FastLED).
samguyer commentedon Sep 27, 2017
Also: the pins you're using should be fine, but there are so many weird exceptions on this processor. I have gotten things to work reliably on GPIO 18 and 19.
PhilColbert commentedon Sep 27, 2017
Ok, will give it a try , thanks.
PhilColbert commentedon Sep 27, 2017
Tried with level converter, works just the same on the 8266 with level converter.
With the esp32 and a level converter using pins 18 and 19, works exactly the same, first 2 led's are white and then third flickers.
( tried switching clock and data line to make sure its correct - no colour the other way )
Using FastLED version 3.001.006
"No hardware SPI pins defined. All SPI access will default to bitbanged output"
Any idea where to start looking for the issue ?
Thanks
samguyer commentedon Sep 27, 2017
Do you have another strip, or a different kind of strip you can try?
samguyer commentedon Sep 29, 2017
OK, I think I've made some improvements to the ESP32 support.
@focalintent: do you want me submit another pull request?
218 remaining items
samguyer commentedon Aug 10, 2018
@HorstBaerbel That is strange. Let me try out your code, and I'll get back to you soon.
samguyer commentedon Aug 14, 2018
@HorstBaerbel I was not able to reproduce the problem on my setup. Can you tell me about the hardware you're using?
HorstBaerbel commentedon Aug 14, 2018
Thanks for trying. I use a WEMOS Lolin32 clone and a 30A 5V power supply. All 18 strips have 5V and GND individually fed in from the strip start. The script ran on an ESP8266 (ModeMCU clone), but it was flickering etc. like hell because of interrupts. I wanted to use WiFi / Websockets, so figured I should try with an ESP32 to get a stable display. I don't use a level converter, but all my other projects (that have less LEDs though and no parallel output) never needed one...
I have commented out everything except the LED driving code in my script.
samguyer commentedon Aug 14, 2018
@HorstBaerbel Can you try something out for me? Instead of using showColor, can you call fill_solid to set the color, then call FastLED.show() separately.
HorstBaerbel commentedon Aug 14, 2018
I found the problem using my (handheld, small and crappy) oscilloscope. I seem to have shorted out pin 19 to GND on the prototype board and were no signals on pin 19. Thanks for the help and sorry for the hassle!
Parallel mode with 540 LEDs is pretty smooth now on the ESP32. Without frame rate limiting (no "EVERY_N_MILLISECONDS") I see a flicker every ~20-30s, but at 60Hz it seems to be gone. Nice work!
samguyer commentedon Aug 15, 2018
@HorstBaerbel That's great! Glad to hear you fixed the problem (and that it wasn't some terrible bug in the library!)
hamburgtech commentedon Aug 20, 2018
Hi guys,
I am working on a POV project, that is using 4 single strips of apa102 leds rotation around the core.
The used controller is a ESP32, because it's quite cheap and offers a good performance and Bluetooth + Wifi. We are using 4 different strips to display a 70 x 200 image, because of the 4 different stripes we can run at lower RPM and therefore have less noise, but still have a flicker free and bright image.
The issue that we are facing is, that we had to realise, that we can't display 70 x 200 at around 320 RPM, we were only getting to 109 columns displayed. We checked everything to find the reason for this. Then we found out that we had only 6 MHz speed for updating the LEDs... The SPI for the ESP32 seems not to be supported by the FastLED library :-(
With other ways it was possible to get a high SPI rate with the ESP32, but we would still like to use the FastLED library, because we are used to it and it makes things more easy :-)
Is there any chance that the SPI support for the ESP32 will be added?
Thanks a lot.
Cheers,
Nils
focalintent commentedon Aug 20, 2018
Adding hardware SPI for esp32 is on the “will eventually get done” list - but I don’t have a timeframe for it yet (and no one has submitted support for it)
hamburgtech commentedon Aug 20, 2018
@focalintent Thanks for your quick reply.
Okay sad to hear that it's officially not supported. Is there any known branch that have SPI support for the ESP32?
The ESP32 is a perfect platform for POV project, it's cheap, has a lot of performance, BT and Wifi and so on. But without that SPI support it can't be used like that with FastLED.
Well I will try to get into it and create some ESP32 solution for FastLED, but I think I could need some support for this.
Thanks so far.
Cheers,
Nils
hamid-elaosta commentedon Aug 20, 2018
@hamburgtech I tried to add hardware SPI but FastLED is a big project and I'm not familiar with its code base. I ended up writing a simple sketch for ESP32 to take advantage of hardware SPI for my purposes (Hyperion) as the APA102s I'm using are really simple to control over SPI.
focalintent commentedon Aug 20, 2018
From https://github.com/FastLED/FastLED/blob/master/PORTING.md
The AVR example of how to do this is presets straightforward and can be used as a reference - https://github.com/FastLED/FastLED/blob/master/platforms/avr/fastspi_avr.h - also the teensy 3.2’s support, though that’s a bit more complex - https://github.com/FastLED/FastLED/blob/master/platforms/arm/k20/fastspi_arm_k20.h
The biggest part will be getting the control registers for configuring the SPI output and determining the right register settings for various clock speeds and then writing data into the registers.
As far as I know, no one has done this for the esp’s yet.
NZSmartie commentedon Aug 30, 2018
I got myself a strip of 150 SK9822 LEDs and this #504 (comment) fixed the issue for me
haaslukas commentedon Sep 3, 2018
Same here. I'm working with SK9822 LEDs and #504 fixed the issue when using a LOLIN32. Interestingly, I didn't need to add this register kick-in hack when programing an LOLIN32 Lite. Maybe it's due to a different chip version?
focalintent commentedon Jan 20, 2019
Closing this off - just checked in a more reliable version of this fix.
@haaslukas what platforms you do and don't need it on depends heavily on what the hi/lo methods in FastLED compile down to, in terms of low level statements/IR as well as how I/o registers are defined/implemented. My guess is on the esp32 the adjacent FastPin<DATA_PIN>::hi() and FastPin<CLOCK_PIN>::hi() (which both write to the same register) resulted in something that was literally:
It's possible that the compiler version you were using with the LOLIN32 lite either had slightly different register definitions that didn't create this situation, and/or had slightly different compiler versions (or options defined in the platform) that didn't quite so aggressively optimize out.