Ok I see some more behaviour. I added another board temporarily to get my prototype working in parallel to the old board. The new board was flashed without any other peripherals connected. That flash process worked just fine.
Now when I sat down to do the trace as adviced by ESP_Angus, I tried to flash the old board (no peripherals connected to this one), and the flash worked!!! At the same time, when I tried to flash the new board (which has the peripherals connected), the flash failed with the same error as the old board!
I am suspecting that this has something to do with the voltage differences and currents drawn once peripherals are connected via the same USB power? Possible? Below is the output of the trace when the flash was failing.
TRACE +0.000 Read invalid data:
42917d91c9d9e930 7830302c77705f64 | B.}....0x00,wp_d
72763a307830300d 0a6d6f64653a4449 | rv:0x00..mode:DI
4f2c20636c6f636b 206469763a310d0a | O, clock div:1..
6c6f61643a307833 666666303031382c | load:0x3fff0018,
6c656e3a340d0a6c 6f61643a30783366 | len:4..load:0x3f
6666303031632c6c 656e3a313130300d | ff001c,len:1100.
0a6c6f61643a3078 3430303738303030 | .load:0x40078000
2c6c656e3a313030 38380d0a6c6f6164 | ,len:10088..load
3a30783430303830 3430302c6c656e3a | :0x40080400,len:
363338300d0a656e 7472792030783430 | 6380..entry 0x40
3038303661340d0a | 0806a4..
TRACE +0.016 Remaining data in serial buffer:
_TRACE +0.125 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.000 Read 21 bytes:
0000000000000000 0000000000000000 | ................
0000000000 | .....
TRACE +0.000 Read invalid data:
0000000000000000 0000000000000000 | ................
0000000000 | .....
TRACE +0.000 Remaining data in serial buffer: 00000000000000
_TRACE +0.140 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.109 Timed out waiting for packet header
_TRACE +0.125 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.109 Timed out waiting for packet header
_TRACE +0.297 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.078 Read 1 bytes: 00
TRACE +0.000 Read invalid data: 00
TRACE +0.000 Remaining data in serial buffer: 00
.TRACE +0.140 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.109 Timed out waiting for packet header
.TRACE +0.125 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.109 Timed out waiting for packet header
.TRACE +0.125 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.109 Timed out waiting for packet header
.TRACE +0.125 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.109 Timed out waiting for packet header
.TRACE +1.903 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.110 Timed out waiting for packet header
_TRACE +0.124 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.000 Read 178 bytes:
302c6373305f6472 763a30785f647276 | 0,cs0_drv:0x_drv
3a307830302c7770 5f6472763a307830 | :0x00,wp_drv:0x0
300d0a6d6f64653a 44494f2c20636c6f | 0..mode:DIO, clo
636b206469763a31 0d0a6c6f61643a30 | ck div:1..load:0
7833666666303031 382c6c656e3a340d | x3fff0018,len:4.
0a6c6f61643a3078 3366666630303163 | .load:0x3fff001c
2c6c656e3a313130 300d0a6c6f61643a | ,len:1100..load:
3078343030373830 30302c6c656e3a31 | 0x40078000,len:1
303038380d0a6c6f 61643a3078343030 | 0088..load:0x400
38303430302c6c65 6e3a363338300d0a | 80400,len:6380..
656e747279203078 3430303830366134 | entry 0x400806a4
0d0a | ..
TRACE +0.000 Read invalid data:
302c6373305f6472 763a30785f647276 | 0,cs0_drv:0x_drv
3a307830302c7770 5f6472763a307830 | :0x00,wp_drv:0x0
300d0a6d6f64653a 44494f2c20636c6f | 0..mode:DIO, clo
636b206469763a31 0d0a6c6f61643a30 | ck div:1..load:0
7833666666303031 382c6c656e3a340d | x3fff0018,len:4.
0a6c6f61643a3078 3366666630303163 | .load:0x3fff001c
2c6c656e3a313130 300d0a6c6f61643a | ,len:1100..load:
3078343030373830 30302c6c656e3a31 | 0x40078000,len:1
303038380d0a6c6f 61643a3078343030 | 0088..load:0x400
38303430302c6c65 6e3a363338300d0a | 80400,len:6380..
656e747279203078 3430303830366134 | entry 0x400806a4
0d0a | ..
TRACE +0.016 Remaining data in serial buffer:
_TRACE +0.125 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.000 Read 23 bytes:
0000000000000000 0000000000000000 | ................
00000000000000 | .......
TRACE +0.000 Read invalid data:
0000000000000000 0000000000000000 | ................
00000000000000 | .......
TRACE +0.000 Remaining data in serial buffer: 000000000000
_TRACE +0.140 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.109 Timed out waiting for packet header
_TRACE +0.125 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.109 Timed out waiting for packet header
_TRACE +0.297 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.078 Read 1 bytes: 00
TRACE +0.015 Read invalid data: 00
TRACE +0.000 Remaining data in serial buffer: 00000000
.TRACE +0.125 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.109 Timed out waiting for packet header
.TRACE +0.125 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.109 Timed out waiting for packet header
.TRACE +0.125 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.109 Timed out waiting for packet header
.TRACE +0.125 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.109 Timed out waiting for packet header
.TRACE +1.919 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.109 Timed out waiting for packet header
_TRACE +0.125 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.000 Read 178 bytes:
6373305f6472763a 3078308b7d91c9d9 | cs0_drv:0x0.}...
e9307830302c7770 5f6472763a307830 | .0x00,wp_drv:0x0
300d0a6d6f64653a 44494f2c20636c6f | 0..mode:DIO, clo
636b206469763a31 0d0a6c6f61643a30 | ck div:1..load:0
7833666666303031 382c6c656e3a340d | x3fff0018,len:4.
0a6c6f61643a3078 3366666630303163 | .load:0x3fff001c
2c6c656e3a313130 300d0a6c6f61643a | ,len:1100..load:
3078343030373830 30302c6c656e3a31 | 0x40078000,len:1
303038380d0a6c6f 61643a3078343030 | 0088..load:0x400
38303430302c6c65 6e3a363338300d0a | 80400,len:6380..
656e747279203078 3430303830366134 | entry 0x400806a4
0d0a | ..
TRACE +0.000 Read invalid data:
6373305f6472763a 3078308b7d91c9d9 | cs0_drv:0x0.}...
e9307830302c7770 5f6472763a307830 | .0x00,wp_drv:0x0
300d0a6d6f64653a 44494f2c20636c6f | 0..mode:DIO, clo
636b206469763a31 0d0a6c6f61643a30 | ck div:1..load:0
7833666666303031 382c6c656e3a340d | x3fff0018,len:4.
0a6c6f61643a3078 3366666630303163 | .load:0x3fff001c
2c6c656e3a313130 300d0a6c6f61643a | ,len:1100..load:
3078343030373830 30302c6c656e3a31 | 0x40078000,len:1
303038380d0a6c6f 61643a3078343030 | 0088..load:0x400
38303430302c6c65 6e3a363338300d0a | 80400,len:6380..
656e747279203078 3430303830366134 | entry 0x400806a4
0d0a | ..
TRACE +0.016 Remaining data in serial buffer:
_TRACE +0.125 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.000 Read 23 bytes:
0000000000000000 0000000000000000 | ................
00000000000000 | .......
TRACE +0.000 Read invalid data:
0000000000000000 0000000000000000 | ................
00000000000000 | .......
TRACE +0.000 Remaining data in serial buffer: 000000000000000000
_TRACE +0.140 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.109 Timed out waiting for packet header
_TRACE +0.125 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.109 Timed out waiting for packet header
_
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
Unable to upload ESP32 code - Invalid head of packet (0x1B)
Re: Unable to upload ESP32 code - Invalid head of packet (0x1B)
Some information that might help is that the peripheral device currently is a power meter IC ADE7763 running on SPI bus. Since ADE is 5V powered, there's a logic level shifter connected between the ADE and ESP32. I use the Vin pin to power the ADE. I do see that the vtg on Vin pin drops to about 4.5V when ADE is connected. Hence my suspicion that probably that is causing the issue?
-
- Posts: 166
- Joined: Wed Aug 01, 2018 12:06 pm
Re: Unable to upload ESP32 code - Invalid head of packet (0x1B)
Could it be possible that one of the GPIO pins is at fault? Perhaps, now that you know that not connecting any GPIO pins works, you add a few GPIO pin connections at a time till you find the failure point?
Re: Unable to upload ESP32 code - Invalid head of packet (0x1B)
From the trace output I can see what looks like a normal "flash boot" trying to complete (looks like this part of the boot message).
This means that the ESP32 is not going into the UART upload mode, required for flashing.
As idahowalker suggests, this is probably because a GPIO level is wrong. Probably, GPIO0 is not being pulled low.
More information can be found here:
https://github.com/espressif/esptool/wi ... oader-mode
and also in the "strapping pins" chapter of the ESP32 Datasheet.
It is quite likely the hardware is faulty (maybe a bad solder connection or a short to GPIO0).
This means that the ESP32 is not going into the UART upload mode, required for flashing.
As idahowalker suggests, this is probably because a GPIO level is wrong. Probably, GPIO0 is not being pulled low.
More information can be found here:
https://github.com/espressif/esptool/wi ... oader-mode
and also in the "strapping pins" chapter of the ESP32 Datasheet.
It is quite likely the hardware is faulty (maybe a bad solder connection or a short to GPIO0).
Re: Unable to upload ESP32 code - Invalid head of packet (0x1B)
I see what the problem is here - the logic level shifter. I have D2 and D19 coming from ADE7763 via the logic level shifter. When I disconnect those pins, then the code gets uploaded. But while these two pins are connected on the ESP32, I get those errors mentioned.
Surprisingly, once the code is loaded and I connect the D2 and D19 pins again, SPI works just fine. I can then read the data coming from the ADE.
Anybody seen any such issues when a level shifter board is used?
Surprisingly, once the code is loaded and I connect the D2 and D19 pins again, SPI works just fine. I can then read the data coming from the ADE.
Anybody seen any such issues when a level shifter board is used?
-
- Posts: 166
- Joined: Wed Aug 01, 2018 12:06 pm
Re: Unable to upload ESP32 code - Invalid head of packet (0x1B)
Not that issue but I tried running some servos from the ESP32 through a logic shifter to the servos. The servos would start jittering from time to time. I removed the shifter from the circuit, no jittering.deepakt wrote: ↑Fri Mar 08, 2019 7:10 amI see what the problem is here - the logic level shifter. I have D2 and D19 coming from ADE7763 via the logic level shifter. When I disconnect those pins, then the code gets uploaded. But while these two pins are connected on the ESP32, I get those errors mentioned.
Surprisingly, once the code is loaded and I connect the D2 and D19 pins again, SPI works just fine. I can then read the data coming from the ADE.
Anybody seen any such issues when a level shifter board is used?
Re: Unable to upload ESP32 code - Invalid head of packet (0x1B)
When the LV connection of the level shifter is connected t the 3V3 pin of ESP32, I see this problem. When I disconnect the LV connection from ESP32 3V3 pin, everything works fine.
Atleast now I'm sure it is the level shifter which is a problem.
Atleast now I'm sure it is the level shifter which is a problem.
-
- Posts: 166
- Joined: Wed Aug 01, 2018 12:06 pm
Re: Unable to upload ESP32 code - Invalid head of packet (0x1B)
Does the level shifter have an OE pin? Might use one of the ESP32 pins to disable the level shifter during the critical operation and see if that helps with the lvl shifter issue?
Re: Unable to upload ESP32 code - Invalid head of packet (0x1B)
This one is the FET based shifter and doesn't have an OE pin. Next time I'll use an IC based level shifter and hope this problem doesn't happen again.
Who is online
Users browsing this forum: No registered users and 33 guests