Page 1 of 1

can't connect to console, garbage characters - Now SOLVED

Posted: Thu Aug 20, 2020 1:56 pm
by dldirector
I can flash apparently without errors.
esptool.py v2.8
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP8285
Features: WiFi, Embedded Flash
Crystal is 26MHz
MAC: 2c:f4:32:e6:43:87
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 1MB
Compressed 272800 bytes to 200778...
Wrote 272800 bytes (200778 compressed) at 0x00000000 in 17.7 seconds (effective 123.2 kbit/s)...
Hash of data verified.
esptool.py --port /dev/ttyUSB0 erase_flash # works
esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash -fm dio --flash_size=detect 0 esp8266-20191220-v1.12.bin #works
screen /dev/ttyUSB0 115200 # CR doesn't work, garbage chars on reset, as if wrong baud rate

I have flashed a test program from Arduino IDE and used a serial monitor, that all works fine and I can see
the output on the serial monitor. So, the board works, the cable works, and I know the board is talking at 115200.
I even tried talking to micropython using serial monitor of Arduino IDE, the same garbage characters.
I tried flashing with several of the 1M builds. All same.

Any help would be greatly appreciated. I am very excited to use micropython.

Re: can't connect to console, garbage characters

Posted: Thu Aug 20, 2020 2:09 pm
by Roberthh
During boot the ESP8266 comes up with garbage characters, because the initial baud rate is 74880 baud. Once MP starts, it is set to 115200 baud. You could try setting the baud rate to 74880 baud and look at the boot message.
Edit: If screen cannot set that baud rate, try picocom. It supports now arbitrary baud rates,

Re: can't connect to console, garbage characters

Posted: Thu Aug 20, 2020 2:55 pm
by dldirector
Thanks for the quick response. I installed picocom, but get this.
$ picocom --b 74880 --d 8 --sto 1 --f n /dev/ttysUSB0
Invalid --baud: 74880
Run with '--help'.

Re: can't connect to console, garbage characters

Posted: Thu Aug 20, 2020 3:07 pm
by Roberthh
I'm using picocom v3.1 on debian. Maybe your version is different. Other option: if you have access to windows, you can use putty, which can be set to non-standard baud rates.
Edit: I see that you are using am ESP8285 with 1 MByte flash. That means you have to flash the stable build (like you did) or one of the daily build for 1 MByte flash. You may also search the forum for comments about using the esp8285.

Re: can't connect to console, garbage characters

Posted: Thu Aug 20, 2020 3:51 pm
by dldirector
Thanks again, I'll jump over to the Windows machine and try
putty at the weird baud rate.

Re: can't connect to console, garbage characters

Posted: Thu Aug 20, 2020 4:03 pm
by dldirector
Progress! Whith putty I can see the errors.
Any idea what this means?
ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 31256, room 16
tail 8
chksum 0xef
load 0x00000000, len 0, room 0
tail 0
chksum 0xef
load 0x00000000, len 0, room 8
tail 0
chksum 0xef
csum 0xef
csum err
ets_main.c

Re: can't connect to console, garbage characters

Posted: Thu Aug 20, 2020 4:45 pm
by Roberthh
No real indication of an error, beside this cryptic csum err.
As a blind shot, you could try another USB cable. It happened that people could upload code but not run the device. During uploading the power consumption is low, but when WiFi is started the current goes up substantially. Even if that is below the 500mA a USB port should supply, there can be problems with cables and/or connectors.

Re: can't connect to console, garbage characters - THE SOLUTION

Posted: Fri Aug 21, 2020 7:09 pm
by dldirector
Thanks to Roberthh for the first help with figuring out the baud rate problem.

After loading (or trying) micropython I just got garbage characters when I connected
at 115200. Roberthh pointed out that if the loader has messages that appear before
or instead of micropython, those messages are transmitted at 74880 baud.

That enabled me to see the checksum error indicating failed flashing.

I searched for the exact checksum error message and found this life-save posting.
https://github.com/esp8266/Arduino/issues/3753

It explains that some chipsets, apparently mine, require "-fm dout" a different
flashing method. Using that option with esptool the flashing worked and I
could connect at 115200 and interact with python REPL console.

Code: Select all

esptool.py  --port /dev/ttyUSB0  write_flash -fm dout --flash_size=detect 0 ~/Downloads/esp8266-1m-20200421-v1.12-388-g388d419ba.bin 
Here is the excerpt from the other forum.

Author
dilthings commented on Oct 24, 2017 •
@lrmoreno007 Thanks, for the marking convention diagram.

Now its working - details below
When I asked Itead if they have done anything to stop repurposing the devices their response was "You can refer to one customer method:https://github.com/arendst/Sonoff-Tasmota".

The link given provided useful information as below:

ATTENTION All versions

Only Flash Mode DOUT is supported. Do not use Flash Mode DIO / QIO / QOUT as it might seem to brick your device.

All this time I was using DIO/QIO as flash mode. As soon as I changed to DOUT, it all started WORKING :). Earlier I used the other flash modes on the previous versions of Sonoff and they worked fine.

Anyways simple wifi sketches DO work now. However the sketch I have developed to communicate with Azure IoTHub (which is working very stable on a older sonoff TH16) is crashing halfway with a lot of system related errors.... :(. I have opened another issue for that #3755. But for the time being Thanks for all who tried to help