New to MicroPython, putty showing garbage chars

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Christian Walther
Posts: 169
Joined: Fri Aug 19, 2016 11:55 am

Re: New to MicroPython, putty showing garbage chars

Post by Christian Walther » Sat Jun 12, 2021 4:22 pm

mattyt wrote:
Sat Jun 12, 2021 1:55 am
the ESP32 briefly outputs data at 9600 baud at boot (before MicroPython starts).
Correction: the ESP8266 briefly outputs data at 74880 baud. (The ESP32 does not, it uses 115200 from the start.)

As others have mentioned, this looks like a baud rate mismatch. If you are 100% sure that you are receiving at 115200 (maybe try a different program or a different computer), that means that the ESP must be sending at a different rate than it thinks. (I don’t know if that is even possible.) What kind of board/module is this? Any weird overclocking setup?

As a wild guess, what happens when you receive at 115200*115200/74880 = 177230 baud?

Edit: Some googling suggests that this happens when you have a 40 MHz crystal instead of the usual 26 MHz and the firmware isn’t set up for it:
https://www.esp8266.com/viewtopic.php?f=13&t=12175
https://www.esp8266.com/viewtopic.php?f=13&t=8119

tonynsx
Posts: 43
Joined: Thu May 07, 2020 1:43 pm

Re: New to MicroPython, putty showing garbage chars

Post by tonynsx » Sat Jun 12, 2021 4:40 pm

This is what I have, and I had to download the chipset driver to my laptop so it will show up in device manager COM port. I'm using Putty. I tried baud rate but still same thing. I also tried XCTU instead of Putty, but still same thing. I'm a beginner and I can't even get the ESP8266 to work :(

https://learn.adafruit.com/adafruit-fea ... ah-esp8266

https://www.silabs.com/documents/public ... rivers.zip

Christian Walther
Posts: 169
Joined: Fri Aug 19, 2016 11:55 am

Re: New to MicroPython, putty showing garbage chars

Post by Christian Walther » Sat Jun 12, 2021 6:06 pm

Okay, then I don’t know what’s going on. These definitely shouldn’t behave like that. I have some of them right here, recently bought, and they work just fine with esp8266-20210418-v1.15.bin and don’t need any special flash mode either.

tonynsx
Posts: 43
Joined: Thu May 07, 2020 1:43 pm

Re: New to MicroPython, putty showing garbage chars

Post by tonynsx » Sat Jun 12, 2021 6:29 pm

ok thanks for taking a look. I can only assume its a power issue.

bitninja
Posts: 165
Joined: Thu Sep 15, 2016 4:09 pm
Location: Spring, Texas

Re: New to MicroPython, putty showing garbage chars

Post by bitninja » Sat Jun 12, 2021 11:45 pm

Sorry to hear you are having troubles mate...

The following advice might not help, since I essentially use the same hardware every time...

But just to make sure we didn't miss anything basic...

1. Are you erasing the flash first? I always do.

Code: Select all

esptool.py -p COM19 -c esp8266 -b 460800 erase_flash
2. Are you picking the right BIN for the amount of flash it has? They have different images based on flash size. Sometimes people don't notice that... I didn't at first... :oops: If you don't know then it's probably a 4MB module.

3. Have you tried other Flash Modes? It seems to cause some people an issue. I never use it.

Anyway, I just went through the steps again and was successful. It can work!

PM me if you want my screenshots of what I did.

Good luck!

tonynsx
Posts: 43
Joined: Thu May 07, 2020 1:43 pm

Re: New to MicroPython, putty showing garbage chars

Post by tonynsx » Sun Jun 13, 2021 12:01 am

Yes, I'm erasing the flash with esptool.py --port COM5 erase_flash. Am I supposed to press anything on the ESP8266 before or after erasing memory? I'm flashing using these 2 commands, but they I don't get any errors when flashing, but when I open COM5 with Putty, I see weird characters. And its unresponsive.

esptool.py --port COM5 --baud 460800 write_flash --flash_size=detect 0 esp8266-20210418-v1.15.bin

esptool.py --port COM5 --baud 460800 write_flash --flash_size=detect -fm dio 0 esp8266-20210418-v1.15.bin

I'm watching this YT video to see if I missed anything.
https://www.youtube.com/watch?v=j0hgKkwmSlw

tonynsx
Posts: 43
Joined: Thu May 07, 2020 1:43 pm

Re: New to MicroPython, putty showing garbage chars

Post by tonynsx » Sun Jun 13, 2021 12:07 am

I watched the YT video, and I have everything as on that YT video till the REPL / Putty is opened. In this YT video, it shows the Python prompt, but I'm getting gibberish. I really don't know if its something I'm doing wrong or if its the ESP8266

bitninja
Posts: 165
Joined: Thu Sep 15, 2016 4:09 pm
Location: Spring, Texas

Re: New to MicroPython, putty showing garbage chars

Post by bitninja » Sun Jun 13, 2021 12:08 am

First of all you only need to run ONE of those commands... not both. I suspect the flash mode may be the issue. Just run the first command alone and retry with putty.

tonynsx
Posts: 43
Joined: Thu May 07, 2020 1:43 pm

Re: New to MicroPython, putty showing garbage chars

Post by tonynsx » Sun Jun 13, 2021 12:15 am

I'm attaching my screenshots for reference, I downloaded and installed Silicon Labs CP210x USB to UART Bridge (COM 5)
https://www.silabs.com/developers/usb-t ... cp-drivers, the CP210x Universal Windows Driver

Erasing flash:

Image

Flashing firmware:

Image

Opening Putty at baud 15200, I get this, and when I type something its unresponsive.

Image

bitninja
Posts: 165
Joined: Thu Sep 15, 2016 4:09 pm
Location: Spring, Texas

Re: New to MicroPython, putty showing garbage chars

Post by bitninja » Sun Jun 13, 2021 12:21 am

I see you ran it with the -fm dio, do you get the same result without those parameters?

Honestly, it looks like a bad firmware image. What kind of board ESP8266 board do you have?

Post Reply