Just wondering if anyone anywhere is using this device with Platform.io ??
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.
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();
strip.show(); // Initialize all pixels to 'off'
strip.setBrightness(100);
//setup neopixel panel lights
strip.setPixelColor(1,strip.Color(0,0,255));
strip.setPixelColor(2,strip.Color(255,0,0));
strip.setPixelColor(3,strip.Color(255,0,255));
strip.setPixelColor(4,strip.Color(0,255,0));
strip.setPixelColor(5,strip.Color(0,255,255));
strip.setPixelColor(6,strip.Color(255,255,0));
strip.setPixelColor(7,strip.Color(255,255,255));
strip.setPixelColor(9,strip.Color(0,0,255));
strip.setPixelColor(10,strip.Color(255,0,0));
strip.setPixelColor(11,strip.Color(255,0,255));
strip.setPixelColor(12,strip.Color(0,255,0));
strip.setPixelColor(13,strip.Color(0,255,255));
strip.setPixelColor(14,strip.Color(255,255,0));
strip.setPixelColor(15,strip.Color(255,255,255));
strip.show();
}
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
; https://docs.platformio.org/page/projectconf.html
[env:adafruit_trellis_m4]
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 !!
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 !!!
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?
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.
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.
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.