Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32 + SK9822 SPI data rate compile error (template instantiation depth exceeds maximum) #976

Open
Naverritus opened this issue Feb 25, 2020 · 2 comments

Comments

@Naverritus
Copy link

@Naverritus Naverritus commented Feb 25, 2020

Using the DOIT Esp32 DevKit v1
FastLED version 3.3.3
Tried compiling using Arduino 1.8.10 as well as PlatformIO 4.2.1

#include <Arduino.h>
#include <FastLED.h>

// Size definitions
#define WIDTH 	44 
#define HEIGHT 	15
#define NUM_LEDS WIDTH * HEIGHT

// PIN definitions
#define CLOCK_PIN 18
#define DATA_PIN  23

CRGB leds[NUM_LEDS];

void setup() {
  // fastled setup
  FastLED.addLeds<SK9822, DATA_PIN, CLOCK_PIN, BGR, DATA_RATE_KHZ(1)>(leds, NUM_LEDS);
  FastLED.setBrightness(255);
  FastLED.setDither(DISABLE_DITHER);
  delay(10);
}

void loop() {
  delay(0);
}

Trying to compile this code leads to the following fatal error:

C:\Users\Robert\Documents\Arduino\libraries\FastLED/fastled_delay.h: In instantiation of 'void delaycycles() [with int CYCLES = 119095]':

C:\Users\Robert\Documents\Arduino\libraries\FastLED/fastled_delay.h:101:31: recursively required from 'void delaycycles() [with int CYCLES = 119990]'

C:\Users\Robert\Documents\Arduino\libraries\FastLED/fastled_delay.h:101:31: required from 'void delaycycles() [with int CYCLES = 119991]'

C:\Users\Robert\Documents\Arduino\libraries\FastLED/fastspi_bitbang.h:176:52: required from 'static void AVRSoftwareSPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED>::writeBit(uint8_t, AVRSoftwareSPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED>::clock_ptr_t, AVRSoftwareSPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED>::data_ptr_t, AVRSoftwareSPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED>::data_t, AVRSoftwareSPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED>::data_t, AVRSoftwareSPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED>::clock_t, AVRSoftwareSPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED>::clock_t) [with unsigned char BIT = 0u; unsigned char DATA_PIN = 23u; unsigned char CLOCK_PIN = 18u; unsigned int SPI_SPEED = 240000u; uint8_t = unsigned char; AVRSoftwareSPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED>::clock_ptr_t = volatile unsigned int*; AVRSoftwareSPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED>::data_ptr_t = volatile unsigned int*; AVRSoftwareSPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED>::data_t = unsigned int; AVRSoftwareSPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED>::clock_t = unsigned int]'

C:\Users\Robert\Documents\Arduino\libraries\FastLED/fastspi_bitbang.h:345:17: required from 'void AVRSoftwareSPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED>::writePixels(PixelController<RGB_ORDER>) [with unsigned char FLAGS = 128u; D = DATA_NOP; EOrder RGB_ORDER = (EOrder)136u; unsigned char DATA_PIN = 23u; unsigned char CLOCK_PIN = 18u; unsigned int SPI_SPEED = 240000u]'

C:\Users\Robert\Documents\Arduino\libraries\FastLED/chipsets.h:426:3: required from 'void SM16716Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_SPEED>::showPixels(PixelController<RGB_ORDER>&) [with unsigned char DATA_PIN = 23u; unsigned char CLOCK_PIN = 18u; EOrder RGB_ORDER = (EOrder)136u; unsigned int SPI_SPEED = 240000u]'

C:\Users\Robert\Desktop\sketch_feb25a\sketch_feb25a.ino:25:1: required from here

C:\Users\Robert\Documents\Arduino\libraries\FastLED/fastled_delay.h:101:31: fatal error: template instantiation depth exceeds maximum of 900 (use -ftemplate-depth= to increase the maximum)

FL_NOP; delaycycles();

I assume this is somehow related to setting the SPI_DATA_RATE parameter in the addLeds function. If you change the DATA_RATE_KHZ(1) to the resulting value directly (240000 in my case) it still does not compile. However if I set it to 1000 or omit it entirely it ends up compiling correctly.

@Naverritus

This comment has been minimized.

Copy link
Author

@Naverritus Naverritus commented Mar 3, 2020

I tried setting the -ftemplate-depth flag to something much larger (32768 for example) but it still produces the same issue.

@Naverritus

This comment has been minimized.

Copy link
Author

@Naverritus Naverritus commented Mar 3, 2020

Issue does not arise in version 3.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.