Page 1 of 1
ampy not working after main.py is uploaded
Posted: Thu Apr 09, 2020 6:33 pm
by MicroNinja
I have uploaded a main.py file. Whenever I press the reset button the the code is run again. But I cannot make any changes since the unit is busy
ampy <any commands>
Code: Select all
serial.serialutil.SerialException: GetOverlappedResult failed (PermissionError(13, 'Access is denied.', None, 5))
So far I have to flash the unit to reset it to be able to upload a new main.py file. Is this expected or how can I work with micropython more seamless with the board?
Re: ampy not working after main.py is uploaded
Posted: Fri Apr 10, 2020 12:33 am
by bitninja
Obviously it is something in your main.py that is keeping the microcontroller busy.
Can you post your main.py?
Re: ampy not working after main.py is uploaded
Posted: Fri Apr 10, 2020 1:43 am
by dhylands
The error that you're showing means that the HOST serial port couldn't be opened.
So you need to either ensure that your permissions or correct, and/or exit from the terminal emulator that has the serial port open.
As far as I can tell, that particular error has absolutely nothing to do with main.py or anything else on the micropython board.
Re: ampy not working after main.py is uploaded
Posted: Fri Apr 10, 2020 3:12 am
by supersquirel500
dhylands seems to be correct. Might wanna check your user/group permissions for serial connections.
Another tip to try in case it is a problem with the board and not the PC: My ESP32-PICOKITd4 does the same thing when connected to IO (ie UART/SPI). To fix this, I disconnect all pins to the board, hit EN (button to reboot) and run ampy command again. It's always been much more responsive after this.
Re: ampy not working after main.py is uploaded
Posted: Fri Apr 10, 2020 6:06 am
by MicroNinja
Thank you guys for the suggestions. I am on a steep learning curve with microcontroller and micropython it seems.
I finally found the error!
I had connected the wire wrong to wake up the unit again so instead everything crashed. Once the wiring was resolved I was able to communicate with ampy again. Is there a way to stop a running script in the repl? If I connect to the unit with putty I cannot do anything. Ctrl + D, Ctrl + C or quit() is not registered at all. The sleep mode is sending it into an infinite loop I cannot stop