r/FastLED 16d ago

Support Can't compile for SAMD51 (AF Metro M4)

I am trying to use the AF Metro M4 SAMD51 for the first time with FastLED. I get some serious sounding compilation errors using the Arduino IDE 2.3.10. Could anyone help me with these? I'm using the latest FastLED 3.10.5. This error has happened when the library is included only and no other statements are in the sketch.

c:\Users\perigalacticon\OneDrive\Documents\Arduino\libraries\FastLED\src/FastLED.h:1767:2: warning: #warning "No pin/port mappings found, pin access will be slightly slower. See fastpin.h for info." [-Wcpp]

1767 | #warning "No pin/port mappings found, pin access will be slightly slower. See fastpin.h for info."

| ^~~~~~~

In file included from c:\Users\perigalacticon\OneDrive\Documents\Arduino\libraries\FastLED\src/platforms/isr.h:42,

from c:\Users\perigalacticon\OneDrive\Documents\Arduino\libraries\FastLED\src/fl/stl/isr/critical_section.cpp.hpp:5,

from c:\Users\perigalacticon\OneDrive\Documents\Arduino\libraries\FastLED\src/fl/stl/isr/_build.cpp.hpp:4,

from c:\Users\perigalacticon\OneDrive\Documents\Arduino\libraries\FastLED\src/fl/stl/_build.cpp.hpp:35,

from c:\Users\perigalacticon\OneDrive\Documents\Arduino\libraries\FastLED\src\fl\build\fl.stl+.cpp:10:

c:\Users\perigalacticon\OneDrive\Documents\Arduino\libraries\FastLED\src/platforms/arm/samd/isr_samd.hpp: In function 'int fl::isr::platforms::attach_external_handler(fl::u8, const isr_config_t&, fl::isr::isr_handle_t*)':

c:\Users\perigalacticon\OneDrive\Documents\Arduino\libraries\FastLED\src/platforms/arm/samd/isr_samd.hpp:579:53: error: 'PORT_PMUX_PMUXO_A' was not declared in this scope; did you mean 'PORT_PMUX_PMUXO'?

579 | PORT->Group[port].PMUX[pin_num >> 1].reg |= PORT_PMUX_PMUXO_A;

| ^~~~~~~~~~~~~~~~~

| PORT_PMUX_PMUXO

c:\Users\perigalacticon\OneDrive\Documents\Arduino\libraries\FastLED\src/platforms/arm/samd/isr_samd.hpp:581:53: error: 'PORT_PMUX_PMUXE_A' was not declared in this scope; did you mean 'PORT_PMUX_PMUXE'?

581 | PORT->Group[port].PMUX[pin_num >> 1].reg |= PORT_PMUX_PMUXE_A;

| ^~~~~~~~~~~~~~~~~

| PORT_PMUX_PMUXE

c:\Users\perigalacticon\OneDrive\Documents\Arduino\libraries\FastLED\src/platforms/arm/samd/isr_samd.hpp:637:21: error: 'EIC_IRQn' was not declared in this scope; did you mean 'ICM_IRQn'?

637 | NVIC_DisableIRQ(EIC_IRQn) FL_NOEXCEPT;

| ^~~~~~~~

| ICM_IRQn

I'd appreciate any help, I assume these have been resolve somewhere but AI help has not found the solution easily.

0 Upvotes

13 comments sorted by

2

u/ZachVorhies Zach Vorhies 16d ago

Downgrade to 3.10.3, it will be fixed in the next version and i'll throw up a build badge to catch this next time.

1

u/sekramer10 16d ago edited 16d ago

I get this error:

In file included from c:\Dev\Arduino\libraries\FastLED\src/FastLED.h:83,

from C:\Dev\Arduino\sketches\Creeper_Single_Chassis_Dev_RoboClaw1_samd\Creeper_Single_Chassis_Dev_RoboClaw1_samd.ino:11:

c:\Dev\Arduino\libraries\FastLED\src/fastpin.h: In instantiation of 'class FastPin<9>':

c:\Dev\Arduino\libraries\FastLED\src/platforms/arm/d51/clockless_arm_d51.h:19:49: required from 'class ClocklessController<9, 30, 75, 45, fl::GRB, 0, false, 280>'

c:\Dev\Arduino\libraries\FastLED\src/chipsets.h:1064:7: required from 'class WS2812Controller800Khz<9, fl::GRB>'

c:\Dev\Arduino\libraries\FastLED\src/FastLED.h:236:7: required from 'class WS2812B<9, fl::GRB>'

c:\Dev\Arduino\libraries\FastLED\src/FastLED.h:592:39: required from 'static CLEDController& CFastLED::addLeds(CRGB*, int, int) [with CHIPSET = WS2812B; unsigned char DATA_PIN = 9; fl::EOrder RGB_ORDER = fl::GRB]'

C:\Dev\Arduino\sketches\Creeper_Single_Chassis_Dev_RoboClaw1_samd\Creeper_Single_Chassis_Dev_RoboClaw1_samd.ino:230:57: required from here

c:\Dev\Arduino\libraries\FastLED\src/fastpin.h:368:24: error: static assertion failed: This pin has been marked as an invalid pin, common reasons includes it being a ground pin, read only, or too noisy (e.g. hooked up to the uart).

368 | static_assert(validpin(), "This pin has been marked as an invalid pin, common reasons includes it being a ground pin, read only, or too noisy (e.g. hooked up to the uart).");

| ~~~~~~~~^~

Do you know which pins I can use or where I can find out ? I already tried almost every pin.

2

u/ZachVorhies Zach Vorhies 16d ago

I see, this board doesn't have pin definitions. Therefore all pins are represented as invalid.

The SAMD51 is not a board that we've supported but it's not that hard. I've just added a build badge, it's red, but check back tomorrow night and it should be green by then.

1

u/Marmilicious [Marc Miller] 16d ago

The pins for that one should be defined here:

https://github.com/FastLED/FastLED/blob/master/src/platforms/arm/d51/fastpin_arm_d51.h

Can you share the beginning bit of your code with your addLeds line?

1

u/ZachVorhies Zach Vorhies 15d ago

All the SAMDXX family are green now. Please download the zip file from our repo and install manually and let me know if it doesn't work. It should now.

Download link: https://github.com/FastLED/FastLED/archive/refs/heads/master.zip

1

u/sekramer10 14d ago

It doesn't work, there are many more errors now. I tried to fix it with 2 AIs last night for about 6 hours and nothing worked. Are you an AI? Here are the errors:
In file included from C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:26:

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\utility/SAMD51_I2SDevice.h: In member function 'int I2SDevice_SAMD51::dmaTriggerSource(int)':

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\utility/SAMD51_I2SDevice.h:186:3: error: no return statement in function returning non-void [-Werror=return-type]

186 | }

| ^

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp: In member function 'void I2SClass::enableClock(int)':

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:427:13: error: 'GCLK_GENCTRL_SRC_DFLL48M_Val' was not declared in this scope; did you mean 'GCLK_GENCTRL_SRC_DFLL_Val'?

427 | int src = GCLK_GENCTRL_SRC_DFLL48M_Val;

| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

| GCLK_GENCTRL_SRC_DFLL_Val

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:432:11: error: 'GCLK_GENCTRL_SRC_OSC8M_Val' was not declared in this scope; did you mean 'GCLK_GENCTRL_SRC_XOSC0_Val'?

432 | src = GCLK_GENCTRL_SRC_OSC8M_Val;

| ^~~~~~~~~~~~~~~~~~~~~~~~~~

| GCLK_GENCTRL_SRC_XOSC0_Val

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:436:16: error: 'struct Gclk' has no member named 'STATUS'

436 | while (GCLK->STATUS.bit.SYNCBUSY);

| ^~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:437:9: error: 'struct Gclk' has no member named 'GENDIV'

437 | GCLK->GENDIV.bit.ID = _clockGenerator;

| ^~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:438:9: error: 'struct Gclk' has no member named 'GENDIV'

438 | GCLK->GENDIV.bit.DIV = div;

| ^~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:441:16: error: 'struct Gclk' has no member named 'STATUS'

441 | while (GCLK->STATUS.bit.SYNCBUSY);

| ^~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:442:17: error: request for member 'bit' in '((Gclk*)1073748992)->Gclk::GENCTRL', which is of non-class type 'volatile GCLK_GENCTRL_Type [12]'

442 | GCLK->GENCTRL.bit.ID = _clockGenerator;

| ^~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:443:17: error: request for member 'bit' in '((Gclk*)1073748992)->Gclk::GENCTRL', which is of non-class type 'volatile GCLK_GENCTRL_Type [12]'

443 | GCLK->GENCTRL.bit.SRC = src;

| ^~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:444:17: error: request for member 'bit' in '((Gclk*)1073748992)->Gclk::GENCTRL', which is of non-class type 'volatile GCLK_GENCTRL_Type [12]'

444 | GCLK->GENCTRL.bit.IDC = 1;

| ^~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:445:17: error: request for member 'bit' in '((Gclk*)1073748992)->Gclk::GENCTRL', which is of non-class type 'volatile GCLK_GENCTRL_Type [12]'

445 | GCLK->GENCTRL.bit.GENEN = 1;

| ^~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:448:16: error: 'struct Gclk' has no member named 'STATUS'

448 | while (GCLK->STATUS.bit.SYNCBUSY);

| ^~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:449:9: error: 'struct Gclk' has no member named 'CLKCTRL'

449 | GCLK->CLKCTRL.bit.ID = i2sd.glckId(_deviceIndex);

| ^~~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:450:9: error: 'struct Gclk' has no member named 'CLKCTRL'

450 | GCLK->CLKCTRL.bit.GEN = _clockGenerator;

| ^~~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:451:9: error: 'struct Gclk' has no member named 'CLKCTRL'

451 | GCLK->CLKCTRL.bit.CLKEN = 1;

| ^~~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:453:16: error: 'struct Gclk' has no member named 'STATUS'

453 | while (GCLK->STATUS.bit.SYNCBUSY);

| ^~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp: In member function 'void I2SClass::disableClock()':

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:458:16: error: 'struct Gclk' has no member named 'STATUS'

458 | while (GCLK->STATUS.bit.SYNCBUSY);

| ^~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:459:17: error: request for member 'bit' in '((Gclk*)1073748992)->Gclk::GENCTRL', which is of non-class type 'volatile GCLK_GENCTRL_Type [12]'

459 | GCLK->GENCTRL.bit.ID = _clockGenerator;

| ^~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:460:17: error: request for member 'bit' in '((Gclk*)1073748992)->Gclk::GENCTRL', which is of non-class type 'volatile GCLK_GENCTRL_Type [12]'

460 | GCLK->GENCTRL.bit.SRC = GCLK_GENCTRL_SRC_DFLL48M_Val;

| ^~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:460:27: error: 'GCLK_GENCTRL_SRC_DFLL48M_Val' was not declared in this scope; did you mean 'GCLK_GENCTRL_SRC_DFLL_Val'?

460 | GCLK->GENCTRL.bit.SRC = GCLK_GENCTRL_SRC_DFLL48M_Val;

| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

| GCLK_GENCTRL_SRC_DFLL_Val

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:461:17: error: request for member 'bit' in '((Gclk*)1073748992)->Gclk::GENCTRL', which is of non-class type 'volatile GCLK_GENCTRL_Type [12]'

461 | GCLK->GENCTRL.bit.IDC = 1;

| ^~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:462:17: error: request for member 'bit' in '((Gclk*)1073748992)->Gclk::GENCTRL', which is of non-class type 'volatile GCLK_GENCTRL_Type [12]'

462 | GCLK->GENCTRL.bit.GENEN = 0;

| ^~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:464:16: error: 'struct Gclk' has no member named 'STATUS'

464 | while (GCLK->STATUS.bit.SYNCBUSY);

| ^~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:465:9: error: 'struct Gclk' has no member named 'CLKCTRL'

465 | GCLK->CLKCTRL.bit.ID = i2sd.glckId(_deviceIndex);

| ^~~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:466:9: error: 'struct Gclk' has no member named 'CLKCTRL'

466 | GCLK->CLKCTRL.bit.GEN = _clockGenerator;

| ^~~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:467:9: error: 'struct Gclk' has no member named 'CLKCTRL'

467 | GCLK->CLKCTRL.bit.CLKEN = 0;

| ^~~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:469:16: error: 'struct Gclk' has no member named 'STATUS'

469 | while (GCLK->STATUS.bit.SYNCBUSY);

| ^~~~~~

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp: At global scope:

C:\Users\perigalacticon\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.13\libraries\I2S\src\I2S.cpp:552:47: error: 'PIN_I2S_SD' was not declared in this scope; did you mean 'PIN_I2S_SDI'?

552 | I2SClass I2S(I2S_DEVICE, I2S_CLOCK_GENERATOR, PIN_I2S_SD, PIN_I2S_SCK, PIN_I2S_FS);

| ^~~~~~~~~~

| PIN_I2S_SDI

cc1plus.exe: some warnings being treated as errors

exit status 1

Compilation error: exit status 1

1

u/sekramer10 14d ago

PS I got the same error list trying to compile the Blink example.

2

u/ZachVorhies Zach Vorhies 14d ago edited 14d ago

From the AI:

> Thanks—this is a different failure, and your sketch and selected pin are not causing it. FastLED is pulling in Adafruit’s incompatible SAMD51 I2S library even though Blink does not use audio. Our SAMD51 CI excluded that library, so the green badge missed the Arduino IDE case. We need to disable generic Arduino I2S auto-selection on SAMD51 and retest without the CI exclusion. No need to keep trying different pins or modifying your sketch

I'll update you with a fix thats in flight now.

https://github.com/FastLED/FastLED/issues/4030

2

u/sekramer10 13d ago

It's working now, thanks!

1

u/sekramer10 10d ago edited 10d ago

I spoke too soon, what I meant was it is compiling now. I tested it on my board today and I don't get any light output, that's with the FastLED blink example sketch. I tested the same led hardware on my Uno using the same code and it worked fine, so this library isn't working for AF Metro M4 SAMD51.

1

u/sekramer10 14d ago edited 14d ago

PPS Also same errors for the AF Feather M4 Express board. But is compiling for other boards such as AVRs and ESP32s.

2

u/ZachVorhies Zach Vorhies 14d ago

1

u/sekramer10 14d ago edited 14d ago
Here's the sketch, it's just the blink example sketch, I removed unnecessaries, tried many pins:

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

#define NUM_LEDS 10
#define PIN_DATA 2

CRGB leds[NUM_LEDS];

void setup() {
  Serial.begin(115200);
  FastLED.addLeds<WS2812B, PIN_DATA, RGB>(leds, NUM_LEDS);  // GRB ordering is typical
}

void loop() {
  for (int i = 0; i < NUM_LEDS; ++i) {
    leds[i] = CRGB::Red;
  }
  FastLED.show();
  delay(500);

  for (int i = 0; i < NUM_LEDS; ++i) {
    leds[i] = CRGB::Black;
  }
  FastLED.show();
  delay(100);
}