[w600] bad prompt with \r\r\n

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
bazooka07
Posts: 6
Joined: Wed Nov 03, 2021 3:45 pm

[w600] bad prompt with \r\r\n

Post by bazooka07 » Fri Nov 05, 2021 8:16 am

Hello,

I am trying to use the pyboard tool with an ESP-01W flashed with @roberthh firmware. It's not working. After hitting Ctrl-C, I can see the prompt returned by the board is wrong :

Code: Select all

jpierre@beelink:~/MicroPython/robert-hh/micropython$ tools/pyboard.py -d /dev/ttyUSB0 ls
b'\r\r\n>>> \r\r\n>>> \r\r\n>>> \r\r\n>>> \r\r\nraw REPL; CTRL-B to exit\r\r\n>'
I have to replace in the pyboard script the \r\n sequence by \r\r\n for working.
Same problem with rshell and ampy tools.

I suppose the \n caracter is replacing by \r\n somewhere in the firmware ( ports/w60x/hal/uart.c ? ). But I cant't fix that !

ESP-01W is like ESP-01S but with w600 chip and deepsleep is working
https://www.aliexpress.com/wholesale?ca ... xt=esp+01w

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: [w600] bad prompt with \r\r\n

Post by Roberthh » Fri Nov 05, 2021 10:20 am

I'll check that.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: [w600] bad prompt with \r\r\n

Post by Roberthh » Fri Nov 05, 2021 12:38 pm

So the issue is, that mp_hal_stdout_tx_strn_cooked(), which does a \n -> \r\n transformation calls mp_hal_stdout_tx_strn(), which calls the sendchar(), which also does a \n -> \r\n substitution. sendchar() is a part of the Winner Library. Fortunately in this case I had moved that already into the local file tree for another change. That allows to drop the substitution in sendchar. Doing that in mp_hal_stdout_tx_strn_cooked() is not feasible, because mp_hal_stdout_tx_strn() is expected to work transparent.
I will update the binaries today.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: [w600] bad prompt with \r\r\n

Post by Roberthh » Fri Nov 05, 2021 1:02 pm

Updated.

mpremote u0 ls

works now as expected. You may have noticed, that the images I prepare contain a few frozen utilities, like upysh.py and pye_mp.py. upysh.py is a set of Unix like commands. When imported with:

from upysh import *

you have file commands like ls, cat, mkdir, rm, ..

pye_mp is an editor. When impoert with:

from pye_mp import pye

You can use it to edit local files by calling:

pye(filename(s))

It supports the usual editing features using ctrl characters. Documentation is here https://github.com/robert-hh/Micropython-Editor

bazooka07
Posts: 6
Joined: Wed Nov 03, 2021 3:45 pm

Re: [w600] bad prompt with \r\r\n

Post by bazooka07 » Fri Nov 05, 2021 10:55 pm

That's working !
I have test with ESP-01W and W600-Pico from Wemos.
And the Ampy script from Adafruit is working.

The ftp server is a great idea. I can upload download and edit in-place with a ftp client (lftp) and edit script with my favorite editor (vim).

I have upload a wifi_config.py script to the board for auto-connexion on wifi.

Notice : if deepsleep is working with ESP-01W, we have not power saving. The consumption is the same idle or not.

Many thanks for your work.

Post Reply