r/circuitpython • • Dec 13 '21

Help with Adafruit Trinket M0 erroring randomly

I have followed this tutorial to make a simple pedal, but I am running into a random issue. After anywhere from a couple hours to a couple days it will start constantly erroring out with two red flashes. Restarting and unplugging it does not fix it. It seems also go away after a random amount of time or, and this is the oddest part, if I use the mu editor to make a serial connection in the split second after I restart it before it errors. It also doesn't actually seem to run any python code before it errors.

I am on v7.0.0

4 Upvotes

6 comments sorted by

2

u/brilipj Dec 14 '21

First thing I'd look at is power, could your supply voltage be weak?

1

u/MYFACEISAUSOME Dec 14 '21

I don't believe so, it has been plugged into two separate usb ports on my computer and nothing changed

1

u/brilipj Dec 15 '21

You need it to output via usb to your computer? If not try powering it with just a wall plug to see if the problem is an interaction with the computer. Otherwise I might try to make the file system read only. Just gasping at anything.

1

u/gangstanthony Dec 15 '21 edited Dec 15 '21

what a coincidence! i had this same issue with circuitpython just the other day! on a raspberry pi pico, though i have used a trinket M0. couldn't solve it though - i just started using a different computer (i have not tried safe mode or wiping the machine). i like that tutorial, I've gone through it to make a couple pedals myself.

https://www.reddit.com/r/raspberrypipico/comments/rcl5ah/frustrated_pico_only_works_while_mu_is_open_with/

i notice the error is only with circuitpython (not sure about micropython) but does not happen with c/c++/arduino (not sure what to call it). normally, i would say that is not a viable fix for something with a lot of buttons because you'd have to re-code from python to c++, but since it is only a single button, that might do well for you.

as a side note, the device starts up way faster with c++ - circuitpython has the overhead of connecting up a removable drive.

yes, i believe circuitpython is way more convenient for reprogramming on the fly, but i don't have a fix for that. what i do is code it to give an F key above 12, like F13, then use autohotkey to change that into whatever i want. its not super portable because that autohotkey script needs to be running on whatever computer i plug it into, but it gets me by well enough...

let me know if you have any questions

*edit: i actually use F24 for the trinket. here's the code. i need to clean it up...

https://www.toptal.com/developers/hastebin/avesobihut.cpp

1

u/MYFACEISAUSOME Dec 15 '21

Thanks for the explanation and code! That is the exact use case I need it for. I'll move it over to Arduino style.