I've been using the Trinket M0 without issues for years, but for this specific project, I'm having this strange bug I can't figure out.
I've written some code and uploaded it to a trinket running 3 LEDs with a button and power switch for this project. I have 20 units of these setups and have copied the "current.uf2" from the original to the rest of them instead of uploading from Arduino IDE. All of the coppies successfully uploaded and appeared to work exactly as intended so I lost track of the original unit. Then sometime later when I'd go to turn one of them on, sometimes the green power LED would light up like normal and they would flash their onboard RGB led a pinkish color for a brief moment before going out, but then the code would never start running so the LEDs remained off and they would no longer be recognized by my computer when they were plugged into it.
Once they go into this frozen state, cutting or returning the power does not fix them. The only way to get them working again is to double-click the reset button and re-upload the code to them. It seems to happen to all of them eventually. I have copied the "current.uf2" from one of the frozen ones and tried uploading it to another which causes it to freeze as well until you overwrite it with a working .uf2. It appears that the .uf2 is getting corrupted somehow maybe? Idk I'm pretty lost as to what's happening here.
Any ideas?
I attached the corrupted .uf2! Please let me know if there's any other information that would be helpful for me to include!
Here's the working one that somehow turns into the broken one.
Strange Trinket M0 Problem, Uf2 appears to change itself.
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- LivingSynthesis
- Posts: 32
- Joined: Thu Nov 16, 2017 1:22 am
- dastels
- Posts: 15820
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Strange Trinket M0 Problem, Uf2 appears to change itself
Well, they aren't identical:
Actually, that's just the first difference.
Dave
Code: Select all
>:cmp crashed7-1.UF2 Working.UF2
crashed7-1.UF2 Working.UF2 differ: byte 17953, line 142
Code: Select all
>:cmp --verbose crashed7-1.UF2 Working.UF2
17953 377 140
17954 377 15
17955 377 0
17956 377 40
17957 377 11
17958 377 113
17959 377 23
17960 377 265
17961 377 34
17962 377 150
17963 377 11
17964 377 113
17965 377 31
17966 377 150
17967 377 11
17968 377 113
17969 377 32
17970 377 150
17971 377 1
17972 377 253
17973 377 131
17974 377 160
17975 377 3
17976 377 41
17977 377 110
17978 377 103
17979 377 7
17980 377 111
17981 377 34
17982 377 160
17983 377 11
17984 377 30
17985 377 30
17986 377 0
17987 377 232
17988 377 160
17989 377 3
17990 377 360
17991 377 30
17992 377 371
17993 377 23
17994 377 275
17995 377 300
17996 377 106
...
- dastels
- Posts: 15820
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Strange Trinket M0 Problem, Uf2 appears to change itself
I guess my advice would be "don't do that" and flash the UF2 the proper way.
Dave
Dave
- LivingSynthesis
- Posts: 32
- Joined: Thu Nov 16, 2017 1:22 am
Re: Strange Trinket M0 Problem, Uf2 appears to change itself
I'll try switching to uploading through Arduino. I'll post if it works or not, but whenever I do this same project with a slightly older version of the same code I never experienced any crashes at all despite copying the .UF2 directly. The code is nearly identical and the changes are just a few extra variables so it doesn't really make sense why the older one seems to be immune to this corruption.
Also, how did you compare the 2 files? That would be super helpful to know!
Also, how did you compare the 2 files? That would be super helpful to know!
Last edited by LivingSynthesis on Fri Jul 02, 2021 2:00 pm, edited 1 time in total.
- LivingSynthesis
- Posts: 32
- Joined: Thu Nov 16, 2017 1:22 am
Re: Strange Trinket M0 Problem, Uf2 appears to change itself
Also, why wouldn't I be able to flash by dragging and dropping and appropriate .uf2? It clearly states on the website that I should be able to do this!
https://learn.adafruit.com/adafruit-tri ... v5EALw_wcB
"To flash something new, simply drag any UF2 onto the drive. After the file is finished copying, the bootloader will automatically restart."
Am I somehow doing this wrong?
https://learn.adafruit.com/adafruit-tri ... v5EALw_wcB
"To flash something new, simply drag any UF2 onto the drive. After the file is finished copying, the bootloader will automatically restart."
Am I somehow doing this wrong?
- dastels
- Posts: 15820
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Strange Trinket M0 Problem, Uf2 appears to change itself
I used the cmp command (Linux), as shown.
Yes, copying it to the boot drive is all there is to it. What I'm questioning is using CURRENT.UF2.
Dave
Yes, copying it to the boot drive is all there is to it. What I'm questioning is using CURRENT.UF2.
Dave
- LivingSynthesis
- Posts: 32
- Joined: Thu Nov 16, 2017 1:22 am
Re: Strange Trinket M0 Problem, Uf2 appears to change itself
Oh I see! I need to generate my .uf2 correctly, not copy it from another device. Oops lol
- LivingSynthesis
- Posts: 32
- Joined: Thu Nov 16, 2017 1:22 am
Re: Strange Trinket M0 Problem, Uf2 appears to change itself
So I found this uf2 tool but I can't figure out how I'm supposed to use it.
https://github.com/Microsoft/uf2-samdx1
Is there any way to generate a uf2 using Arduino IDE instead? Or any other way to make one? I think that's why I ended up copying it from the current.uf2 originally. I also found a video of lady Ada using the current.uf2 as a backup, but why can't this also be used for updating different identical boards?
https://github.com/Microsoft/uf2-samdx1
Is there any way to generate a uf2 using Arduino IDE instead? Or any other way to make one? I think that's why I ended up copying it from the current.uf2 originally. I also found a video of lady Ada using the current.uf2 as a backup, but why can't this also be used for updating different identical boards?
- LivingSynthesis
- Posts: 32
- Joined: Thu Nov 16, 2017 1:22 am
Re: Strange Trinket M0 Problem, Uf2 appears to change itself
Okay so I tried uploading the code from Arduino IDE directly and one of the trinkets froze almost immediately. Re-uploading fixed it and it has yet to crash again, so now I'm really confused but I guess that means it wasn't the upload method causing the freeze?
Please be positive and constructive with your questions and comments.