TTGO LoRa32 V2 Cannot upload - Timed out (tried many things)

Hi!

I own a TTGO LoRa Esp32 v2 and I am struggling to upload the new code (.bin). I treat it with really care. I was uploading and testing some codes and suddenly, it stop allowing me to upload new programs. The last program that I uploaded was OLED Hello World (shows different screens in the display: progress bar, hello world texts, etc)

The next time I tried to upload a program, it failed with timed out.

I have tried many different things and combinations of all of them:

  • usb ports
  • usb wires
  • 2 linux
  • windows
  • arduino ide
  • platformio
  • pressing the RST button (it doesn’t have boot)
  • changing the baud rate (upload speed)
  • changing the flash freq
  • changing the board type (TTGO Lora32 v1, v2, Heltec…)

And I get always this (view from arduino, but the same with platformio cli or clion build):

python /home/user/.arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/partitions/boot_app0.bin 0x1000 /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/bin/bootloader_dio_80m.bin 0x10000 /tmp/arduino_build_119083/WiFiScan.ino.bin 0x8000 /tmp/arduino_build_119083/WiFiScan.ino.partitions.bin 
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____.....____An error occurred while uploading the sketch
Failed to connect to ESP32: Timed out waiting for packet header

I cannot boot/upload any other program since that happened (yesterday). This is really awful, I don’t know if the TTGO LoRa is so weak that is breaks often or what. I say this because another TTGO LoRa32 V2 stopped working (it just lights a blue led but it is not recognized when connected to the usb), so I opened a new LoRa and just after a few tests stopped working with this (OP) new type of error. I am so disappointed and exhausted.

Any idea? I am really lost.

Well then we can’t be sure if it goes into bootloader mode. GPIO0 must be low (Home · espressif/esptool Wiki · GitHub).

If these are the schematic of your board, do the following:

  • connect the board to the computer
  • open a serial monitor (e.g. miniterm.py) on your serial device at 115200 baud
  • connect the IO0 pin on the board to GND via a jumper cable
  • press the RESET button
  • is there any output in the serial monitor window?

It’s kinda suspicious that the pinout diagram next to IO4 simply says “5V” and IO0 simply “GND”. Maybe that’s wrong? The ESP32 I/O pin should not be getting 5V. Maybe double check that with a multimeter. My guess is that there is a pullup on the board that pulls it to 3.3V, so that it doesn’t enter the bootloader. If in doubt, use a pull-down resistor (e.g. 10k or less) instead of a direct jumper connection to GND.

Hi, @maxgerhardt. Thanks for answering.
The schematics are these: GitHub - LilyGO/TTGO-LORA32: ESP32-TTGO-T3 (v2.0)

AFAIK, the TTGO LoRa 32 has ESP32-Pico-D4, in case that helps.

I checked with a multimeter the IO0 (GPIO0), the next one to the 3.3v in the left row, and it the IO0 has 3.147v. (DC volts between that pin and GND). When I upload the program/bin it is the same all time (I measured until I saw the “Timed out”).

I can try what you suggest, but what I don’t understand is, why I could upload many programs before? Or have change the board internally and the GPIO0 now “emits” 3.3v and before was 0, allowing me to bootload programs? I understood that this board doesn’t need the BOOT button since it will manage it by itself (as it was doing previously).

With this new info, do you recommend me to still connect the IO0 (which emits 3.3v) pin to the GND? better to connect them using a resistor (using the below diagram)? or better another option?

I only tried this until you say to me the next step (of the above questions):

  • board connected
  • miniterm.py /dev/ttyUSB0 115200
  • nothing appears, but if I press RESET button in the board, I get a newline in the miniterm.

Also, another test. If I do the above without pressing RESET button, and from another terminal I try to upload the program (eg. arduino ide > upload), I get the same “Timed out” but in the miniterm terminal I get many empty newlines (like when pressing RESET button, but around 10-12).

Some more info about the V2:

There is no version label on the PCB.
Has on-board metal Wifi/Bluetooth antenna on bottom (in a better location than V1).
Uses ESP32-Pico-D4 (with integrated flash memory) instead of ESP32, uses a (shielded) SX1276 LoRa module, I-Pex connector located on the bottom, micro-USB connector is rotated 90 degrees, in addition has a microSD card slot on the bottom and an on/off switch for the battery next to the micro-USB connector. Switches the battery only so not possible to switch the board off when connected to USB for charging the battery.
User LED is connected to GPIO25 which is useless because that is already used for the display and all LEDs are on the bottom side. DIO1 and DIO2 have a separate pins and are not wired on the PCB to a GPIO port so must be manually wired. The LoRa modules are HPD13A and HPD14A from HPDTek.

Absolute MAX 12mA per pin, recommended 6mA.
GPIO 34-39 are input only.
Note that LoRa Reset is not connected to any GPIO,
but is hard-wired to the ESP32 Chip Enable (EN) pin.

I understand that you say this. If am wrong, please, correct me:
image

Edit: some traces, trying another program and trying another serial device port ttyUSB1 (connecting in the USB0 the arduino):

$ python /home/user/.arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py --trace --chip esp32 --port /dev/ttyUSB1 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/partitions/boot_app0.bin 0x1000 /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/bin/bootloader_dio_80m.bin 0x10000 /tmp/arduino_build_642061/GetChipID.ino.bin 0x8000 /tmp/arduino_build_642061/GetChipID.ino.partitions.bin
esptool.py v2.6
Serial port /dev/ttyUSB1
Connecting...TRACE +0.000 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
TRACE +0.000 Write 46 bytes:
    c000082400000000 0007071220555555 | ...$........ UUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
TRACE +0.091 Read 1 bytes: 0d
TRACE +0.000 Read invalid data: 0d
TRACE +0.000 Remaining data in serial buffer: 0a0d0a
.TRACE +0.050 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
TRACE +0.000 Write 46 bytes:
    c000082400000000 0007071220555555 | ...$........ UUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
TRACE +0.101 Timed out waiting for packet header
.TRACE +0.050 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
TRACE +0.000 Write 46 bytes:
    c000082400000000 0007071220555555 | ...$........ UUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
TRACE +0.100 Timed out waiting for packet header
.TRACE +0.050 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
TRACE +0.000 Write 46 bytes:
    c000082400000000 0007071220555555 | ...$........ UUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
TRACE +0.100 Timed out waiting for packet header
.TRACE +0.050 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
TRACE +0.000 Write 46 bytes:
    c000082400000000 0007071220555555 | ...$........ UUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
TRACE +0.100 Timed out waiting for packet header
.TRACE +1.812 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
TRACE +0.000 Write 46 bytes:
    c000082400000000 0007071220555555 | ...$........ UUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
TRACE +0.100 Timed out waiting for packet header
_TRACE +0.050 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
TRACE +0.000 Write 46 bytes:
    c000082400000000 0007071220555555 | ...$........ UUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
TRACE +0.101 Timed out waiting for packet header
_TRACE +0.050 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
TRACE +0.000 Write 46 bytes:
    c000082400000000 0007071220555555 | ...$........ UUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
TRACE +0.100 Timed out waiting for packet header
_TRACE +0.050 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
TRACE +0.000 Write 46 bytes:
    c000082400000000 0007071220555555 | ...$........ UUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
TRACE +0.100 Timed out waiting for packet header
_TRACE +0.050 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
TRACE +0.000 Write 46 bytes:
    c000082400000000 0007071220555555 | ...$........ UUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
TRACE +0.100 Timed out waiting for packet header
_TRACE +0.211 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
TRACE +0.000 Write 46 bytes:
    c000082400000000 0007071220555555 | ...$........ UUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
TRACE +0.091 Read 1 bytes: 0d
TRACE +0.000 Read invalid data: 0d
TRACE +0.000 Remaining data in serial buffer: 0a0d0a
.TRACE +0.050 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
.... continue like this "loop" for 650 lines.

The auto-reset-into-bootloader should be implemented in hardware by using the RTS and DTR lines of the USB-UART converter as GPIO lines to toggle RESET and IO0 via some transistors. Looking at the schematics…

Here the RTS, DTR and IO0 control lines go into the UMH3N component (datahsheet), which has the two needed BJTs and resistors.

So that should all be fine in hardware if all the components are fine… Also espotool.py is told to do a --before default_reset --after hard_reset, so that’s also okay. No idea yet where the fault is.

Yeah try a 1K resistor to GND first. That should limit the current well enough in case something goes wrong. Check that IO0 is close to 0V then and reset the chip.

Added 1K resistor between GND and IO0. the display is black (no running previous program). Voltage between those pins dropped to 1.7v. If I disconnect, remove the wires and connect, again 3.1v and the display shows the previous program. I did not press the RESET button.

Do we try to reduce more the voltage? or do I try to upload the program when the wires/resistor are applied and the display is black?

Added in the previous comment also the trace of esptool.

Edit: I tried to do the miniterm.py + RESET step while using the resistor.

 ❯ miniterm.py /dev/ttyUSB0 115200
--- Miniterm on /dev/ttyUSB0  115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x1 (DOWNLOAD_BOOT(UART0/UART1/SDIO_FEI_REO_V2))
waiting for download

Then there’s already a pull-up resistor present at that pin and the pull-down is pulling it in the middle. I guess you could calculate the value of the other resitor based on the output voltage (1.7V), the pullup-voltage (3.3V ideally) and your resistor.

Yep you’ve entered the bootloader. Try uploading a known-good firmware now. Seems like 1.7V was momentarilly low enough to be recognized as 0.

Since the output voltage now pretty much garuantees that there’s a pull-up in place (you could also double-check by measuring the resistence between IO0 and 3V3), you should be able to directly connect IO0 to GND.

Between IO0 and 3v3 without resistor: ~35mV, with 1k resistor (GND-IO0), it is 3.2v.

Thank you very much. You have solved the issue.

I have made some tests, and it seems that I have to do from now on these steps

  • Disconnect usb
  • Wire GND with IO0
  • Connect usb => display black / bootloader mode
  • Program/upload it (slower than before)
  • Disconnect usb
  • Unwire GND with IO0
  • Connect usb => see program

(tried using the RESET button without disconnecting the usb wire and was not working the upload)

While before was just:

  • Connect usb
  • Upload/see program

It is quite slower but with this solution at least works! Thank you.

Can I invite you a coffee (donation)?

I have another question, but maybe I open a new post since you have solved this one. It is regarding another TTGO LoRa32 V2 that is not working (stopped working suddenly and is not even recognized).

1 Like