PIC32 as programmer

ttpatrik
Posts: 3
Joined: Mon Nov 29, 2021 7:15 pm

PIC32 as programmer

Postby ttpatrik » Mon Nov 29, 2021 7:24 pm

Hi.

I have designed a board using a PIC32 processor as programming interface to ESP32, in order to have USB programming option in the board (similar to other design using FTDI etc).
I use RTS and DTR for boot and enable/reset, and the TXDO/RXDO for programming.

The problem is that I can not get past:
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

I checked all the signals, and do get:
ets Jul 29 2019 12:21:46

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

after boot and reset.

I made a small firmware to test UART communication between the two devices successfully.
I have tested the same port with FTDI successfully.
I run the console through the PIC32 processor successfully (both directions)
I tried 10k pull down on RX0.
I tried 10uF to ground on Reset.

Everything works fine, but I am not able to pass the initial programming part.
I only see the start package sent from ESP-IDF over and over again.
I can not figure out what is wrong, and why the ESP32 seems to ignore the start flash command.

Please help!

best regards
Patrik

ESP_Sprite
Posts: 8926
Joined: Thu Nov 26, 2015 4:08 am

Re: PIC32 as programmer

Postby ESP_Sprite » Tue Nov 30, 2021 2:08 am

That's a setup with lots of variables, not sure if we can find a silver bullet here... One thing you could do is to try run esptool.py manually with the -t option as the first argument. That should print out a detailed trace of the data going back and forth; you could compare that with e.g. the trace of the same firmware flashed to a devboard.

ttpatrik
Posts: 3
Joined: Mon Nov 29, 2021 7:15 pm

Re: PIC32 as programmer

Postby ttpatrik » Tue Nov 30, 2021 9:02 am

Thanks a lot - makes the troubleshooting a lot easier with the trace on.

I see the reset, and the response from the ESP with the "ready for download" message.
then, What I can see is that the sync frames are sent to the ESP but no response from the ESP.

When comparing to the FTDI, the sending looks identical in the scope, but the difference is that the ESP reply to the sync frame with the FTDI but not the PIC32.
The ESPTool retries and retries, but still no answer from the ESP.
I checked the voltage levels on TX/RX and they are identical, as well as the rise and fall-time of the flanks.

The ESP stays silence when sending the sync frame.

Any more hints on what to look for?

br
Patrik

ttpatrik
Posts: 3
Joined: Mon Nov 29, 2021 7:15 pm

Re: PIC32 as programmer

Postby ttpatrik » Tue Nov 30, 2021 3:10 pm

I am considering if the timing of the UART is very crucial to the ESP32.
I tried to pipe the signals from FTDI through the PIC32 to the ESP32 using mirrored GPIOs, and then I get responses from ESP.
I then tried to pipe the FTDI through two uarts in the PIC32, and that does not work.
The signals looks very similar, maybe the UART speed is slightly off (0.16 off) and causes the ignored transmission?

I guessed the sync frame is to make the ESP32 sync the speed of the UART, but maybe I am wrong...

br
Patrik

Who is online

Users browsing this forum: No registered users and 54 guests