Skip to content

Adafruit M0 Express Built-in LED #736

Open

Description

@McCallisterMicro

I've been experimenting with an Adafruit Metro M0 Express board, and I'm having some trouble activating the built-in Neopixel on the board. The pixel is on pin 40. The code works fine when hooking up a strip externally - I tested on on Pin 7 and had no issue. I just can't seem to access the built-in Neopixel.

I tested the Adafruit Neopixel library and was able to get it to work using simliar code. I'm guessing it has something to do with how the board is defined, but that's a bit beyond my current coding understanding.

Here is my example code with the Adafruit library code commented out for comparison:


#include <Metro.h>
#include <FastLED.h>
//#include <Adafruit_NeoPixel.h>

uint8_t isLEDON;
Metro Ticker = Metro(100);
CRGB dot[1];
//Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, 40, NEO_GRB + NEO_KHZ800);

void setup()
{
	pinMode(13, OUTPUT);
	pinMode(40, OUTPUT);
	Serial.begin(115200);
	FastLED.addLeds<NEOPIXEL, 40>(dot, 1);
	//strip.begin();

}

void loop()
{
	if (Ticker.check())
	{
		digitalWrite(13, isLEDON ? HIGH : LOW);
		isLEDON = !isLEDON;
		FastLED.show();

	}
	dot[0] = CRGB::White;
	//strip.setPixelColor(0, 255, 255, 255);
	//strip.show();
}

Activity

  1. focalintent commented on Feb 14, 2019

    @focalintent
    Contributor

    the pin/port definition for pin40 might be wrong on that board (fastled uses its own mappings to go from pins to low level hardware registers) - i’ll have to see if i can dig up what it should be

  2. hiduino commented on Aug 29, 2019

    @hiduino

    There currently is no pin definitions for the ADAFRUIT_METRO_M0_EXPRESS as of FastLED v3.3.2.

  3. McCallisterMicro commented on Jan 1, 2021

    @McCallisterMicro
    Author

    By any chance, has this been addressed in release 3.4? If not; I think I may be able to assist, but I don't quite know where to start. If I could get some guidance on the files/directories where this is handled, I bet I could suss it out and add in the needed code.

  4. added
    area: core
    status: stale
    status: triage
    on Apr 16, 2026
  5. added
    deferred
    on Aug 1, 2026
  6. zackees commented on Aug 1, 2026

    @zackees
    Member

    Deferred by automated triage: Real, still-unfixed, and the mechanism is now identified. src/platforms/arm/d21/fastpin_arm_d21.h has explicit cases for CIRCUITPLAYGROUND_EXPRESS, HALLOWING, XIAO_M0, SEEED_ZERO, SODAQ_AUTONOMO, SAMD_WINO, MKR1000/MKRWIFI1010/MKRZERO, NANO_33_IOT, GEMMA_M0, TRINKET_M0, QTPY_M0, ITSYBITSY_M0, PIXELTRINKEY_M0 and a final ARDUINO_SAMD_ZERO fallback -- but NONE for ADAFRUIT_METRO_M0_EXPRESS (hiduino confirmed this in 2019 and it is still true). The Metro therefore falls through to the ARDUINO_SAMD_ZERO block, which DOES define pin 40 as _FL_DEFPIN(40, 6, 0) i.e. PA06 -- the Arduino Zero's pinout, not the Metro's. That explains the reported symptom exactly: no compile error (pin 40 is 'valid'), external strips on pin 7 work, but the built-in NeoPixel on pin 40 does nothing because FastLED is toggling the wrong pad. Confirms focalintent's 2019 hypothesis that 'the pin/port definition for pin 40 might be wrong on that board'. NOT FIXED HERE deliberately: the correct port/bit for the Metro M0 Express onboard NeoPixel has to come from Adafruit's variant.cpp/variant.h for that board and be verified on hardware. Guessing it would be worse than the status quo -- pin 40 currently maps to PA06, which may be a real signal on the Metro, so a wrong guess could drive an unintended pad rather than merely not working. There is no Metro M0 Express in CI, so nothing would catch a bad mapping. Contributor needs: the board's variant pin-40 port/bit, a _FL_DEFPIN block modeled on the ADAFRUIT_ITSYBITSY_M0 case at line 237, and a hardware check.

  7. zackees commented on Aug 1, 2026

    @zackees
    Member

    Marking deferred — still broken, and @focalintent's 2019 hypothesis turns out to be exactly right. Here's the mechanism.

    src/platforms/arm/d21/fastpin_arm_d21.h has explicit pin maps for a long list of SAMD21 boards — Circuit Playground Express, Hallowing, XIAO M0, Seeed Zero, SODAQ Autonomo, WINO, MKR1000/MKRWIFI1010/MKRZERO, Nano 33 IoT, Gemma M0, Trinket M0, QT Py M0, ItsyBitsy M0, PixelTrinkey M0 — and then a final ARDUINO_SAMD_ZERO fallback.

    There is still no ADAFRUIT_METRO_M0_EXPRESS case. @hiduino confirmed that in 2019 and it remains true.

    So the Metro falls through to the Zero block, which does define pin 40:

    _FL_DEFPIN(40, 6, 0);   // PA06 — the Arduino Zero's pin 40

    That accounts for your symptom precisely, including the confusing parts:

    • No compile error — pin 40 is "valid", so static_assert(validpin()) passes.
    • External strip on pin 7 works — that pin's mapping happens to be right.
    • Built-in NeoPixel does nothing — FastLED is toggling PA06, not the pad the onboard pixel is wired to.
    • Adafruit_NeoPixel works — it goes through the core's own pin table rather than FastLED's compile-time register mapping.

    Why I'm not just adding the mapping. The correct port/bit has to come from Adafruit's variant.cpp/variant.h for the Metro M0 Express and be checked on hardware. Guessing would be worse than the current bug: pin 40 presently resolves to PA06, which may well be a real signal on that board, so a wrong guess could drive an unintended pad instead of merely doing nothing. There's no Metro M0 Express in CI, so nothing would catch it.

    For anyone with the board — this is a genuinely small, well-scoped first contribution:

    1. Read pin 40's port and bit out of the Adafruit variant for metro_m0.
    2. Add an #elif defined(ADAFRUIT_METRO_M0_EXPRESS) block modeled on the ADAFRUIT_ITSYBITSY_M0 case at line 237 — note that one already handles a similar "onboard pixel on a high pin number" situation.
    3. Confirm the onboard NeoPixel lights before opening the PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coredeferredstatus: stalestatus: triage

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions