[SOLVED] Program TTGO Micro 32 by using an ESP32 development board

robertpainsi
Posts: 7
Joined: Fri Jun 12, 2020 4:02 pm

[SOLVED] Program TTGO Micro 32 by using an ESP32 development board

Postby robertpainsi » Fri Jun 12, 2020 5:32 pm

Update: See how everything worked out at https://www.esp32.com/viewtopic.php?f=2 ... =10#p68843

###############################################
Hi forum!

I'm currently working on a project where space is limited. The only microcontroller small enough is a TTGO Micro 32. They seem to be very similar to an ESP32, so I ordered a bunch of them. I did some research on how to program an TTGO or ESP32 by using an ESP32 development board but only found closely similar setups. I tried to hook it up like someone hooked up an ESP32 develpment board to an ESP32 camera (https://www.youtube.com/watch?v=xvjRlBHmewY), however, it didn't work. Since my knowledge of hardware is very limited, the TTGO Micro 32 is tiny and soldering these is a pita, it just only makes sense to ask for help. So, here is my setup:

ESP32 development board (powered by USB from my computer)
TTGO Micro-32 (powered by an external power supply, 3.3V)

Code: Select all

ESP32 En <-> Gnd 

TTGO Gnd <-> ESP32 Gnd (both controllers/boards need a common ground)

TTGO 3.3V <-> power supply 3.3V
TTGO Gnd <-> power supply Gnd
TTGO TX <-> ESP32 TX
TTGO RX <-> ESP32 RX

TTGO Rst/En <-> Gnd (closed by using a button)
TTGO GPIO0 <-> Gnd (closed by using a button)
Or see attachment
esp32-dev-board-ttgo-micro-32.png
esp32-dev-board-ttgo-micro-32.png (381.27 KiB) Viewed 10224 times
Uploading a sketch through the Android IDE just times out with following message.
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x65)
A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x65)

or

Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x20)
A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x20)

or

Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0xFF)
A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0xFF)


I tried to push and/or hold the TTGO Rst/EN and/or TTGO GPIO0 buttons before uploading the sketch and also before turning on the power supply. Maybe someone can help me here. I'm not even sure if the ESP32 and TTGO are wired up correctly.
Last edited by robertpainsi on Thu Dec 10, 2020 11:01 am, edited 2 times in total.

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: Program TTGO Micro 32 by using an ESP32 development board

Postby chegewara » Fri Jun 12, 2020 10:04 pm

I think you are almost there. Try to connect pin1 from devkit to pin1 on TGO and pin3 to pin3.
When you disable esp32 on devkit with connecting EN to GND it should works.

Much easier way is tou buy USB to UART:
https://pl.aliexpress.com/premium/usb-t ... 0to%20uart

robertpainsi
Posts: 7
Joined: Fri Jun 12, 2020 4:02 pm

Re: Program TTGO Micro 32 by using an ESP32 development board

Postby robertpainsi » Sat Jun 13, 2020 6:51 pm

@chegewara, thanks a lot for your quick response!

I somehow made a mistake in the schema by connecting the wrong Tx <-> Tx and Rx <-> Rx (didn't know there were actually another Tx and Rx :oops:). I'm already connecting IO1/Tx to IO1/Tx and IO3/Rx to IO3/Rx.

I've already tried 2 different ESP32 dev boards and 3 different TTGOs. Either connecting times out or I get the fatal error mentioned above. The result depends on which (order and when) buttons I press and release (to ground IO0 and En/Rst on the TTGO).
Do you know when and what buttons to press and release to ground those two pins? This will definitely help a lot during testing.

Thanks for the tip to grab an USB to UART adapter. I'll order one of these. However, the setup and soldering will be almost the same. Buttons for En/Rst and IO0, Tx <-> Rx and Rx <-> Tx. So I'm still worried that even with this adapter, it still won't work.

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: Program TTGO Micro 32 by using an ESP32 development board

Postby chegewara » Sun Jun 14, 2020 1:32 pm

Procedure is simple:
- press both buttons,
- release RST/EN button,
- release or not (not important) IO0 button.
You should see in terminal message that device is waiting download.

The difference between using external USB to UART is that you wont have on board esp32 disturbing transmission, but as long as you connect EN to GND on devkit it should be good, on board esp32 should be disabled.

robertpainsi
Posts: 7
Joined: Fri Jun 12, 2020 4:02 pm

Re: Program TTGO Micro 32 by using an ESP32 development board

Postby robertpainsi » Wed Jun 17, 2020 1:29 pm

Thanks again for your help!

I quickly ordered a pack of USB to TTL (CP2102) converted and received them today. My setup

Hardware

Code: Select all

TTGO 3.3V <-> CP2102 3.3V
TTGO Gnd <-> CP2102 Gnd
TTGO TX <-> CP2102 RX
TTGO RX <-> CP2102 TX

TTGO Rst/En <-> Gnd (closed by using a button)
TTGO GPIO0 <-> Gnd (closed by using a button)
Arduino IDE:

Code: Select all

Board: "ESP32 Dev Module"
Upload Speed: "115200"
CPU Frequency: "240MHz (WiFi/BT)"
Flash Frequency: "80MHz"
Flash Mode: "QIO"
Flash Size: "4MB (32MB)"
Partition Scheme: "Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)"
Core Debug Level: "None"
PSRAM: "Disabled"
Port: "/dev/ttyUSB0"
------------
Programmer: "AVRISP mkll"
When I press Upload and also press and release the RST/EN and IO0 buttons during or before connection, I mainly get following error:

Code: Select all

Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
I rarely get the fatal error (

Code: Select all

A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x65)
) mentioned at the beginning of this thread.

Not sure what to do now :cry: :?:

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: Program TTGO Micro 32 by using an ESP32 development board

Postby chegewara » Wed Jun 17, 2020 2:52 pm

i see 2 options, maybe someone else can find more:
1) When I press Upload and also press and release the RST/EN and IO0 buttons during or before connection <-- this is not working
2) TTGO is not working

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: Program TTGO Micro 32 by using an ESP32 development board

Postby chegewara » Wed Jun 17, 2020 7:26 pm

You should check one more thing i forgot about. Check pin 2. Depending on flash chip on TTGO it needs to be pulled down or up, try to pull down first. I have custom PCB in hands and some UART device connected to pin 2 is pulling it up, which does not allow to flash it with this code:

Code: Select all

Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x65)

robertpainsi
Posts: 7
Joined: Fri Jun 12, 2020 4:02 pm

Re: Program TTGO Micro 32 by using an ESP32 development board

Postby robertpainsi » Fri Jun 19, 2020 6:37 pm

Still no luck :(

I guess you're right, maybe they are broken, maybe I damaged them when soldering.
They are definitely not easy to solder. However, I always checked if I didn't solder two pins together and if there is a connection between the CP2102 pins and the TTGO pins by using a multimeter.

So, I just ordered a bunch of new TTGO micro chips from different shops. Will take a while until I receive them though since I couldn't find them anywhere except aliexpress. I'll update you once I tested the new chips *fingers crossed*

Thanks a lot for your help and information. Let's see if I have more luck with some new TTGO micro chips. :D

robertpainsi
Posts: 7
Joined: Fri Jun 12, 2020 4:02 pm

Re: Program TTGO Micro 32 by using an ESP32 development board

Postby robertpainsi » Fri Dec 04, 2020 8:25 pm

Hey, I finally received some new TTGOs, soldered everything, and… same result… :(

My setup is the same as mentioned above. I soldered wires onto a new TTGO and connected it to the CP2102. I also exposed the EN and GPIO0 pin so I can ground these pins manually.

Code: Select all

CP2102 TX  (yellow) <-> (green)  TTGO RX
CP2102 RX   (green) <-> (yellow) TTGO TX
CP2102 3V3    (red) <-> (red)    TTGO 3V3
CP2102 GND   (brown <-> grey)    breadboard GND

breadboard GND <-> (black) TTGO GND
breadboard GND <-> (grey <-> blue) TTGO GPIO0
breadboard GND <-> (grey <-> blue) TTGO EN
TTGO - All components.jpg
TTGO - All components.jpg (313.02 KiB) Viewed 8690 times
TTGO - Individual components.jpg
TTGO - Individual components.jpg (271.05 KiB) Viewed 8690 times
When I ground the EN and GPIO0 pins, upload the program to the TTGO and releasing the EN pin during upload, I get the same error message as mentioned at the beginning of this thread:

Code: Select all

Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x65)
A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x65)
During upload there is no Serial Monitor. However, if I connect the TTGO to my PC using the CP2102, open up the Serial Monitor at baud rate 115200 and release the EN pin, I get following messages:

Code: Select all

rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIOets Jun  8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO>ets Jun  8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDI⸮ets Jun  8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SD⸮ets Jun  8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_⸮ets Jun  8 2016 00:22:57
…
If I don't ground the GPIO0 pin, I get following message:

Code: Select all

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188⸮ets Jun  8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 1887⸮ets Jun  8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 18877⸮ets Jun  8 2016 00:22:57
Not sure why the output is kinda cropped (note the characters ⸮ and □). Maybe there is just a small detail I'm missing?

robertpainsi
Posts: 7
Joined: Fri Jun 12, 2020 4:02 pm

Re: Program TTGO Micro 32 by using an ESP32 development board

Postby robertpainsi » Wed Dec 09, 2020 2:38 pm

Soldered another TTGO with the lowest temperature settings, still the same problem. This is the 5th one with this problem. I ordered the TTGOs from two different shops…

Code: Select all

Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x65)
A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x65)
The Serial monitor output, if the GPIO0 pin is grounded, loops:

Code: Select all

rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
wa⸮⸮i⸮ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
waiti⸮⸮⸮ets Jun  8 2016 00:22:57
…
The Serial monitor output, if GPIO0 pin is not grounded, loops:

Code: Select all

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0⸮ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xeets Jun  8 2016 00:22:57
…
My esptool.py version is v3.0.

I tested a pre-soldered TTGO developer board which I can easily program over micro USB. The difference between the outputs are
  • The output isn't cropped nor do any ⸮ show up.
  • The output doesn't repeat infinitely but is only printed once.

Code: Select all

ets Jun  8 2016 00:22:57

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

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8

Who is online

Users browsing this forum: cdollar and 101 guests