error in esp serial flasher: Cannot connect to target. Error: 2

suraj02
Posts: 4
Joined: Tue Jan 09, 2024 5:51 pm

error in esp serial flasher: Cannot connect to target. Error: 2

Postby suraj02 » Thu Jan 18, 2024 5:10 am

I am trying to flashing this example :https://github.com/espressif/esp-serial ... 32_example but getting same error after many trials.
Error: Cannot connect to target. Error: 2

Hardware used:
slave: ESP32 WROOM 32E
master:ESP32 WROOM 32E

SOLUTIONS TRIED
I tried with different data cables, Jumpers(For slave and master) but getting same issue.

Video demonstration
I am attaching video demonstation link: https://drive.google.com/file/d/1m8qy01 ... p=drivesdk

So please anyone can tell me why this error is occured?

ERROR LOGS:
  1. Executing action: flash
  2. Running ninja in directory /home/suraj/esp/esp-serial-flasher/examples/esp32_example/build
  3. Executing "ninja flash"...
  4. [1/5] cd /home/suraj/esp/esp-serial-flasher/examples/esp32_example/build/esp-idf/esptool_py && /home...ion-table.bin /home/suraj/esp/esp-serial-flasher/examples/esp32_example/build/esp-serial-flasher.bin
  5. esp-serial-flasher.bin binary size 0x14f940 bytes. Smallest app partition is 0x1e0000 bytes. 0x906c0 bytes (30%) free.
  6. [2/5] Performing build step for 'bootloader'
  7. [1/1] cd /home/suraj/esp/esp-serial-flasher/examples/esp32_example/build/bootloader/esp-idf/esptool_py && /home/suraj/.espressif/python_env/idf4.4_py3.10_env/bin/python /home/suraj/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 /home/suraj/esp/esp-serial-flasher/examples/esp32_example/build/bootloader/bootloader.bin
  8. Bootloader binary size 0x63c0 bytes. 0xc40 bytes (11%) free.
  9. [2/3] cd /home/suraj/esp/esp-idf/components/esptool_py && /usr/bin/cmake -D IDF_PATH="/home/suraj/es...examples/esp32_example/build" -P /home/suraj/esp/esp-idf/components/esptool_py/run_serial_tool.cmake
  10. esptool.py esp32 -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x1000 bootloader/bootloader.bin 0x10000 esp-serial-flasher.bin 0x8000 partition_table/partition-table.bin
  11. esptool.py v3.3.2
  12. Serial port /dev/ttyUSB0
  13. Connecting.....
  14. Chip is ESP32-D0WD-V3 (revision 3)
  15. Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
  16. Crystal is 40MHz
  17. MAC: e8:31:cd:c4:cf:3c
  18. Uploading stub...
  19. Running stub...
  20. Stub running...
  21. Changing baud rate to 460800
  22. Changed.
  23. Configuring flash size...
  24. Flash will be erased from 0x00001000 to 0x00007fff...
  25. Flash will be erased from 0x00010000 to 0x0015ffff...
  26. Flash will be erased from 0x00008000 to 0x00008fff...
  27. Compressed 25536 bytes to 15950...
  28. Writing at 0x00001000... (100 %)
  29. Wrote 25536 bytes (15950 compressed) at 0x00001000 in 0.7 seconds (effective 273.7 kbit/s)...
  30. Hash of data verified.
  31. Compressed 1374528 bytes to 782572...
  32. Writing at 0x00010000... (2 %)
  33. Writing at 0x000178fb... (4 %)
  34. Writing at 0x0001cb98... (6 %)
  35. Writing at 0x0002272e... (8 %)
  36. Writing at 0x00028164... (10 %)
  37. Writing at 0x0002e245... (12 %)
  38. Writing at 0x00033e87... (14 %)
  39. Writing at 0x0003a77b... (16 %)
  40. Writing at 0x000415bc... (18 %)
  41. Writing at 0x000489cb... (20 %)
  42. Writing at 0x0005080e... (22 %)
  43. Writing at 0x0005775d... (25 %)
  44. Writing at 0x0005ced1... (27 %)
  45. Writing at 0x00063339... (29 %)
  46. Writing at 0x0006b506... (31 %)
  47. Writing at 0x00073c7d... (33 %)
  48. Writing at 0x00079860... (35 %)
  49. Writing at 0x00083688... (37 %)
  50. Writing at 0x0008970d... (39 %)
  51. Writing at 0x000915ab... (41 %)
  52. Writing at 0x00098dfe... (43 %)
  53. Writing at 0x0009eb5c... (45 %)
  54. Writing at 0x000a4c07... (47 %)
  55. Writing at 0x000aac00... (50 %)
  56. Writing at 0x000b1dcb... (52 %)
  57. Writing at 0x000ba62e... (54 %)
  58. Writing at 0x000c0901... (56 %)
  59. Writing at 0x000c71a7... (58 %)
  60. Writing at 0x000cdcd0... (60 %)
  61. Writing at 0x000d57d5... (62 %)
  62. Writing at 0x000e1aa0... (64 %)
  63. Writing at 0x000e7ca6... (66 %)
  64. Writing at 0x000eeb3e... (68 %)
  65. Writing at 0x000f6408... (70 %)
  66. Writing at 0x000fc7d0... (72 %)
  67. Writing at 0x00102b14... (75 %)
  68. Writing at 0x0010a027... (77 %)
  69. Writing at 0x00111e94... (79 %)
  70. Writing at 0x0011a8aa... (81 %)
  71. Writing at 0x0011f970... (83 %)
  72. Writing at 0x00126762... (85 %)
  73. Writing at 0x0012e6c9... (87 %)
  74. Writing at 0x00139431... (89 %)
  75. Writing at 0x0013eddd... (91 %)
  76. Writing at 0x001447f6... (93 %)
  77. Writing at 0x0014a6e7... (95 %)
  78. Writing at 0x00152a5d... (97 %)
  79. Writing at 0x0015af58... (100 %)
  80. Wrote 1374528 bytes (782572 compressed) at 0x00010000 in 18.3 seconds (effective 599.6 kbit/s)...
  81. Hash of data verified.
  82. Compressed 3072 bytes to 105...
  83. Writing at 0x00008000... (100 %)
  84. Wrote 3072 bytes (105 compressed) at 0x00008000 in 0.1 seconds (effective 395.6 kbit/s)...
  85. Hash of data verified.
  86.  
  87. Leaving...
  88. Hard resetting via RTS pin...
  89. Executing action: monitor
  90. Running idf_monitor in directory /home/suraj/esp/esp-serial-flasher/examples/esp32_example
  91. Executing "/home/suraj/.espressif/python_env/idf4.4_py3.10_env/bin/python /home/suraj/esp/esp-idf/tools/idf_monitor.py -p /dev/ttyUSB0 -b 115200 --toolchain-prefix xtensa-esp32-elf- --target esp32 --revision 0 /home/suraj/esp/esp-serial-flasher/examples/esp32_example/build/esp-serial-flasher.elf -m '/home/suraj/.espressif/python_env/idf4.4_py3.10_env/bin/python' '/home/suraj/esp/esp-idf/tools/idf.py' '-p' '/dev/ttyUSB0'"...
  92. --- idf_monitor on /dev/ttyUSB0 115200 ---
  93. --- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
  94. xx������x�x�x��x����x����������x�x��xB��J��ets Jul 29 2019 12:21:46
  95.  
  96. rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
  97. configsip: 0, SPIWP:0xee
  98. clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
  99. mode:DIO, clock div:2
  100. load:0x3fff0030,len:6760
  101. load:0x40078000,len:14896
  102. load:0x40080400,len:3792
  103. 0x40080400: _init at ??:?
  104.  
  105. entry 0x40080694
  106. I (27) boot: ESP-IDF v4.4.3-dirty 2nd stage bootloader
  107. I (27) boot: compile time 18:38:57
  108. I (27) boot: chip revision: 3
  109. I (31) boot_comm: chip revision: 3, min. bootloader chip revision: 0
  110. I (38) boot.esp32: SPI Speed      : 40MHz
  111. I (42) boot.esp32: SPI Mode       : DIO
  112. I (47) boot.esp32: SPI Flash Size : 4MB
  113. I (51) boot: Enabling RNG early entropy source...
  114. I (57) boot: Partition Table:
  115. I (60) boot: ## Label            Usage          Type ST Offset   Length
  116. I (68) boot:  0 nvs              WiFi data        01 02 00009000 00006000
  117. I (75) boot:  1 phy_init         RF data          01 01 0000f000 00001000
  118. I (83) boot:  2 factory          factory app      00 00 00010000 001e0000
  119. I (90) boot: End of partition table
  120. I (94) boot_comm: chip revision: 3, min. application chip revision: 0
  121. I (101) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=126dcch (1207756) map
  122. I (547) esp_image: segment 1: paddr=00136df4 vaddr=3ffb0000 size=02334h (  9012) load
  123. I (551) esp_image: segment 2: paddr=00139130 vaddr=40080000 size=06ee8h ( 28392) load
  124. I (565) esp_image: segment 3: paddr=00140020 vaddr=400d0020 size=1a344h (107332) map
  125. I (604) esp_image: segment 4: paddr=0015a36c vaddr=40086ee8 size=05594h ( 21908) load
  126. I (613) esp_image: segment 5: paddr=0015f908 vaddr=50000000 size=00010h (    16) load
  127. I (619) boot: Loaded app from partition at offset 0x10000
  128. I (619) boot: Disabling RNG early entropy source...
  129. I (635) cpu_start: Pro cpu up.
  130. I (635) cpu_start: Starting app cpu, entry point is 0x40081100
  131. 0x40081100: call_start_cpu1 at /home/suraj/esp/esp-idf/components/esp_system/port/cpu_start.c:148
  132.  
  133. I (0) cpu_start: App cpu up.
  134. I (649) cpu_start: Pro cpu start user code
  135. I (649) cpu_start: cpu freq: 160000000
  136. I (649) cpu_start: Application information:
  137. I (653) cpu_start: Project name:     esp-serial-flasher
  138. I (659) cpu_start: App version:      v1.0.2-3-g8da993a-dirty
  139. I (666) cpu_start: Compile time:     Jan 16 2024 18:38:52
  140. I (672) cpu_start: ELF file SHA256:  675f40854e405078...
  141. I (678) cpu_start: ESP-IDF:          v4.4.3-dirty
  142. I (683) heap_init: Initializing. RAM available for dynamic allocation:
  143. I (690) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
  144. I (696) heap_init: At 3FFB30A8 len 0002CF58 (179 KiB): DRAM
  145. I (703) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
  146. I (709) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
  147. I (715) heap_init: At 4008C47C len 00013B84 (78 KiB): IRAM
  148. I (723) spi_flash: detected chip: generic
  149. I (726) spi_flash: flash io: dio
  150. I (731) cpu_start: Starting scheduler on PRO CPU.
  151. I (0) cpu_start: Starting scheduler on APP CPU.
  152. I (743) gpio: GPIO[25]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
  153. I (753) gpio: GPIO[26]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
  154. I (763) serial_flasher: serial initialization succed.
  155. Cannot connect to target. Error: 2

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

Re: error in esp serial flasher: Cannot connect to target. Error: 2

Postby ESP_Sprite » Thu Jan 18, 2024 5:53 am

On those devboards, the UART pins already have the on-board USB-serial chip connected to them; that likely interferes with your signals.

suraj02
Posts: 4
Joined: Tue Jan 09, 2024 5:51 pm

Re: error in esp serial flasher: Cannot connect to target. Error: 2

Postby suraj02 » Thu Jan 18, 2024 10:48 am

@ESP_Sprite Thanks for your reply.
Can you tell me what are the possible solutions for this?

And this problem is with uart can i do this with SPI?
I also tried by giving 5v supply to slave ESP32 instead of USB data cable. But this not works.

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

Re: error in esp serial flasher: Cannot connect to target. Error: 2

Postby ESP_Sprite » Fri Jan 19, 2024 2:07 am

Trivial solution: use a hot-air rework station to get rid of the USB-to-serial converter on the 2nd board. Probably a better idea: design your own board for this.

Who is online

Users browsing this forum: No registered users and 85 guests