ESP32-PICO-V3-02

AndreyVinogradov
Posts: 11
Joined: Thu Jun 23, 2022 4:51 pm

ESP32-PICO-V3-02

Postby AndreyVinogradov » Sun Jun 26, 2022 2:02 pm

Hello!
I'm new to ESP32 chips and I have some problems with flashing project to it. I successfully build and flashed 'hello world' test project to ESP32-DevKit-V4 based on ESP-WROOM-32D chip by using Espressif-IDE. And got nice prints.
But now I can't make any project work on ESP32-PICO-V3-02 chip on my own board. If I flash the same project to PICO via serial port, I got those logs:

Code: Select all

...
ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
invalid header: 0x7663fd75
invalid header: 0x7663fd75
invalid header: 0x7663fd75
invalid header: 0x7663fd75
invalid header: 0x7663fd75
invalid header: 0x7663fd75
invalid header: 0x7663fd75
ets Jul 29 2019 12:21:46

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
invalid header: 0x7663fd75
invalid header: 0x7663fd75
invalid header: 0x7663fd75
invalid header: 0x7663fd75
invalid header: 0x7663fd75
invalid header: 0x7663fd75
invalid header: 0x7663fd75
...
I seems to have no errors during flash:

Code: Select all

[1/5] cmd.exe /C "cd /D E:\development\esp-idf-hello-world\build\esp-idf\esptool_py && python F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4/components/partition_table/check_sizes.py --offset 0x8000 partition --type app E:/development/esp-idf-hello-world/build/partition_table/partition-table.bin E:/development/esp-idf-hello-world/build/hello-world.bin"
hello-world.bin binary size 0x29730 bytes. Smallest app partition is 0x100000 bytes. 0xd68d0 bytes (84%) free.
[2/5] Performing build step for 'bootloader'
[1/1] cmd.exe /C "cd /D E:\development\esp-idf-hello-world\build\bootloader\esp-idf\esptool_py && python F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 E:/development/esp-idf-hello-world/build/bootloader/bootloader.bin"
Bootloader binary size 0x62b0 bytes. 0xd50 bytes (12%) free.
[2/3] cmd.exe /C "cd /D F:\Tools\Espressif\ESPIdfTools\frameworks\esp-idf-v4.4\components\esptool_py && F:\Tools\Espressif\ESPIdfTools\tools\cmake\3.20.3\bin\cmake.exe -D IDF_PATH="F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4" -D SERIAL_TOOL="python F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4/components/esptool_py/esptool/esptool.py --chip esp32" -D SERIAL_TOOL_ARGS="--before=default_reset --after=hard_reset write_flash @flash_args" -D WORKING_DIRECTORY="E:/development/esp-idf-hello-world/build" -P F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4/components/esptool_py/run_serial_tool.cmake"
esptool.py esp32 -p COM23 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x1000 bootloader/bootloader.bin 0x10000 hello-world.bin 0x8000 partition_table/partition-table.bin
esptool.py v3.2-dev
Serial port COM23
Connecting.....
Chip is ESP32-PICO-V3-02 (revision 3)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, Embedded PSRAM, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 30:83:98:d5:51:54
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00007fff...
Flash will be erased from 0x00010000 to 0x00039fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Compressed 25264 bytes to 15785...
Writing at 0x00001000... (100 %)
Wrote 25264 bytes (15785 compressed) at 0x00001000 in 0.9 seconds (effective 226.3 kbit/s)...
Hash of data verified.
Compressed 169776 bytes to 89627...
Writing at 0x00010000... (16 %)
Writing at 0x0001afdd... (33 %)
Writing at 0x00020754... (50 %)
Writing at 0x00025f9a... (66 %)
Writing at 0x0002e5b0... (83 %)
Writing at 0x00036948... (100 %)
Wrote 169776 bytes (89627 compressed) at 0x00010000 in 2.6 seconds (effective 526.5 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 103...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.1 seconds (effective 225.4 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Executing action: flash
Running ninja in directory e:\development\esp-idf-hello-world\build
Executing "ninja flash"...
Done

If I flash it using J-LINK + OpenOCD, I get this:

Code: Select all

...
ets Jul 29 2019 12:21:46

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 271414342, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6604
ho 0 tail 12 room 4
load:0x40078000,len:14780
load:0x40080400,len:3792
entry 0x40080694
I (57) boot: ESP-IDF v4.4 2nd stage bootloader
I (58) boot: compile time 16:47:21
I (58) boot: chip revision: 3
I (61) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (68) boot.esp32: SPI Speed      : 40MHz
I (73) boot.esp32: SPI Mode       : DIO
I (77) boot.esp32: SPI Flash Size : 2MB
I (82) boot: Enabling RNG early entropy source...
E (87) flash_parts: partition 0 invalid magic number 0x4b3b
E (93) boot: Failed to verify partition table
E (98) boot: load partition table error!
ets Jul 29 2019 12:21:46

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 271414342, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6604
ho 0 tail 12 room 4
load:0x40078000,len:14780
load:0x40080400,len:3792
entry 0x40080694
I (57) boot: ESP-IDF v4.4 2nd stage bootloader
I (58) boot: compile time 16:47:21
I (58) boot: chip revision: 3
I (61) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (68) boot.esp32: SPI Speed      : 40MHz
I (73) boot.esp32: SPI Mode       : DIO
I (77) boot.esp32: SPI Flash Size : 2MB
I (82) boot: Enabling RNG early entropy source...
E (87) flash_parts: partition 0 invalid magic number 0x4b3b
E (93) boot: Failed to verify partition table
E (98) boot: load partition table error!
...
OpenOCD flash log:

Code: Select all

Open On-Chip Debugger  v0.11.0-esp32-20211220 (2021-12-20-15:43)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1000 kHz

Flashing E:/development/esp-idf-hello-world/build/partition_table/partition-table.bin at 0x8000
Info : J-Link V11 compiled Sep  7 2121 11:22:27
Info : Hardware version: 11.00
Info : VTarget = 3.284 V
Info : clock speed 1000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Warn : target esp32.cpu1 examination failed
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : starting gdb server for esp32.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Target halted, PC=0x4000F979, debug_reason=00000000
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Error: Failed to get flash maps (4294967295)!
Warn : Failed to get flash mappings (-4)!
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 8192 KB
Info : Using flash bank 'esp32.cpu0.flash' size 8192 KB
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Error: Failed to get flash maps (4294967295)!
Warn : Failed to get flash mappings (-4)!
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu1.flash' size 8192 KB
Info : Using flash bank 'esp32.cpu1.flash' size 8192 KB
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : PROF: Data transferred in 106.501 ms @ 37.5583 KB/s
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
** Programming Finished **
** Verify Started **
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
** Verified OK **
** Flashing done for partition_table/partition-table.bin **
Flashing E:/development/esp-idf-hello-world/build/bootloader/bootloader.bin at 0x1000
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : PROF: Data transferred in 614.384 ms @ 45.5741 KB/s
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
** Programming Finished **
** Verify Started **
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
** Verified OK **
** Flashing done for bootloader/bootloader.bin **
Flashing E:/development/esp-idf-hello-world/build/hello-world.bin at 0x10000
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : PROF: Data transferred in 3636.82 ms @ 46.1942 KB/s
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
** Programming Finished **
** Verify Started **
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
** Verified OK **
** Flashing done for hello-world.bin **
** Resetting Target **
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
shutdown command invoked
Project build result:

Code: Select all

...
esptool.py v3.2-dev
Merged 2 ELF sections
Generated E:/development/esp-idf-hello-world/build/hello-world.bin
[1011/1011] cmd.exe /C "cd /D E:\development\esp-idf-hello-world\build\esp-idf\esptool_py && python F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4/components/partition_table/check_sizes.py --offset 0x8000 partition --type app E:/development/esp-idf-hello-world/build/partition_table/partition-table.bin E:/development/esp-idf-hello-world/build/hello-world.bin"
hello-world.bin binary size 0x29730 bytes. Smallest app partition is 0x100000 bytes. 0xd68d0 bytes (84%) free.
Build complete (0 errors, 0 warnings): E:\development\esp-idf-hello-world\build
F:\Tools\Espressif\ESPIdfTools\python_env\idf4.4_py3.8_env\Scripts\python.exe F:\Tools\Espressif\ESPIdfTools\frameworks\esp-idf-v4.4\tools\idf_size.py E:/development/esp-idf-hello-world/build/hello-world.map
Total sizes:

Used static DRAM:   11304 bytes ( 169432 remain, 6.3% used)

      .data size:    9024 bytes

      .bss  size:    2280 bytes

Used static IRAM:   45479 bytes (  85593 remain, 34.7% used)

      .text size:   44452 bytes

   .vectors size:    1027 bytes

Used stat D/IRAM:   56783 bytes ( 255025 remain, 18.2% used)

      .data size:    9024 bytes

      .bss  size:    2280 bytes

      .text size:   44452 bytes

   .vectors size:    1027 bytes

Used Flash size :  115147 bytes

      .text     :   84543 bytes

      .rodata   :   30348 bytes

Total image size:  224153 bytes (.bin may be padded larger)

F:\Tools\Espressif\ESPIdfTools\python_env\idf4.4_py3.8_env\Scripts\python.exe F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4/\components\partition_table\gen_esp32part.py E:\development\esp-idf-hello-world\build\partition_table\partition-table.bin
Total time taken to build the project: 109 297 msBuilding in: E:\development\esp-idf-hello-world\build
cmake --build . -- -v
[1/4] cmd.exe /C "cd /D E:\development\esp-idf-hello-world\build\esp-idf\esptool_py && python F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4/components/partition_table/check_sizes.py --offset 0x8000 partition --type app E:/development/esp-idf-hello-world/build/partition_table/partition-table.bin E:/development/esp-idf-hello-world/build/hello-world.bin"
hello-world.bin binary size 0x29730 bytes. Smallest app partition is 0x100000 bytes. 0xd68d0 bytes (84%) free.
[2/4] cmd.exe /C "cd /D E:\development\esp-idf-hello-world\build\bootloader && F:\Tools\Espressif\ESPIdfTools\tools\cmake\3.20.3\bin\cmake.exe --build ."
[1/1] cmd.exe /C "cd /D E:\development\esp-idf-hello-world\build\bootloader\esp-idf\esptool_py && python F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 E:/development/esp-idf-hello-world/build/bootloader/bootloader.bin"
Bootloader binary size 0x62b0 bytes. 0xd50 bytes (12%) free.
Build complete (0 errors, 0 warnings): E:\development\esp-idf-hello-world\build
F:\Tools\Espressif\ESPIdfTools\python_env\idf4.4_py3.8_env\Scripts\python.exe F:\Tools\Espressif\ESPIdfTools\frameworks\esp-idf-v4.4\tools\idf_size.py E:/development/esp-idf-hello-world/build/hello-world.map
Total sizes:

Used static DRAM:   11304 bytes ( 169432 remain, 6.3% used)

      .data size:    9024 bytes

      .bss  size:    2280 bytes

Used static IRAM:   45479 bytes (  85593 remain, 34.7% used)

      .text size:   44452 bytes

   .vectors size:    1027 bytes

Used stat D/IRAM:   56783 bytes ( 255025 remain, 18.2% used)

      .data size:    9024 bytes

      .bss  size:    2280 bytes

      .text size:   44452 bytes

   .vectors size:    1027 bytes

Used Flash size :  115147 bytes

      .text     :   84543 bytes

      .rodata   :   30348 bytes

Total image size:  224153 bytes (.bin may be padded larger)

F:\Tools\Espressif\ESPIdfTools\python_env\idf4.4_py3.8_env\Scripts\python.exe F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4/\components\partition_table\gen_esp32part.py E:\development\esp-idf-hello-world\build\partition_table\partition-table.bin
Total time taken to build the project: 809 ms
Before that I tried to build and flash "esp-at" project to PICO, but got about the same result. I looked in menuconfig and tried to switch on/off JTAG support in "security" settings. Don't know if it caused this behaviour.

What am I doing wrong? Is it PICO not compatible with IDF?

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

Re: ESP32-PICO-V3-02

Postby ESP_Sprite » Mon Jun 27, 2022 3:01 am

That is odd behaviour. Can you post the schematic of your board? Perhaps there's something connected to the bootstrap or flash pins that makes it behave this way.

AndreyVinogradov
Posts: 11
Joined: Thu Jun 23, 2022 4:51 pm

Re: ESP32-PICO-V3-02

Postby AndreyVinogradov » Mon Jun 27, 2022 7:00 am

ESP32-PICO:
2022-06-27_09-42-12.png
2022-06-27_09-42-12.png (70.61 KiB) Viewed 3630 times
Connected to Cortex-M chip AT32F407 via ESP_RX/TX1 UART pins for AT-commands, RST/BOOT pins (I don't remember why BOOT was needed) and DBG for debug:
2022-06-27_09-57-41.png
2022-06-27_09-57-41.png (37.07 KiB) Viewed 3630 times
Currently I erased all program flash on AT32 so it's program would not interfere to work with ESP32.

external pins I use for flash/debug:
2022-06-27_09-41-44.png
2022-06-27_09-41-44.png (15.1 KiB) Viewed 3630 times

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

Re: ESP32-PICO-V3-02

Postby ESP_Sprite » Mon Jun 27, 2022 11:37 am

That looks good. What is ESP_RST connected to, as in, do you properly reset the ESP32 on power-up?

AndreyVinogradov
Posts: 11
Joined: Thu Jun 23, 2022 4:51 pm

Re: ESP32-PICO-V3-02

Postby AndreyVinogradov » Mon Jun 27, 2022 1:07 pm

I hold RST pin on 3.3V, and ESP32 chip run it's program. If I disconnect RST pin from 3.3V and leave it as is, something odd I see in logs:

Code: Select all

...
rst:0x1 (POWERON_RESET),boot:0x1 (DOWNLOAD_BOOT(UART0/UART1/SDIO_FEI_REO_V2))
wai▒ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x1 (DOWNLOAD_BOOT(UART0/UART1/SDIO_FEI_REO_V2))
waiets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x1 (DOWNLOAD_BOOT(UART0/UART1/SDIO_FEI_REO_V2))
wa      ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x1 (DOWNLOAD_BOOT(UART0/UART1/SDIO_FEI_REO_V2))
wai▒e
...
probably tries to write "waiting for download"

I also hold BOOT pin on GND. If I disconnect BOOT pin from GND, logs stop spamming. If I connect BOOT pin to 3.3V, I see those logs:

Code: Select all

...
I (13) boot: ESP-IDF v4.4 2nd stage bootloader
I (13) boot: compile time 17:25:43
I (13) boot: chip revision: 3
I (15) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (22) boot.esp32: SPI Speed      : 40MHz
I (26) boot.esp32: SPI Mode       : DIO
I (31) boot.esp32: SPI Flash Size : 8MB
I (36) boot: Enabling RNG early entropy source...
E (41) flash_parts: partition 0 invalid magic number 0x4b3b
E (47) boot: Failed to verify partition table
E (52) boot: load partition table error!
I (13) boot: ESP-IDF v4.4 2nd stage bootloader
I (13) boot: compile time 17:25:43
I (13) boot: chip revision: 3
I (15) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (22) boot.esp32: SPI Speed      : 40MHz
I (26) boot.esp32: SPI Mode       : DIO
I (31) boot.esp32: SPI Flash Size : 8MB
I (36) boot: Enabling RNG early entropy source...
E (41) flash_parts: partition 0 invalid magic number 0x4b3b
E (47) boot: Failed to verify partition table
E (52) boot: load partition table error!
...
Probably my biggest problem is that I don't know proper state of RST/BOOT pins... I think I tried all variations while booting/flashing project.

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

Re: ESP32-PICO-V3-02

Postby ESP_Sprite » Tue Jun 28, 2022 12:33 am

The proper usage is:
- On power-on, after the power rails have stabilized, the reset NEEDS to be low for 50uS or more. If you don't do this, the ESP32 won't be reset properly and you'll get Weird Stuff.
- After this, the reset must be high. Don't tristate it, actively pull it high from your other MCU.
- If you need to reset the chip again, make the reset line low for >50uS, then high again.
- If, when the reset goes low->high, GPIO0 is low, the ESP will enter download mode. If it's high, it will try to boot from flash.

AndreyVinogradov
Posts: 11
Joined: Thu Jun 23, 2022 4:51 pm

Re: ESP32-PICO-V3-02

Postby AndreyVinogradov » Tue Jun 28, 2022 2:06 pm

I tried to do as you say:
Channel 0 - Power supply
Channel 1 - Reset pin
Channel 2 - Boot (GPIO0) pin

First start power, next about 20ms after MCU initialized Reset and Boot pins and put them high (3.3V).
esp32_02.png
esp32_02.png (10.07 KiB) Viewed 3516 times
I also tried to toggle Reset pin high->low->high, hoping it will do:
esp32_01.png
esp32_01.png (7.33 KiB) Viewed 3516 times
Next I again flashed firmware with JTAG adapter and got the same result:

Code: Select all

ets Jul 29 2019 12:21:46

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 271414342, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6604
ho 0 tail 12 room 4
load:0x40078000,len:14780
load:0x40080400,len:3792
entry 0x40080694
I (57) boot: ESP-IDF v4.4 2nd stage bootloader
I (58) boot: compile time 17:25:43
I (58) boot: chip revision: 3
I (61) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (68) boot.esp32: SPI Speed      : 40MHz
I (73) boot.esp32: SPI Mode       : DIO
I (77) boot.esp32: SPI Flash Size : 8MB
I (82) boot: Enabling RNG early entropy source...
E (87) flash_parts: partition 0 invalid magic number 0x4b3b
E (93) boot: Failed to verify partition table
E (98) boot: load partition table error!
ets Jul 29 2019 12:21:46

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 271414342, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6604
ho 0 tail 12 room 4
load:0x40078000,len:14780
load:0x40080400,len:3792
entry 0x40080694
I (57) boot: ESP-IDF v4.4 2nd stage bootloader
I (58) boot: compile time 17:25:43
I (58) boot: chip revision: 3
I (61) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (68) boot.esp32: SPI Speed      : 40MHz
I (73) boot.esp32: SPI Mode       : DIO
I (77) boot.esp32: SPI Flash Size : 8MB
I (82) boot: Enabling RNG early entropy source...
E (87) flash_parts: partition 0 invalid magic number 0x4b3b
E (93) boot: Failed to verify partition table
E (98) boot: load partition table error!

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

Re: ESP32-PICO-V3-02

Postby ESP_Sprite » Wed Jun 29, 2022 2:28 am

Another thing is that you connected IO10 to something. The Pico-V3-02 has embedded PSRAM at that pin and you shouldn't use it. Perhaps try again with the trace from that pin scratched through close to the Pico (to make sure high-frequency reflections aren't an issue)?

Aside from that, I'm having a hard time seeing what else could cause your issues, I'm afraid.

AndreyVinogradov
Posts: 11
Joined: Thu Jun 23, 2022 4:51 pm

Re: ESP32-PICO-V3-02

Postby AndreyVinogradov » Wed Jun 29, 2022 11:46 am

Thank you for your support. I will try to cut IO10 pin. I don't use it at all. Trace from that pin to AT32 is about 5cm. I also will try to unsolder and solder ESP32 to board again, may be some traces are not connected well.

AndreyVinogradov
Posts: 11
Joined: Thu Jun 23, 2022 4:51 pm

Re: ESP32-PICO-V3-02

Postby AndreyVinogradov » Thu Jul 07, 2022 11:52 am

Hello, again!

I managed to successfully flash test firmware via JTAG adapter and it worked. Looks like the problem was that bootloader did not fit in flash. I made partition table offset 0xA000 instead of 0x8000. And all went well.

But still there is a problem with flashing with UART adapter. Same firmware, same offset, but different result:

Code: Select all

ets Jul 29 2019 12:21:46

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
invalid header: 0x55949174
invalid header: 0x55949174
invalid header: 0x55949174
invalid header: 0x55949174
invalid header: 0x55949174
invalid header: 0x55949174
invalid header: 0x55949174
instead of

Code: Select all

ets Jul 29 2019 12:21:46

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 271414342, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6604
ho 0 tail 12 room 4
load:0x40078000,len:14784
load:0x40080400,len:3792
0x40080400: _init at ??:?

entry 0x40080694
I (29) boot: ESP-IDF v4.4 2nd stage bootloader
I (29) boot: compile time 13:58:06
I (29) boot: chip revision: 3
I (32) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (39) boot.esp32: SPI Speed      : 40MHz
I (44) boot.esp32: SPI Mode       : DIO
I (48) boot.esp32: SPI Flash Size : 16MB
I (53) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (62) boot: ## Label            Usage          Type ST Offset   Length
I (69) boot:  0 nvs              WiFi data        01 02 0000b000 00006000
I (77) boot:  1 phy_init         RF data          01 01 00011000 00001000
I (84) boot:  2 factory          factory app      00 00 00020000 00177000
I (92) boot: End of partition table
I (96) boot_comm: chip revision: 3, min. application chip revision: 0
I (103) esp_image: segment 0: paddr=00020020 vaddr=3f400020 size=071cch ( 29132) map
I (122) esp_image: segment 1: paddr=000271f4 vaddr=3ffb0000 size=01c6ch (  7276) load
I (126) esp_image: segment 2: paddr=00028e68 vaddr=40080000 size=071b0h ( 29104) load
I (141) esp_image: segment 3: paddr=00030020 vaddr=400d0020 size=14630h ( 83504) map
I (172) esp_image: segment 4: paddr=00044658 vaddr=400871b0 size=01fa4h (  8100) load
I (176) esp_image: segment 5: paddr=00046604 vaddr=50000000 size=00010h (    16) load
I (183) boot: Loaded app from partition at offset 0x20000
I (184) boot: Disabling RNG early entropy source...
I (201) cpu_start: Pro cpu up.
I (201) cpu_start: Starting app cpu, entry point is 0x40080ed4
0x40080ed4: call_start_cpu1 at F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4/components/esp_system/port/cpu_start.c:156

I (186) cpu_start: App cpu up.
I (215) cpu_start: Pro cpu start user code
I (215) cpu_start: cpu freq: 80000000
I (215) cpu_start: Application information:
I (220) cpu_start: Project name:     hello-world
I (225) cpu_start: App version:      59f8cc1-dirty
I (231) cpu_start: Compile time:     Jul  7 2022 13:57:50
I (237) cpu_start: ELF file SHA256:  85fc37c2dcde96d8...
I (243) cpu_start: ESP-IDF:          v4.4
I (248) heap_init: Initializing. RAM available for dynamic allocation:
I (255) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (261) heap_init: At 3FFB2558 len 0002DAA8 (182 KiB): DRAM
I (267) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (273) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (280) heap_init: At 40089154 len 00016EAC (91 KiB): IRAM
I (289) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
Hello world!
This is esp32 chip with 2 CPU core(s), WiFi/BT/BLE, silicon revision 3, 16MB embedded flash
Minimum free heap size: 296024 bytes
Restarting in 10 seconds...
Restarting in 9 seconds...
Restarting in 8 seconds...
Restarting in 7 seconds...
Restarting in 6 seconds...
Restarting in 5 seconds...
Restarting in 4 seconds...
Restarting in 3 seconds...
Restarting in 2 seconds...
Restarting in 1 seconds...
Restarting in 0 seconds...
Restarting now.

BTW, I'm not quite sure, what embedded flash size I should set. In datasheed told that there is 8 MB SPI flash. And JTAG-adapter find two flash banks:

Code: Select all

...
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 8192 KB
Info : Using flash bank 'esp32.cpu0.flash' size 8192 KB
...
Info : Auto-detected flash bank 'esp32.cpu1.flash' size 8192 KB
Info : Using flash bank 'esp32.cpu1.flash' size 8192 KB
...
Can you give me working binary files and their offsets for tests so I could flash them both via UART and JTAG?

Also am I understand correct that there is a two "bootloaders" in ESP32? One at 0x1000 offset, which can be overwritten by JTAG and UART. And the other one, that can not, and it's somewhere else (0x00 offset maybe?), and it's purpose to flash firmware other UART.

Another thing is that if I take "fresh" ESP32-PICO-V3-02 and flashing it with UART, it works fine. But if I next flash it with JTAG, I can not flash it properly with UART anymore.

JTAG flash log:

Code: Select all

Open On-Chip Debugger  v0.11.0-esp32-20211220 (2021-12-20-15:43)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1000 kHz

Flashing E:/development/esp-idf-hello-world/build/partition_table/partition-table.bin at 0xa000
Info : J-Link V11 compiled Sep  7 2121 11:22:27
Info : Hardware version: 11.00
Info : VTarget = 3.285 V
Info : clock speed 1000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : starting gdb server for esp32.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Target halted, PC=0x400E3E6E, debug_reason=00000000
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu1: Target halted, PC=0x400E3E6E, debug_reason=00000000
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Error: Failed to get flash maps (4294967290)!
Warn : Failed to get flash mappings (-4)!
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 8192 KB
Info : Using flash bank 'esp32.cpu0.flash' size 8192 KB
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Error: Failed to get flash maps (4294967290)!
Warn : Failed to get flash mappings (-4)!
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu1.flash' size 8192 KB
Info : Using flash bank 'esp32.cpu1.flash' size 8192 KB
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : PROF: Data transferred in 110.664 ms @ 36.1454 KB/s
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
** Programming Finished **
** Verify Started **
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
** Verified OK **
** Flashing done for partition_table/partition-table.bin **
Flashing E:/development/esp-idf-hello-world/build/bootloader/bootloader.bin at 0x1000
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : PROF: Data transferred in 609.392 ms @ 45.9474 KB/s
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
** Programming Finished **
** Verify Started **
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
** Verified OK **
** Flashing done for bootloader/bootloader.bin **
Flashing E:/development/esp-idf-hello-world/build/hello-world.bin at 0x20000
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : PROF: Data transferred in 3384.22 ms @ 46.0964 KB/s
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
** Programming Finished **
** Verify Started **
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
** Verified OK **
** Flashing done for hello-world.bin **
** Resetting Target **
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
shutdown command invoked
UART flash log:

Code: Select all

[1/5] cmd.exe /C "cd /D E:\development\esp-idf-hello-world\build\esp-idf\esptool_py && python F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4/components/partition_table/check_sizes.py --offset 0xa000 partition --type app E:/development/esp-idf-hello-world/build/partition_table/partition-table.bin E:/development/esp-idf-hello-world/build/hello-world.bin"
hello-world.bin binary size 0x26640 bytes. Smallest app partition is 0x100000 bytes. 0xd99c0 bytes (85%) free.
[2/5] Performing build step for 'bootloader'
[1/1] cmd.exe /C "cd /D E:\development\esp-idf-hello-world\build\bootloader\esp-idf\esptool_py && python F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4/components/partition_table/check_sizes.py --offset 0xa000 bootloader 0x1000 E:/development/esp-idf-hello-world/build/bootloader/bootloader.bin"
Bootloader binary size 0x62b0 bytes. 0x2d50 bytes (31%) free.
[2/3] cmd.exe /C "cd /D F:\Tools\Espressif\ESPIdfTools\frameworks\esp-idf-v4.4\components\esptool_py && F:\Tools\Espressif\ESPIdfTools\tools\cmake\3.20.3\bin\cmake.exe -D IDF_PATH="F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4" -D SERIAL_TOOL="python F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4/components/esptool_py/esptool/esptool.py --chip esp32" -D SERIAL_TOOL_ARGS="--before=default_reset --after=no_reset write_flash @flash_args" -D WORKING_DIRECTORY="E:/development/esp-idf-hello-world/build" -P F:/Tools/Espressif/ESPIdfTools/frameworks/esp-idf-v4.4/components/esptool_py/run_serial_tool.cmake"
esptool.py esp32 -p COM23 -b 460800 --before=default_reset --after=no_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 16MB 0x1000 bootloader/bootloader.bin 0x20000 hello-world.bin 0xa000 partition_table/partition-table.bin
esptool.py v3.2-dev
Serial port COM23
Connecting....
Chip is ESP32-PICO-V3-02 (revision 3)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, Embedded PSRAM, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 30:83:98:d5:51:54
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00007fff...
Flash will be erased from 0x00020000 to 0x00046fff...
Flash will be erased from 0x0000a000 to 0x0000afff...
Compressed 25264 bytes to 15780...
Writing at 0x00001000... (100 %)
Wrote 25264 bytes (15780 compressed) at 0x00001000 in 0.8 seconds (effective 242.9 kbit/s)...
Hash of data verified.
Compressed 157248 bytes to 82414...
Writing at 0x00020000... (16 %)
Writing at 0x0002a84c... (33 %)
Writing at 0x00030259... (50 %)
Writing at 0x00035acc... (66 %)
Writing at 0x0003e149... (83 %)
Writing at 0x0004638d... (100 %)
Wrote 157248 bytes (82414 compressed) at 0x00020000 in 2.7 seconds (effective 465.6 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 81...
Writing at 0x0000a000... (100 %)
Wrote 3072 bytes (81 compressed) at 0x0000a000 in 0.2 seconds (effective 117.7 kbit/s)...
Hash of data verified.

Leaving...
Staying in bootloader.
Executing action: flash
Running ninja in directory e:\development\esp-idf-hello-world\build
Executing "ninja flash"...
Done
hmm, just noticed:

Code: Select all

Flash will be erased from 0x00001000 to 0x00007fff...
probably it should be

Code: Select all

Flash will be erased from 0x00001000 to 0x00009fff...
Where is it configured?

Who is online

Users browsing this forum: RathiSonika and 132 guests