micropython / micropython-esp32

Old port of MicroPython to the ESP32 -- new port is at https://github.com/micropython/micropython
MIT License
673 stars 216 forks source link

Hard time to upload files with ampy and related sw #165

Closed Mat-Alm closed 4 years ago

Mat-Alm commented 7 years ago

Hi! I had build the last version (with correct idf version) and can get it booting ok. But I can't upload ant files to the device I already tried 2 distinct boards and most of the time I can't even list the files on the devices or read/write most of the times I get errors that it can't open raw repl. With esp8266 I get no problems at all with the same upload softwares

robert-hh commented 7 years ago

It look like the file system is corrupted. Please try to erase the flash with "make erase" and reload the firmware with "make deploy". P.S.: Question like this may also be asked at the MicroPython forum https://forum.micropython.org/. There is a special section for this ESP32 port, where you also can find hints.

0xDBFB7 commented 7 years ago

@Mat-Alm I also had the "can't open repl" problem when I had a terminal program connected to the port simultaneously; closing the serial terminal fixed the issue for me.

nickzoic commented 6 years ago

Can you connect to the REPL with miniterm.py or similar serial terminal program?

ThomasWaldmann commented 6 years ago

Not sure if it is it same issue than OP, but also having lots of pain with ampy.

Mostly, it does simply not work. Sometimes hangs for a long time, sometimes aborting with all sorts of exceptions. Sometimes it works.

What I found out is than it seems to stumble over the stuff the wifi subsystem outputs when connecting.

So, can the wifi log be silenced?

MrSurly commented 6 years ago

I feel I have to chime in here.

There's something about the WiFi subsystem that screws up the state of the UART RX ring buffers when it starts. I've had it happen in MicroPython, but it's not a MP problem. The C project I'm working on now has the same issue, and I've gone with the work-around of not starting Wifi until after I'm done using the UART.

To be clear: I do not mean that the WiFi logging is messing up the parsing of console output (though that can happen). What I mean is there's some sort of deep-seated bug in the IDF (or hardware?) that mucks up the UART when WiFi starts. Seems to be OK if the UART is basically idle, but if it's receiving data, it can get screwed up, and it remains screwed up until a restart.

ThomasWaldmann commented 6 years ago

@MrSurly ah, interesting. Now we have >= 2 problems. :-D

I added some debug code to the place where it throws the exception about the repl mode (and i just read some more bytes, not just the 2 that did not match). Then I saw it is the same stuff as seen on the serial console when initing the wifi.

ThomasWaldmann commented 6 years ago

So, how is everybody working with the esp32 (except the mentioned workaround of not starting the wifi, which is somehow not an option if one wants to develop/debug network apps)?

Is there something more reliable than ampy run / put to run code on the esp32 / upload code to it?

(I am rather new to ESP and micropython, started yesterday with esp32).

MrSurly commented 6 years ago

I just just https://github.com/nickzoic/mpy-utils, but it is slow (sorry @nickzoic).

nickzoic commented 6 years ago

I can make it slower ... :-)

Yeah, it is very limited. I have many pie-in-the-sky ideas for how we could improve this situation, but they're still fermentingOne big limit is the serial speed, but pushing that any higher tends to cause problems for users on breadboards.I was thinking of adding a "zmodem" like mode to the repl to simplify file transfers rather than the current repl-bashing approach. When mpy-watch works it works rather well, sending only the diffs. It is a more complicated beast though, so more prone to getting confused. I think the key to this is going to be, when in raw repl mode, to hook the error/log output which normally goes straight to the UART and either hide it or escape it in such a way that a raw repl client can not be confused by it. This is possible in esp idf and I've made some preliminary progress.

dpgeorge commented 6 years ago

So, can the wifi log be silenced?

I just merged #112 which added esp.osdebug(). You can now silence the logging using esp.osdebug(None).

nickzoic commented 6 years ago

OK, I'm going to add that into mpy-utils as the first thing it runs :-) What did you think about the idea of adding that to raw mode in general? Too weird?

dpgeorge commented 6 years ago

What did you think about the idea of adding that to raw mode in general?

It would make sense... but even getting into raw mode may not work if the debug messages are there.

PikWay commented 6 years ago

One of my painfull issues with ampy is solved with patch & setting osdebug to None. Thanks! It was with nested dirs - I was unable to rmdir from ampy (it was ending with error) when ESP was connected with STA_IF, os.listdir was showing that dir is gone, but when I was trying to put it again using ampy it was failing with EXISTS.

ghost commented 6 years ago

Seeing wifi in this thread - is there a way to get a REPL over wifi on the ESP32 with the official micro python firmware? (Or is it merely that wifi and uart interact in a way that may mess up REPL over serial).

BTW: REPL over wifi (telnet) works reliably with rshell and the loboris firmware. I have not noticed interaction between uart and wifi (though there are other bugs, and incompatibilities with "standard" micro python).

nickzoic commented 6 years ago

I have a telnet implementation in a branch: it's very minimal but works well, I don't know if that's something Damien would consider merging.

ghost commented 6 years ago

I'd love to try it! Where can I find it? And are there any instructions to use it?

Many thanks!!!

nickzoic commented 6 years ago

https://github.com/nickzoic/micropython-esp32/tree/esp32-rrepl but it's quite out of date now, I'll rebase it onto current master, uh, probably tomorrow.

ghost commented 6 years ago

Great. I’ll wait for the rebase.

Just out of curiosity - rrepl.c uses freertos & presumably creates a task for telnet.

Many thanks! Bernhard

On Tue, Dec 5, 2017 at 3:51 PM, Nick Moore notifications@github.com wrote:

https://github.com/nickzoic/micropython-esp32/tree/esp32-rrepl but it's quite out of date now, I'll rebase it onto current master, uh, probably tomorrow.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/micropython/micropython-esp32/issues/165#issuecomment-349480773, or mute the thread https://github.com/notifications/unsubscribe-auth/AC3bpKHCOaMPZBilFPILjAN02hztfYLUks5s9dbsgaJpZM4O7tHO .

Avi-TelnT commented 6 years ago

@nickzoic Thank you. Can you also offer how to embeded this module into https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo ?

ghost commented 6 years ago

I don’t think that’s needed as telnet is already part of loboris micropython.

Bernhard

On Wed, Dec 6, 2017 at 3:21 AM, Avi notifications@github.com wrote:

@nickzoic https://github.com/nickzoic Thank you. Can you also offer how to embeded this module into https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/micropython/micropython-esp32/issues/165#issuecomment-349610337, or mute the thread https://github.com/notifications/unsubscribe-auth/AC3bpFuB21MxTtg6O9Cno2BMzBZtlMyzks5s9ningaJpZM4O7tHO .

dpgeorge commented 4 years ago

It should be possible to use the "-f" flag to the latest pyboard.py script to access the filesystem on the esp32 over the serial/UART.