Adafruit NeoTrellis M4

Just wondering if anyone anywhere is using this device with ??

There are some Library problems if I try and use one of the Adafruit code examples from their www … mostly around USBMIDI … but for my application, fortunately, I don’t need that.

I havent really analyzed exactly what is going on yet but basically I am finding all kinds of weirdness. For the moment, just trying to get something very simple to run.

initialize and light up a few neopixels thats all !!

The same thing compiles and runs just fine if I build it with Arduino 1.8.6 but I REALLY don’t want to have to go back to the Arduino toolchain to start building what might become a fairly complex app.

BTW I am running on OSX using VScode.

So what’s the exact problem? The same firmware code build in the Arduino IDE but doesn’t in PIO? Or it does compile but doesn’t run properly? What is the code, the platformio.ini, the working behavior and the non-working behavior?

So as I originally explained I havent really analysed the problem at all, not yet anyway.
The question is to find out whether this board is properly supported within platform IDE and if anyone else is having any problems with it.
At this moment I don’t have too much time to spend on sorting it out.

I tried running some of the Adafruit examples from github . e.g.

There are problems when pulling in the AdaFruit_NeoTrellisM4.h library as this links to many other libraries including MIDIUSB which complains mainly about USB endpoints either missing or duplicated. Right now I dont need USB or MIDI in any case so I have moved on to a MUCH more basic example !!

So code looks like this …

#include <Arduino.h>
#include <Adafruit_NeoPixel.h>

#define PIN 10

Adafruit_NeoPixel strip = Adafruit_NeoPixel(32, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();; // Initialize all pixels to 'off'

  //setup neopixel panel lights


void loop() {
//  // Some example procedures showing how to display to the pixels:
//  colorWipe(strip.Color(0, 0, 255), 20); // Blu
//  colorWipe(strip.Color(255, 0, 0), 20); // red
//  colorWipe(strip.Color(255, 0, 255), 20); // mag
//    colorWipe(strip.Color(0, 255, 0), 20); // grn
//  colorWipe(strip.Color(0, 255, 255), 20); // cyn
//  colorWipe(strip.Color(255, 255, 0), 20); // yel
//  colorWipe(strip.Color(255,255,255), 20); // White 
//  // Send a theater pixel chase in...
//  theaterChase(strip.Color(127, 127, 127), 50); // White
//  theaterChase(strip.Color(127, 0, 0), 50); // Red
//  theaterChase(strip.Color(0, 0, 127), 50); // Blue
//  rainbow(20);
//  rainbowCycle(20);
//  theaterChaseRainbow(50);

All this does is setup up a few lights … I have removed all of the fancy stuff from the main loop . [part of Adafruit demo]

my platform.ini looks like this …

; Please visit documentation for the other options and examples



platform = atmelsam

board = adafruit_trellis_m4

framework = arduino

upload_port = /dev/cu.usbmodem1441201

– And I have the Adafruit NeoPixel library installed locally

Basically compile is fine … no reported problems or complaints.
Upload seems to work but is a bit flakey as I have to reset the board first.
However result is Nothing works at all and the board goes offline so probably something missing somewhere.

As described EXACTLY the same code produces the expected result if compiled and uploaded from Arduino … upload is still a bit flakey though !!

1 Like

I dont mind working on this to get to the bottom of it but right now I have to get something very basic working in a few days just for a concept demo… I will probably just do it with Arduino for now.

In a couple of weeks I will have time in which case a few pointers or suggestions would be great !!!

Bump! I’m getting the same result. Does anybody have any solutions??

You’re having the exact same problem with the exact same board and the exact same code?

Yes! Pretty much…

Here is my platformio.ini:

platform = atmelsam
board = adafruit_trellis_m4
framework = arduino
lib_deps =
upload_port = /dev/cu.usbmodem14601

I have used the original file provided by Adafruit:

I have included the Arduino library, declared the functions and renamed the file to c++.

The code build and uploads without any errors. However, nothing happens on the board.

Without using platformio the .ino file runs fine.

What version of the Adafruit SAMD board package do you have instaled in the Arduino IDE? What versions of the library are being used in the Arduino IDE? What board and other settings have you selected in the Arduino IDE?

This seems huge. Are all these needed?

I have followed the instructions on these pages:

I’d rather have you double check this on your actual installation, as websites can get pretty outdated soon.

1 Like

So I added to the “Additional Boards Manager”

Boards installed:
1.8.6 Arduino SAMD Boards
1.5.11 Adafruit SAMD Boards

Libraries installed:
1.3.5 Adafruit NeoPixel
1.2.0 Adafruit DMA NeoPixel
1.1.2 Adafruit Unified Sensor
3.1.4 Adafruit SPIFlash
1.0.5 Adafruit Keypad
1.0.4 MIDI USB
1.2.0 ADXL343
1.2.1 NeoTrellis M4
1.2.3 SdFat - Adafruit Fork
1.3.1 Audio - Adafruit Fork

Selected board:
Adafruit Trellis M4 (SAMD51)

Selected port:

The only indication that something has gone wrong when using platformio is that when the code has been uploaded the board needs to be reset in order to upload something again. This does not happen in the arduino IDE.

The version included in PIO is 1.5.10. When you select thish version in the Arduino IDE and recompile, does the sketch still run?

Also are you seeing Serial.println()'s from the main loop in the serial monitor, indicating that the firmware is generally running?

If I rollback to 1.5.10 I get this error:
Invalid library found in /Users/james/Library/Arduino15/packages/adafruit/hardware/samd/1.5.10/libraries/CI_Tests: no headers files (.h) found in /Users/james/Library/Arduino15/packages/adafruit/hardware/samd/1.5.10/libraries/CI_Tests

Unlike Platformio, the file will not upload.

Doing some research this seems to be a problem with that particular version. I installed 1.5.9 and it works fine.

Serial.println()'s will not work when using Platformio.

That is the most basic thing that should work. Can you try a minimal firmware

#include <Arduino.h>

void setup() {

void loop() {
   static int i = 0;
   Serial.println("Test " + String(i));

? Maybe needs monitor_speed = 115200 in the platformio.ini. Is there no output?

Nope, minimal firmware / monitor_speed doesn’t work, it uploads but nothing is printed to serial.

Apparently you need the line

  while (!Serial);

after the Serial.begin() call to wait for initialization (ref). Does that make a difference?

Are you 100% sure you’ve selected the right serial? Can you check in the device manager whether a virtual COM port has appeared that looks like the Trellis M4?

After uploading with PIO once, are you still able to upload via the Arduino IDE? And does the same program yield serial output there?

I have added the serial while loop but that makes no difference.
When I check the device monitor the port is not found. Whenever I upload the code from platformio, I have to reset the device. If I upload the code using the arduino IDE I do not have to do this, the serial monitor works as expected.

Once I have reset the device I can view the device monitor but this show me nothing. If I run tail -f /dev/cu.usbmodem14601 I can also see that nothing has been printed to the serial monitor.

Well this is one shot in the dark before we have to go into deeper levels of debugging.

There is a difference in the build flags between PIO and Adafruit

It seems to be missing the very crucial -DCRYSTALLESS to make it start up on its internal oscillator instead of an external crystal oscillator.

Clock startup failure may also explain the “not resetting properly after flashing” behavior.

Can you retry the minimal Serial.println() one more time after adding

build_flags = -D CRYSTALLESS

in the platformio.ini?

Unfortuately, this has not worked either. Thanks for your help. What do you suggest the next step is?