Trinkey M0

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
romsk
 
Posts: 37
Joined: Sat Feb 23, 2019 5:01 pm

Trinkey M0

Post by romsk »

Hello,

I could not find a forum section for the Trinkey M0 so I went to this one because the Trinkey M0 is similar to the Trinket M0.

I have used about a dozen Trinket M0s with no problem over the years. Today I tried a Trinkey M0 for the first time and it will not show up the CircuitPy folder on my Computer drive window when I plug in the Trinkey M0 to a USB port. It did try to load drivers but my computer said the drivers failed to load.

The Trinkey M0 is running its demo program (I can see the four Neo Pixel LEDs changing colors and the Touch Pads are working to brighten/dim them). I can press the Reset Button twice and is does go to the Boot Loader (and TRINKEYBOOT shows up in my computer drive window).

Whenever I install a Trinket M0, the first thing I do is save the contents of CIRCUITPY and TRINKETBOOT to my PC for backup (to "restore" the device if I forget to Eject it before pulling it out of the USB port). I wanted to do the same thing for the Trinkey M0.

Since I was able to get to the TRINKEYBOOT to show up, I have saved those files for backup, but I can't get the CUIRCUITPY folder to show up - thus I can't cant make backup files for what is running on it - or let alone get to the main.py file.

I have corrupted Trinket M0s in the past, usually I just have to restore the TRINKETBOOT and CIRCUITPY areas from my backup. I tried that with the Trinkey M0 Boot backup I made, but I still can't get the CIRCUITPY folder to pop-up like is does for my Trinket M0's.

I even tried to put the Trinket M0 boot files (3 of them) in the TRINKEYBOOT folder, yes, the Pin Outs are different and I didn't expect the main.py to run (which it didn't), it was just an experiment to see if I could fix it, but again CIRCUITPY will not show up. I put the TRINKEYBOOT files back on it and the Trinkey M0 Demo is running.

I even tried removing the hardware drivers from my PC. I plugged the Trinkey M0 back in and the drivers started to load but they failed.

I have never had such are hard time with an Adafruit M0 device before. What am I missing/doing wrong.

Thanks.

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Trinkey M0

Post by dastels »

Have you tried installing the latest CircuitPython UF2?

It sounds like you have the Neo Trinkey - SAMD21. If so then the UF2 is at https://circuitpython.org/board/neopixel_trinkey_m0/

I don't see value in backing up the TRINKEYBOOT drive. All you'd need to do is recopy the appropriate UF2. Unlike CIRCUITPY, the BOOT drive doesn't have anything irreplaceable on it.

Dave

User avatar
romsk
 
Posts: 37
Joined: Sat Feb 23, 2019 5:01 pm

Re: Trinkey M0

Post by romsk »

Dave,

Thanks! Yes, I have the Neo Trinkey SAMD21. I called it the Trinkey M0 (to me they are same), sorry.

It came with a UF2 file (and 2 other files) in the TRINKEYBOOT drive. I will download the UF2 file you suggested from the web and try it tomorrow.

As far as making backup copies of the TRINKEYBOOT and CIRCUITPY drives, I do that just to have a copy of those areas as they were delivered out of the box (factory). They don't take a lot of disk space on my PC and since I usually change the main.py file for my own applications, I can put the device back to its factory condition if I ever give the device to someone. I remember reading to do this years ago when I used my first Trinket M0, it is now a habit for me. There was a time when I almost bricked a Trinket M0, I was fortunate that I had kept a copy of the UF2 file and the other two boot files (along with the Circuit Python files) at my finger tips because somehow one (or more) got corrupted. I always keep a copy of my modified main.py files on my PC, so in case of corruption, I never lose much of my code.

What does UF2 stand for?

Paul

User avatar
romsk
 
Posts: 37
Joined: Sat Feb 23, 2019 5:01 pm

Re: Trinkey M0

Post by romsk »

I downloaded version 7.3.3 of the UF2, renamed it to CURRENT.UF2 and put in the TRINKEYBOOT and the CIRCUITPY now shows up. It stated to install automatically. CircuitPython CDC Control shows 'No driver found' and CircuitPython Audio shows 'Failed'. Let me see if it working, at lease I can get to the main.py file now.

User avatar
romsk
 
Posts: 37
Joined: Sat Feb 23, 2019 5:01 pm

Re: Trinkey M0

Post by romsk »

Wierd, the demo program is no longer running. There is no main.py file (I guess it somehow got wiped out). There is a code.py file but it is empty. Does the Neo Trinkey use a code.py file instead of a main.py file.
I am going to write a simple main.py and see if I can pulse a pin, or look online for the demo program.

User avatar
romsk
 
Posts: 37
Joined: Sat Feb 23, 2019 5:01 pm

Re: Trinkey M0

Post by romsk »

Ok, I put the following code in a main.py file on put it in the CIRCUITPY area. Nothing, all 4 Neo Pixels flash Green about once every 5 seconds (the Neo Trinkey error indicator I guess). So I copied the code to the empty code.py file and the Neo Pixels stopped blinking. My scope is not handy so I will slow down the sleeps so I can watch the Touch Pad go high and low with my DMM. I will get back to you.

Thanks.

Code: Select all

import board
from digitalio import DigitalInOut, Direction
import time

Test = DigitalInOut(board.TOUCH1)
Test.direction = Direction.OUTPUT

while True:
  Test.value = 1
  time.sleep(1.0)
  Test.value = 0
  time.sleep(1.0)
  

User avatar
romsk
 
Posts: 37
Joined: Sat Feb 23, 2019 5:01 pm

Re: Trinkey M0

Post by romsk »

Dave,

Works fine... last long time!

Any idea on why Adafruit went to code.py on the Neo Trinkey rather than main.py like on the Ttinket M0?
in any case...

Now I can continue my project: My wife keeps burning through brush drive belts on her carpet cleaner. Adafruit and Digikey were both out of stock on the Trinket M0, but they had Neo Trinkey M0s in stock. I looked at the schematic and I saw the TOUCH1 and TOUCH2 Pads are on SAMD21 PA pins so I knew I could configure them as I/O. One Pad will monitor an IR detector LED for white marks passing by on the belt, and the other Pad will control a relay to shut off the Brush Motor if a mark does not pass by within a few milliseconds.

Since the Trinkey "lost" it's demo code in the UF2 update, do you know where I can find of copy of the CircuitPython code that the Neo Trinkey was running? I did find the Ardunio version (C/C++) but rather than port that back to CircuitPython, it would be easier just to grab the native demo code in CircuitPython.

Thanks,
Paul

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Trinkey M0

Post by dastels »

Whoa! Lots to catch up on!
I downloaded version 7.3.3 of the UF2, renamed it to CURRENT.UF2 and put in the TRINKEYBOOT and the CIRCUITPY now shows up.
Good, but there's no reason to rename it to CURRENT.UF2, that's just an artifact of how the bootloader works. Just copy the CircuitPython UF2 directly to the BOOT drive. That's all you need to concern yourself about with the BOOT drive, other than updating the bootloader. That's a fairly recent board so you should be fine wrt that.
CircuitPython CDC Control shows 'No driver found' and CircuitPython Audio shows 'Failed'
I have no idea what that means. CircuitPython CDC Control??

code.py and main.py are both supported. Only have one of them on the drive though. It search in a specific order and takes the first it finds. If you only have one, you'll always know what it's loading. My rule of thumb is to use code.py if my code is all in the one file, and main.py if I have multiple files.

The shipped demo code would appear to be in C++. See https://learn.adafruit.com/adafruit-neo ... no-example. Remember how you didn't have a CIRCUITPY drive at first. That's because CircuitPython wasn't installed. That C++ demo code was.

Dave

User avatar
romsk
 
Posts: 37
Joined: Sat Feb 23, 2019 5:01 pm

Re: Trinkey M0

Post by romsk »

Ok,
I will rename the CURRENT.UF2 file back to its original name. Yes. When I tried a main.py file I kept the empty code.py file in there and like you said, the bootloader found it first so it did nothing - lesson learned.

Ah ha! So it was not running Circuit Python out of the box. I brought up the Arduino IDE, set it to Neo Trinkey, but it still could not find it as a USB - until I updated the Bootloader. I will grab the C++ version and put it in my backup area with some notes on all that transpired.

Thanks for all the help. I hope this forum thread will help others.
Paul

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Trinkey M0

Post by dastels »

Don't rename CURRENT.UF2 on the boot drive. I'm not sure what that will do. That file just reflects the current;y installed firmware.

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Trinket ATTiny, Trinket M0”