Page 1 of 1

Flashing works, but then receiving garbage on serial connection with MicroPython on a ESP-01S S Series

Posted: Thu Jun 24, 2021 11:58 pm
by snake77
Hello everyone :)

Apparently I'm having a similar issue as viewtopic.php?f=16&t=10675

I have a few of the following boards: (Sorry for bad picture quality)

Image

I can successfully erase and write:

Code: Select all

$ esptool.py --baud 74880 write_flash --verify --flash_size=detect -fm dio 0 esp8266-512k-20210618-v1.16.bin 
esptool.py v3.1
Found 1 serial ports
Serial port /dev/ttyUSB0
Connecting........___
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: [redacted]
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 1MB
Flash will be erased from 0x00000000 to 0x00078fff...
Flash params set to 0x0220
Compressed 493352 bytes to 329372...
Wrote 493352 bytes (329372 compressed) at 0x00000000 in 45.1 seconds (effective 87.5 kbit/s)...
Hash of data verified.

Leaving...
Verifying just-written flash...
(This option is deprecated, flash contents are now always read back after flashing.)
Flash params set to 0x0220
Verifying 0x78728 (493352) bytes @ 0x00000000 in flash against esp8266-512k-20210618-v1.16.bin...
-- verify OK (digest matched)
Hard resetting via RTS pin...
Afterwards, I'm connecting with:

Code: Select all

screen /dev/ttyUSB0 115200
And this is what I get:

Code: Select all

rll��|�l�|�l�b|����r�b�b��nn�lnn���bp�lrlrlp�n��lbn�|�l�b��nn�l��l`�nnl�l`nr���n��``�n��b�nl���nn��lp�n�bn�|b��nn�l�l`�nnl`nr���n��`p�n�bn�|b��nn��l`�nnl`nr���n��`r��n��`r��nl�|��`�r�n�b�nbp
I repeat the flashing process and tried different settings:
  • Various baud rates 460800, 115200, 74880
  • With and without the -fm dio option
  • Image files for 1M and 512k flash esp8266-1m-20210618-v1.16.bin and esp8266-512k-20210618-v1.16.bin
Same outcome every time.

I have a few ESP-01S boards and they all show the same behavior. However, the same programming procedure works fine with other ESP8266 boards. So I guess something is special about the ESP-01S module?

Thanks :)

Re: Flashing works, but then receiving garbage on serial connection with MicroPython on a ESP-01S S Series

Posted: Fri Jun 25, 2021 7:09 am
by Christian Walther
The picture clearly shows a 26 MHz quartz, so it can’t be the 40 MHz issue. Any chance you could hook up an oscilloscope or logic analyzer to see what baud rate really comes out of the UART?

(Just to be sure, you connected with 74880 baud before resetting, so you should have seen the boot messages? Also, for me on macOS with a Silabs CP2104 USB-to-serial converter screen does not support 74880 baud, I use miniterm.py for that.)

Re: Flashing works, but then receiving garbage on serial connection with MicroPython on a ESP-01S S Series

Posted: Fri Jun 25, 2021 7:47 am
by davef
On my ESP-01S boards I have 10K pull-ups on RST,En, GPIO0 and GPIO2. RST is connected to En with a push button switch to ground.

I only used screen for a few days I would suggest installing rshell.

Mine are 1M units, you could try these two flash_write versions:

Code: Select all

6) sudo esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=1MB -fm dout 0x0 esp8266-1m-20200902-v1.13.bin
   try --baud 115200 if 460800 doesn't work

An alternative esptool write_flash command:
sudo esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --flash_size=detect 0 esp8266-1m-20200902-v1.13.bin

Re: Flashing works, but then receiving garbage on serial connection with MicroPython on a ESP-01S S Series

Posted: Sat Jun 26, 2021 8:04 pm
by snake77
Christian Walther wrote:
Fri Jun 25, 2021 7:09 am
Any chance you could hook up an oscilloscope or logic analyzer to see what baud rate really comes out of the UART?
Unfortunately no. I don't have this kind of equipment. :(
Christian Walther wrote:
Fri Jun 25, 2021 7:09 am
Just to be sure, you connected with 74880 baud before resetting, so you should have seen the boot messages?
I used 74880 baud for flashing, not for serial console. Sorry for the misunderstanding. I have edited the first post to clarify.
Christian Walther wrote:
Fri Jun 25, 2021 7:09 am
Also, for me on macOS with a Silabs CP2104 USB-to-serial converter screen does not support 74880 baud, I use miniterm.py for that.)
I tried miniterm but it didn't make a difference. Neither at 115200, nor at 74880.
davef wrote:
Fri Jun 25, 2021 7:47 am
On my ESP-01S boards I have 10K pull-ups on RST,En, GPIO0 and GPIO2. RST is connected to En with a push button switch to ground.
Yes, I think I have it the same way. I'm using the following schematic:

Image
davef wrote:
Fri Jun 25, 2021 7:47 am
Mine are 1M units, you could try these two flash_write versions:

Code: Select all

6) sudo esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=1MB -fm dout 0x0 esp8266-1m-20200902-v1.13.bin
   try --baud 115200 if 460800 doesn't work

An alternative esptool write_flash command:
sudo esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --flash_size=detect 0 esp8266-1m-20200902-v1.13.bin
I'll try those and report back. Thank you :)

Re: Flashing works, but then receiving garbage on serial connection with MicroPython on a ESP-01S S Series

Posted: Sat Jun 26, 2021 8:12 pm
by snake77
Oh wow :) This worked. The

Code: Select all

-fm dout
option made the difference. Thank you so much!!

Re: Flashing works, but then receiving garbage on serial connection with MicroPython on a ESP-01S S Series

Posted: Sat Aug 07, 2021 10:13 pm
by CaCO3
Followup, when looking on the 74880 baud startup, I see following:

Code: Select all

 ets Jan  8 2013,rst cause:2, boot mode:(3,2)

load 0x40100000, len 30736, room 16 
tail 0
chksum 0x47
load 0x3ffe8000, len 996, room 8 
tail 12
chksum 0x99
ho 0 tail 12 room 4
load 0x3ffe83f0, len 1064, room 12 
tail 12
chksum 0xaa
csum 0xaa
system param error, use last saved param!
rf_cal[0] !=0x05,is 0xD2
Which points me to https://github.com/espressif/esptool/issues/202 and https://github.com/micropython/micropython/issues/2335, specifically https://github.com/micropython/micropyt ... -520210822
So does MicroPython really not yet support 16MB flash?