sg-wireless / pymakr-atom

Adds a REPL console to Atom that connects to your Pycom board. It can run code on the board or synchronize your project files.
Other
35 stars 11 forks source link

Error: Writing to COM port: Upload failed. Please reboot your device manually #65

Closed SpoofEx closed 4 years ago

SpoofEx commented 6 years ago

It seems I have a similar issue as discussed in with uploading the simplest project with only a main.py file containing print("Hello World"): afbeelding Current configuration: windows 10 1709 16299.125 atom 1.23.3 Pymakr 1.2.7

I moved back to Pymaker 1.1.0 as Smeedy suggested, but the communication via COM6 with the ESP directly hangs: afbeelding clicking on 'more' > 'Get serial ports' results in: afbeelding

However using ampy works fine to get things transported to the board and vice versa, but it would be much nicer if pymkr would work so that my workflow gets integrated.

bjoernbusch commented 6 years ago

I have a similar issue on MacOS where I can't upload changes.

screen shot 2018-02-01 at 18 11 13

I have to reset the flash and do a full load, which is quite annoying.

RalphHogenbirk commented 6 years ago

Hi @SpoofEx are you on the latest firmware? There have been a bunch of stability improvements between the firmware and pymakr in the last versions. Going back to 1.1.0 indeed also doesn't work for all firmware versions. Let me know if updating helps.

@bjoernbusch this happens on older boards that have less RAM. The current way of uploading takes a bit of memory, so if you are already using some memory it will run out. It will be solved in the next upcoming Atom + firmware release, where we'll put the board in safe boot automatically for each sync, if there is not enough memory available.

SpoofEx commented 6 years ago

@RalphHogenbirk isn't pymakr 1.2.7 the latest version? At least that is the one I find as the most actual in my atom installation if not how do I find the latest version?

bjoernbusch commented 6 years ago

Thanks for the clarification. How can I tell whether the board is older? Version, SerialNumber, etc?

RalphHogenbirk commented 6 years ago

@SpoofEx I'm talking about the firmware on the board itself. You can see the version using 'more -> get firmware version'. Update it using the firmware updater tool from https://pycom.io/downloads/. Firmware updates are coming rapidly and sometimes with important fixes, so it's a good thing to keep up to date :)

@bjoernbusch It's complicated, since all boards got an upgrade at some point. But you can see how much ram is avialable with os.getfree('/flash') (it returns Kb's). Try it after a safe boot or when you have no code running. If you get close to 4000Kb, it's a new board. Old boards should have about 96Kb available.

SpoofEx commented 6 years ago

@RalphHogenbirk I am using this ESP32 Board and flashed the firmware with the latest micropython firmware using the esptool.

RalphHogenbirk commented 6 years ago

@SpoofEx Aha, so not a Pycom board. The code we are using for the upload feature is partly dependent on the Pycom specific firmware, and will probably not work on just bare micropython. We're planning to rebuild the upload feature in Pymakr, after which it will likely also work on your board, but until then you'll have to revert to other upload methods like FTP or rshell.

EDIT You could even run our micropython fork on your board, but that doesn't work without some customisations on all hardware. Not my specialty though, and off topic here, but if you want to do that there is always someone on the pycom forum or github that could help out.

CodeManiac64 commented 6 years ago

I'm currently using Windows 10, and I can upload just fine to my PyTrack. But when I want to switch to PySense I encounter the same error as @SpoofEx. Anyone know why this is the case for only PySense and not for PyTrack? Could it be the pymakr 1.2.7 that cause the error? Everything is updated and am using the lastest versions. I've been able to upload before to both devices, this error happend just recently.

RalphHogenbirk commented 6 years ago

Guys, we've just released pymakr 1.2.8 that might be of use to some of you. First of all, it has a few bugfixes concerning the 'upload failed' error. For people having memory allocation issues when uploading code, it has a new option in the settings called 'safe boot before upload', which prevents this error. Only works with the latest firmware though, so be sure to upgrade.

Let me know if it helps any of you.

bjoernbusch commented 6 years ago

I just updated to the latest plugin and the latest FW (17), but when I enable the option in the global settings in only get: Safe boot not available for this version ()

Any hints?

CodeManiac64 commented 6 years ago

@bjoernbusch I had the same issue with uploading my code to my LoPy device. What I needed to do was manually doing a safe boot in order to be able to upload. The annoying thing is that if you decide to switch device, you'd have to do the manuall safe boot again... Have not yet found out why that's the case for me, nor how to fix it completely

RalphHogenbirk commented 6 years ago

Looking at the output you get @bjoernbusch, this must be a bug in Pymakr. Are you both on windows and using a LoPy1?

bjoernbusch commented 6 years ago

No, I'm on a Mac, but yes, it's a LoPy1.

RalphHogenbirk commented 6 years ago

Thanks. My suspicion is that this happens when asking for the version number already throws a memory exception. In any case, the error handling is not good at that point in the code. I'll come back to you on this after the weekend.

bjoernbusch commented 6 years ago

ok, so I updated to the latest version of everything and I still have the same issue. I could narrow it down to a file which is apparently causing the issue. In that file, I have a class defined, without any imports. When I add an import (I tried both pycom and struct), the file is uploaded properly. Is that a known issue / limitation?

RalphHogenbirk commented 6 years ago

@bjoernbusch still the "Safe boot not available for this version ()"? What error message does it throw when that one file fails to upload?

danspndl commented 6 years ago

Hi @bjoernbusch 👋 , could you update the issue? Are you still having problems? Note: the latest version of Atom is 1.28.1 and pymakr 1.4.0

njordan77 commented 5 years ago

having the same issue. ATOM+pymkr suck or i have no idea what i'm doing. COM connects but timeout when trying to upload a simple file. (LoPy Lora). after flashing with pycom firmware all is fine again for the first time....after that no upload at all.....

solving this issue would be highly appreciated! Thanks Norbert

RalphHogenbirk commented 5 years ago

@njordan77 Very likely a different issue than what's going on above. Can you create a new issue with some more information on which versions of pymakr, Atom and firmware you are using. A screenshot of the terminal this error happens would also help. We'll try to help you solve the issue asap!

pirate commented 5 years ago

I'm having this issue as well in VSCode. I don't think it's Atom-specific.

screen shot 2018-11-10 at 2 41 16 pm

It seems whatever program is uploaded first stays on the board and can't be interrupted for subsequent uploads.

RalphHogenbirk commented 5 years ago

Hi @pirate, in your case it looks like the safe boot doesn't work properly. Can you double check that by pressing ctrl-f before using the upload button? Ctrl-f should safe boot the device and the gps script you seem to be running should not start. If that doesn't happen, let me know what firmware version and hardware you are using. Worst case you might need to safe boot manually (connecting P12 to 3.3v and rebooting)

pirate commented 5 years ago

Thanks, I just managed to get it working by pressing the reset button for 12s, apologies if this was unrelated to the main issue.

prashanthmeda commented 5 years ago

@SpoofEx if you get a REPL prompt in Putty and can enter commands,. You have to disable flow control in the Putty serial interface settings. Try something like Ctrl-D, which should reboot the device. Then tyr Ctrl-B should show the firmware revision. Once >>> you get this option try entering any Python statement, like: print("Hello World") It worked for me