0

LEDs not working with M0
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: LEDs not working with M0

by batman189 on Fri Jun 14, 2019 1:02 am

There has to be something I am doing wrong, but it still does not work. The light logo does light up when plugged in, but does not cycle the colors. The board selected is the arduino M0 (no adafruit option) and I am uploading the code you sent. after about 30 seconds I did the safely remove hardware, unplugged it from the USB port, and then replugged it. When I plugged it back it in the lights came back on as they always are, a green light by the USB port and a purpleish light for the dotstar.

batman189
 
Posts: 20
Joined: Sun Jun 02, 2019 9:37 pm

Re: LEDs not working with M0

by XRAD on Fri Jun 14, 2019 7:14 am

Ahh. Thought you already had the correct libraries! You need to load the correct adafruit boards libraries to the arduino IDE. Then you can select the correct 'Adafruit Trinket M0'. You can't just plug in certain Adafruit (and other's ) boards to the arduino IDE because it will not recognize them

read about it here. Follow the exact instructions loading the specific arduino files followed by the adafruit boards libraries:
https://learn.adafruit.com/add-boards-a ... 4/overview


You should then be able to see a list of Adafruit boards (all the feathers, trinkets, etc with the M0 and other hardware) in the arduino IDE drop down menu! (example image below from the above link learning pages). Also make sure you are using the correct 'port' and 'programmer.'

flora_Screen_Shot_2015-05-07_at_9.46.56_AM.png
flora_Screen_Shot_2015-05-07_at_9.46.56_AM.png (379.65 KiB) Viewed 177 times



This is the general concept for all third party boards. So that if you use other 'non-arduino' hardware, you may also have to add the associated library to the arduino IDE.

Additionally, you may also in a similar fashion, have to add libraries (such as the adafruit dotstar library described above) in order to run certain programs. These libraries are the database from which the compiler compiles the program. Once you get the hang of it, it becomes second nature and then you can really start to have fun with low level programming!

XRAD
 
Posts: 475
Joined: Sat Nov 19, 2016 3:28 pm

Re: LEDs not working with M0

by batman189 on Fri Jun 14, 2019 6:58 pm

Capture1.PNG
Board info
Capture1.PNG (85.42 KiB) Viewed 167 times
Capture.PNG
Not selectable
Capture.PNG (80.22 KiB) Viewed 167 times
Untitled.png
Proper library installed
Untitled.png (438.04 KiB) Viewed 167 times


Uninstalled and reinstalled the Arduino software and reimported the boards. I have the first screenshot showing that it is installed. The second shot shows that it is greyed out and not letting me select the installed boards. The open folder to the right is the M0 trinket, so it is being recognized by the computer.

The last screenshot shows what it says when I selected the 'Get board' option.

batman189
 
Posts: 20
Joined: Sun Jun 02, 2019 9:37 pm

Re: LEDs not working with M0

by batman189 on Fri Jun 14, 2019 7:02 pm

I also did get the dotstar library installed. Currently I just cant get the board to be recognized by the software program.
Attachments
Capture2.PNG
Capture2.PNG (83.82 KiB) Viewed 167 times

batman189
 
Posts: 20
Joined: Sun Jun 02, 2019 9:37 pm

Re: LEDs not working with M0

by franklin97355 on Fri Jun 14, 2019 7:07 pm

But have you installed the Arduino SAMD and Adafruit SAMD board files yet? Your picture shows you are trying to compile for the Uno rather than the M0.

franklin97355
 
Posts: 20986
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: LEDs not working with M0

by batman189 on Fri Jun 14, 2019 7:54 pm

Arduino: 1.8.9 (Windows 10), Board: "Adafruit Trinket M0, Arduino"

Build options changed, rebuilding all
C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:408:6: error: 'SERCOM4' was not declared in this scope

{ &SERCOM4->SPI.DATA.reg, SERCOM4_DMAC_ID_TX, SERCOM4_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:408:29: error: 'SERCOM4_DMAC_ID_TX' was not declared in this scope

{ &SERCOM4->SPI.DATA.reg, SERCOM4_DMAC_ID_TX, SERCOM4_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:408:49: error: 'SERCOM4_DMAC_ID_RX' was not declared in this scope

{ &SERCOM4->SPI.DATA.reg, SERCOM4_DMAC_ID_TX, SERCOM4_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:409:6: error: 'SERCOM5' was not declared in this scope

{ &SERCOM5->SPI.DATA.reg, SERCOM5_DMAC_ID_TX, SERCOM5_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:409:29: error: 'SERCOM5_DMAC_ID_TX' was not declared in this scope

{ &SERCOM5->SPI.DATA.reg, SERCOM5_DMAC_ID_TX, SERCOM5_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:409:49: error: 'SERCOM5_DMAC_ID_RX' was not declared in this scope

{ &SERCOM5->SPI.DATA.reg, SERCOM5_DMAC_ID_TX, SERCOM5_DMAC_ID_RX },

^

exit status 1
Error compiling for board Adafruit Trinket M0.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


I got the board showing now as Adafruit Trinket M0 and this is the error I get when I try to compile the code you provided.

batman189
 
Posts: 20
Joined: Sun Jun 02, 2019 9:37 pm

Re: LEDs not working with M0

by batman189 on Sat Jun 15, 2019 2:00 am

So I got the trinket reset and I started over. I have it in the arduino IDE, board set to Adafruit Trinket M0. I open the main.py file in the IDE. Paste the code you provided. Click on Verify and it has no errors. I click Upload and it reboots the trinket to older firmware and relables it Trinketboot. I have to drag and drop the new circuitpyt file to reset it back. The error it gives is:

Arduino: 1.8.9 (Windows 10), Board: "Adafruit Trinket M0, TinyUSB"

Sketch uses 14512 bytes (5%) of program storage space. Maximum is 262144 bytes.
java.io.IOException: Cannot run program "{runtime.tools.bossac-1.7.0.path}/bossac": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:26)
at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:129)
at cc.arduino.packages.uploaders.SerialUploader.runCommand(SerialUploader.java:383)
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:197)
at cc.arduino.UploaderUtils.upload(UploaderUtils.java:77)
at processing.app.SketchController.upload(SketchController.java:732)
at processing.app.SketchController.exportApplet(SketchController.java:703)
at processing.app.Editor$UploadHandler.run(Editor.java:2070)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 9 more
An error occurred while uploading the sketch

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

batman189
 
Posts: 20
Joined: Sun Jun 02, 2019 9:37 pm

Re: LEDs not working with M0

by XRAD on Sat Jun 15, 2019 2:36 pm

maybe there is some confusion in 'code.' The dotstar C++ code I provided is uploaded via the arduino IDE using the 'upload' arrow on the IDE toolbar. Drag and drop into pyfile on trinket is for python code. Two different things.

Make sure you are using AVR ISP programmer, not tinyUSB (for older style trinkets).

If all SAMD arduino and adafruit boards loaded correctly, and you see trinket M0 in IDE drop down menu then good so far. Choose the trinket M0 from the drop down menu. This tells the compiler what board you have and how to prepare the program you are about to upload. Hit the check button to test compile. If all OK, then before uploading, You really need to see the trinket on a 'port,' like below (not sure why you can't see it....?); Once on a 'port,' then try to upload the C++ dotstar sketch using the arduino 'Upload' arrow..........

and you can post your code AND errors into code tags, makes for easier reading:
Code: Select all | TOGGLE FULL SIZE
put stuff here...



DOT BOARD.JPG
DOT BOARD.JPG (222.11 KiB) Viewed 128 times


DOT PORT.JPG
DOT PORT.JPG (91.24 KiB) Viewed 130 times
Last edited by XRAD on Sat Jun 15, 2019 2:51 pm, edited 2 times in total.

XRAD
 
Posts: 475
Joined: Sat Nov 19, 2016 3:28 pm

Re: LEDs not working with M0

by batman189 on Sat Jun 15, 2019 2:49 pm

Capture.PNG
Capture.PNG (39.62 KiB) Viewed 128 times
That helps quite a bit.
My settings are shown below. I copied your code into the editor, clicked the check mark for verify, and the error is below.

My new error code is

Arduino: 1.8.9 (Windows 10), Board: "Adafruit Trinket M0, Arduino"

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:408:6: error: 'SERCOM4' was not declared in this scope

{ &SERCOM4->SPI.DATA.reg, SERCOM4_DMAC_ID_TX, SERCOM4_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:408:29: error: 'SERCOM4_DMAC_ID_TX' was not declared in this scope

{ &SERCOM4->SPI.DATA.reg, SERCOM4_DMAC_ID_TX, SERCOM4_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:408:49: error: 'SERCOM4_DMAC_ID_RX' was not declared in this scope

{ &SERCOM4->SPI.DATA.reg, SERCOM4_DMAC_ID_TX, SERCOM4_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:409:6: error: 'SERCOM5' was not declared in this scope

{ &SERCOM5->SPI.DATA.reg, SERCOM5_DMAC_ID_TX, SERCOM5_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:409:29: error: 'SERCOM5_DMAC_ID_TX' was not declared in this scope

{ &SERCOM5->SPI.DATA.reg, SERCOM5_DMAC_ID_TX, SERCOM5_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:409:49: error: 'SERCOM5_DMAC_ID_RX' was not declared in this scope

{ &SERCOM5->SPI.DATA.reg, SERCOM5_DMAC_ID_TX, SERCOM5_DMAC_ID_RX },

^

exit status 1
Error compiling for board Adafruit Trinket M0.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Attachments
Untitled.png
Untitled.png (454.06 KiB) Viewed 128 times

batman189
 
Posts: 20
Joined: Sun Jun 02, 2019 9:37 pm

Re: LEDs not working with M0

by XRAD on Sat Jun 15, 2019 2:58 pm

try:

Bootloader Launching
For most other AVRs, clicking reset while plugged into USB will launch the bootloader manually, the bootloader will time out after a few seconds. For the M0/M4, you'll need to double click the button. You will see a pulsing red LED to let you know you're in bootloader mode. Once in that mode, it wont time out! Click reset again if you want to go back to launching code.

and you should only see these files below on TRINKETBOOT . If yes, then check your port connection (because it may disconnect and reconnect to another port) and try to load the C++ sketch.
Attachments
TRINKBOOT.JPG
TRINKBOOT.JPG (42.42 KiB) Viewed 127 times

XRAD
 
Posts: 475
Joined: Sat Nov 19, 2016 3:28 pm

Re: LEDs not working with M0

by batman189 on Sat Jun 15, 2019 3:29 pm

I appreciate the time you are taking to help me!

Do I need to do something special for naming the file? just copy and pasted your code and still get the same error message
Capture.PNG
Capture.PNG (203.99 KiB) Viewed 124 times

batman189
 
Posts: 20
Joined: Sun Jun 02, 2019 9:37 pm

Re: LEDs not working with M0

by XRAD on Sat Jun 15, 2019 3:47 pm

No problem Batman. Yep, that looks good on the TRINKETBOOT. Maybe something corrupted in the serial com files...... I have seen this issue/error before but do not remember what the fix/issue/patch was (or if this is even the issue?? or a version change??). Don't give up. Hopefully, someone else will jump in and guide you ....

What programmer are you using? AVR ISP ? Try the Arduino ISP, too..... both should work (actually, the atmel ones should work too)

here is some reading on Sercoms which is interesting:
https://learn.adafruit.com/using-atsamd ... s?view=all

XRAD
 
Posts: 475
Joined: Sat Nov 19, 2016 3:28 pm

Re: LEDs not working with M0

by batman189 on Sat Jun 15, 2019 4:00 pm

I tried both programmers you mentioned, but the same result. Thanks for taking so much time to help me though, I really do appreciate it. At this point would a new trinket be a good idea? I dont mind rebuying a trinket since they are cheap. I just would rather not buy new LEDs. I will try this whole set up on another PC today just to try.

batman189
 
Posts: 20
Joined: Sun Jun 02, 2019 9:37 pm

Re: LEDs not working with M0

by adafruit2 on Sat Jun 15, 2019 5:14 pm

please try uninstalling the adafruit SAMD core and going thru the guide again. its a SAMD chip not an AVR chip

adafruit2
Site Admin
 
Posts: 18599
Joined: Fri Mar 11, 2005 7:36 pm

Re: LEDs not working with M0

by batman189 on Sat Jun 15, 2019 6:17 pm

Capture.PNG
Capture.PNG (23.67 KiB) Viewed 101 times

I uninstalled the Arduino IDE and deleted all files so I could reinstall and start fresh.

I installed the Adafruit SAMD boards. Selected the Trinket M0 as my board.
I have tried both TinyUSB and Arduino as my USB stack option
I have tried multiple programmers.

When I Copy the code into the IDE and click verify, I get:

Arduino: 1.8.9 (Windows 10), Board: "Adafruit Trinket M0, Arduino"

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:408:6: error: 'SERCOM4' was not declared in this scope

{ &SERCOM4->SPI.DATA.reg, SERCOM4_DMAC_ID_TX, SERCOM4_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:408:29: error: 'SERCOM4_DMAC_ID_TX' was not declared in this scope

{ &SERCOM4->SPI.DATA.reg, SERCOM4_DMAC_ID_TX, SERCOM4_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:408:49: error: 'SERCOM4_DMAC_ID_RX' was not declared in this scope

{ &SERCOM4->SPI.DATA.reg, SERCOM4_DMAC_ID_TX, SERCOM4_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:409:6: error: 'SERCOM5' was not declared in this scope

{ &SERCOM5->SPI.DATA.reg, SERCOM5_DMAC_ID_TX, SERCOM5_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:409:29: error: 'SERCOM5_DMAC_ID_TX' was not declared in this scope

{ &SERCOM5->SPI.DATA.reg, SERCOM5_DMAC_ID_TX, SERCOM5_DMAC_ID_RX },

^

C:\Users\andre\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.5.0\libraries\SPI\SPI.cpp:409:49: error: 'SERCOM5_DMAC_ID_RX' was not declared in this scope

{ &SERCOM5->SPI.DATA.reg, SERCOM5_DMAC_ID_TX, SERCOM5_DMAC_ID_RX },

^

exit status 1
Error compiling for board Adafruit Trinket M0.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

batman189
 
Posts: 20
Joined: Sun Jun 02, 2019 9:37 pm

Please be positive and constructive with your questions and comments.