jeelabs / esp-link

esp8266 wifi-serial bridge, outbound TCP, and arduino/AVR/LPC/NXP programmer
Other
2.82k stars 720 forks source link

esp8266 Boot Message with swapped UART #462

Open damiano94 opened 4 years ago

damiano94 commented 4 years ago

ESP-LINK version 3.0.14. ESP-12F with arduino pro mini, GPIO13 connected to TX of microcontroller, GPIO15 to RX. Configuration in web interface: UART pins: swapped, Debug log: off. After uploading firmware with Arduino IDE or after resetting ESP arduino is receiving boot message (I output to Serial everything that is received): uC Console:

Click to expand

I received: 

I received:  
I received: e
I received: t
I received: s
I received:  
I received: J
I received: a
I received: n
I received:  
I received:  
I received: 8
I received:  
I received: 2
I received: 0
I received: 1
I received: 3
I received: ,
I received: r
I received: s
I received: t
I received:  
I received: c
I received: a
I received: u
I received: s
I received: e
I received: :
I received: 2
I received: ,
I received:  
I received: b
I received: o
I received: o
I received: t
I received:  
I received: m
I received: o
I received: d
I received: e
I received: :
I received: (
I received: 3
I received: ,
I received: 7
I received: )
I received: 
I received: 

I received: 
I received: 

I received: l
I received: o
I received: a
I received: d
I received:  
I received: 0
I received: x
I received: 4
I received: 0
I received: 1
I received: 0
I received: 0


This boot message is transmitted with 115200 baud. Setting Debug log to UART0 or auto causes ESP-LINK to output debug log to arduino all the time (this is expected). UART1 setting is same as OFF. When I switch from UART1 to OFF I get this: uC Console:

Click to expand

I received: 7
I received: 2
I received: 7
I received: 0
I received: 6
I received: 1
I received: >
I received:  
I received: T
I received: u
I received: r
I received: n
I received: i
I received: n
I received: g
I received:  
I received: O
I received: F
I received: F
I received:  
I received: u
I received: a
I received: r
I received: t
I received:  
I received: l
I received: o
I received: g
I received: 
I received: 


Is it normal behavior? I think that this log messages about esp boot and about uart log turned off should't be transmited from esp-link to attached mcu.

edit I attached usb ttl converter to GPIO15 and this is what I get when I reset esp-link from web interface or by uploading firmware from Arduino IDE:


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

load 0x40100000, len 2408, room 16
tail 8
chksum 0xe5
load 0x3ffe8000, len 776, room 0
tail 8
chksum 0x84
load 0x3ffe8310, len 632, room 0
tail 8
chksum 0xd8
csum 0xd8

2nd boot version : 1.6
  SPI Speed      : 80MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 32Mbit(512KB+512KB)
jump to run user1 @ 1000
damiano94 commented 4 years ago

Anyone? Boot message transmitted on GPIO15 with normal baud? I was thinking that it's only sent to GPIO1 with 74880 baud. It's only transmitted on GPIO15 after ESP reset. So I think that esp8266 remembers that uart is swapped, what baud was set and it outputs boot message to GPIO15. Maybe swapping uart back before reset would fix this problem.

uzi18 commented 4 years ago

you can try to find if someone reported it already in issues

uzi18 commented 4 years ago

First of all you should check my latest build with some fixes, attached in one of latest issues. Some of registers are preserved on reboot, need to look into source code.

damiano94 commented 4 years ago

esp-link-v3.2.47.alpha.5-ga0d3bb3-dirty-Lucjan - this is latest?

uzi18 commented 4 years ago

yes, please try it :)

damiano94 commented 4 years ago

Ok, I flashed bootloader and user1 but same problems:

  1. Boot message on gpio15 when esp resets, only ~62 characters so I think that esp resets faster that arduino and it's overflowing arduino's receive buffer which size is 64 bytes.
  2. "727061> Turning OFF uart log" message transmitted on gpio15 when you switch debug log from UART1 to OFF.

Unfortunately I checked with logic analyzer and boot message is also transmited to GPIO2 so we cannot use UART1 to transmit to attached mcu.

Another problem on this alpha version, I cannot update using ota, after browsing to file user2.bin and clicking Update firmware button all I get is endlessly spinning circle and nothing happens, current partition is stil user1. But there is some debug output: Debug log:

Click to expand

xb1000 (id=2)
 42221> Flashing 0xb2000 (id=2)
 42310> Flashing 0xb3000 (id=2)
 42400> Flashing 0xb4000 (id=2)
 42507> Flashing 0xb5000 (id=2)
 42589> Flashing 0xb6000 (id=2)
 42677> Flashing 0xb7000 (id=2)
 42765> Flashing 0xb8000 (id=2)
 42849> Flashing 0xb9000 (id=2)
 42947> Flashing 0xba000 (id=2)
 43046> Flashing 0xbb000 (id=2)
 43151> Flashing 0xbc000 (id=2)
 43245> Flashing 0xbd000 (id=2)
 43328> Flashing 0xbe000 (id=2)
 43417> Flashing 0xbf000 (id=2)
 43505> Flashing 0xc0000 (id=2)
 43579> Flashing 0xc1000 (id=2)
 43637> Flashing 0xc2000 (id=2)
 43713> Flashing 0xc3000 (id=2)
 43808> Flashing 0xc4000 (id=2)
 43883> Flashing 0xc5000 (id=2)
 43947> Flashing 0xc6000 (id=2)
 44006> Flashing 0xc7000 (id=2)
 44105> Flashing 0xc8000 (id=2)
 44180> Flashing 0xc9000 (id=2)
 44247> Flashing 0xca000 (id=2)
 44338> Flashing 0xcb000 (id=2)
 44435> Flashing 0xcc000 (id=2)
 44494> HTTP GET /menu: 200, 62ms, h=12640
 44502> HTTP GET /log/dbg: 200, 68ms, h=13576
 44530> Flashing 0xcd000 (id=2)
 44638> Flashing 0xce000 (id=2)
 44699> Flashing 0xcf000 (id=2)
 44795> Flashing 0xd0000 (id=2)
 44863> Flashing 0xd1000 (id=2)
 44923> Flashing 0xd2000 (id=2)
 44991> Flashing 0xd3000 (id=2)
 45404> Flashing 0xd4000 (id=2)
 45477> Flashing 0xd5000 (id=2)
 45520> HTTP POST /flash/upload: 200, 8310ms, h=12336
 45734> HTTP GET /log/text: 200, 1217ms, h=15696
de-wolff commented 3 years ago

Boot message is a sent from the bootloader, boot_v1.x.bin. This bootloader is part of the ESP8266 NONOS_SDK. You cannot turn it off, without creating your own bootloader (with is out of the scope of this project)

uzi18 commented 3 years ago

intention after swapped mode is to not receive boot messages to your arduino after power up, but it looks like after esp reset swapped mode is preserved, it is esp cpu bug/feature

damiano94 commented 3 years ago

Can we turn off swapped mode before reset to fix this this esp cpu bug/feature? I think that this page should be updated: https://github.com/jeelabs/esp-link/blob/master/FLASHING.md because this part is wrong: "At boot time the esp8266 ROM outputs a boot message on UTXD, this can cause problems to the attached microcontroller. If you need to avoid this, you can configure esp-link to swap the uart pins. You should then connect the esp-12 module as follows and choose the "swap_uart" pin assignment in the esp-link web interface:" As I wrote boot message is transmitted on GPIO15 too after turning on swap_uart option. Maybe some ideas how to handle this boot messagess so they won't cause problem to the attached mcu. For now I wait 2s before initializing uart on atmega and syncing with ESP.

uzi18 commented 3 years ago

Are you using ELClient lib?