-->
Page 1 of 2

ESp12F USB-UART programming Issue [SOLVED]

PostPosted: Tue Mar 16, 2021 12:22 pm
by Julienlev
Hi all,
I would need your help because I spent hours looking for the solution but I am stuck.
since a few years I create multiple projects using esp8266 and esp32 nodemcu.
For one of these projects I decided to get rid of the dev board and to create a pcb where I will download directly the firmware to the esp12F.
On my pcb I put some 10K pull up resistors for: EN,IO0,Rst and pull down resistor on IO15.
I connect my pcb to the UART board connecting Rx -> TX, TX->RX, GND and 3.3V.
From the arduino serial monitor I can see that my esp goes into UART mode when I put GPIO0 to 0 and reset the board:
Code: Select allets Jan  8 2013,rst cause:2, boot mode:(1,7)

When I do a reset without GPIO0 at 0 I get:
Code: Select allets Jan  8 2013,rst cause:2, boot mode:(3,7)


I've checked with a nodemcu and the boot modes fits what i get doing the same.

My problem appears when I want to upload my firmware. If i don't go into UART mode I have the standard
Code: Select all....._____......_____....._____....____

This is normal, but when I put the ESP in UART mode it doesn't work and I get this message:
Code: Select allConnecting...
Traceback (most recent call last):
  File "D:\arduino\portable\packages\esp8266\hardware\esp8266\2.6.3/tools/upload.py", line 65, in <module>
    esptool.main(cmdline)
  File "D:/arduino/portable/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool\esptool.py", line 2900, in main
    print("Chip is %s" % (esp.get_chip_description()))
  File "D:/arduino/portable/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool\esptool.py", line 1034, in get_chip_description
    efuses = self.get_efuses()
  File "D:/arduino/portable/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool\esptool.py", line 1030, in get_efuses
    self.read_reg(0x3ff00054) << 32 |
  File "D:/arduino/portable/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool\esptool.py", line 490, in read_reg
    val, data = self.command(self.ESP_READ_REG, struct.pack('<I', addr))
  File "D:/arduino/portable/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool\esptool.py", line 347, in command
    p = self.read()
  File "D:/arduino/portable/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool\esptool.py", line 292, in read
    return next(self._slip_reader)
  File "D:/arduino/portable/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool\esptool.py", line 2045, in slip_reader
    raise FatalError("Timed out waiting for packet %s" % waiting_for)
esptool.FatalError: Timed out waiting for packet header
esptool.FatalError: Timed out waiting for packet header

esptool detect that the esp is in UART mode but then it doesn't upload the firmware and I don't understand why. I've trye setting the card as "nodemcu 1.0" and as "generic esp8266".

I've tried the same operation using Visual code and PlatformIO. It still doesn't work but the error message is different:
Code: Select allUploading .pio\build\nodemcuv2\firmware.bin
esptool.py v3.0
Serial port COM3
Connecting...
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: e8:68:e7:6e:59:f1
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Compressed 398880 bytes to 285665...

A fatal error occurred: Timed out waiting for packet header

I guess the problem is the same, I've also tied with board type nodemcu and generic esp8266...
I always get the same result.

I hope you will be able to help me, Thank you very much for your support

Re: ESp12F USB-UART programming Issue

PostPosted: Tue Mar 16, 2021 10:19 pm
by Julienlev
I did some test with an other raw esp12F, and I succesfully upload the blinky firmaware to it using arduinon IDE with nodemcu board or generic eps8266 configuration.
I've notice that before uploading the firmware the boot mode codes where (1,6) and (3,6) in the new esp where it was (1,7) and (3,7) on my pcb one.
I've alos noticed that the raw esp12F gave me some informations on the sdk when i reset it:

Code: Select alload 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
  SPI Speed      : 40MHz
  SPI Mode       : DIO
  SPI Flash Size & Map: 32Mbit(512KB+512KB)
jump to run user1 @ 1000

rf cal sector: 1017
rf[112] : 00
rf[113] : 00
rf[114] : 01

SDK ver: 1.5.4.1(39cb9a32) compiled @ Jul  1 2016 20:04:35
phy ver: 972, pp ver: 10.1


I am not able to see those informations on the one on my pcb... SO It seems that it cannot acces the SDk but I have no idea why... Maybe because it doesn't use the right memory ( the difference between 6 and 7 in the boot mode seems to be the used memory space..) but how to set this memory??

Re: ESp12F USB-UART programming Issue

PostPosted: Wed Mar 17, 2021 4:46 am
by QuickFix
Hmmmm, what have you done with GPIO2, you haven't left it floating have you?
And you are following the correct procedure to flash?
  • Keep GPIO15 LOW
  • Set GPIO0 LOW
  • Set RESET LOW
  • Set RESET HIGH
  • Set GPIO0 HIGH
  • Start flasher
Another often overlooked thing: you are supplying your project with ample power (enough current)?
You're aware that USB-UART convertors are not able to provide the current needed for the ESP to properly run?

Those are the things from the top of my head; it should normally work as expected.

Re: ESp12F USB-UART programming Issue

PostPosted: Wed Mar 17, 2021 5:26 am
by Julienlev
QuickFixn thank you for your answer.
GPIO2 is connected to an encoder PIN, it's always HIGHT except on a certain position of the encoder that block the esp startup (when GPIO2 is LOW).
The procedure to flash seems to work as i can see on the serial monitor with the boot code that it goes into "update" mode. "boot mode:(1,7)"
I tested to power up the esp from an other power supply but the result is the same.