Page 1 of 1

esp32 -Jtag Programming

Posted: Fri May 29, 2020 7:45 am
by Swagger
Hi,

I am trying to program the esp32 chip using JTAG. I had developed a custom PCB over the esp32 module. Now I want to program the module. I don't have a USB port implemented in my PCB, I thought I could program the module using JTAG programmer.


I bought the Espressif ESP-PROG module. I'm a little confused about how to program my device. Till now I was programming the module using USB from my IDF. Can anyone help me address this? Can I program my device using this ESP_PROG from my IDF itself, or do I need to install openocd.

https://www.mouser.in/ProductDetail/Esp ... jJ8r9cdg==

Re: esp32 -Jtag Programming

Posted: Fri May 29, 2020 9:19 am
by ESP_igrr
Hi Swagger,

Please check https://docs.espressif.com/projects/esp ... -debugging for the JTAG programming instructions. If you have ESP-IDF v4.0 or later installed, OpenOCD should be already installed as part of the tools setup.

Re: esp32 -Jtag Programming

Posted: Sun May 31, 2020 4:00 am
by Swagger
thanks.

Re: esp32 -Jtag Programming

Posted: Thu Jun 18, 2020 11:57 am
by Swagger
Hi, I had gone through the documents you suggested.

I am programming esp32 Wrover b chip on my on PCB.

I had used the below command to upload the firmware to the esp32 using jtag. I was using esp -prog
------------------------------
openocd -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover.cfg -c "program_esp32 firmware.bin 0x10000 verify exit"
------------------------------

.........................................................................................................................................................................
this was the output obtained for me:
** Programming Started **
auto erase enabled
Info : Target halted. PRO_CPU: PC=0x4009171A (active) APP_CPU: PC=0x40000400
Warn : Empty flash mapping!
Warn : Failed to get flash mappings (0)!
Info : Target halted. PRO_CPU: PC=0x4009171A (active) APP_CPU: PC=0x40000400
Info : Target halted. PRO_CPU: PC=0x4009171A (active) APP_CPU: PC=0x40000400
Info : Auto-detected flash size 16384 KB
Info : Using flash size 16384 KB
Info : Target halted. PRO_CPU: PC=0x4009171A (active) APP_CPU: PC=0x40000400
Info : Target halted. PRO_CPU: PC=0x4009171A (active) APP_CPU: PC=0x40000400
wrote 1404928 bytes from file firmware.bin in 5.225871s (262.540 KiB/s)
** Programming Finished **
** Verify Started **
Info : Target halted. PRO_CPU: PC=0x4009171A (active) APP_CPU: PC=0x40000400
read 1404336 bytes from file firmware.bin and flash bank 0 at offset 0x00010000 in 4.950472s (277.029 KiB/s)
contents match
** Verified OK **
shutdown command invoked
Warn : Flash driver of esp32.flash does not support free_driver_priv()
Warn : Flash driver of irom does not support free_driver_priv()
Warn : Flash driver of drom does not support free_driver_priv()

.............................................................................................................................................................

after this my program should run rght, but it is not running , i got verified but not able to get the program working. any idea guys?

Re: esp32 -Jtag Programming

Posted: Mon Jun 22, 2020 12:20 pm
by Swagger
Solved. You should include reset command while flashing the board.
openocd -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover.cfg -c "program_esp32 firmware.bin 0x10000 verify reset exit"

Re: esp32 -Jtag Programming

Posted: Fri Jun 26, 2020 10:44 pm
by Scott.Bonomi
I am having a similar issue, with a JTAG connection using a JLINK. I seem to be reading the device correctly, I have set the interface speed down to 1 MHz I believe and It appears I am not getting an expected response. This is using the WINUSB driver for the JLINK, as suggested in the OCD instructions. I have also connected the VTref line to the 3p3 off the DevC kit.


Open On-Chip Debugger v0.10.0-esp32-20190313 (2019-03-13-09:57)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1000 kHz
Info : Configured 1 cores
esp32 interrupt mask on
Info : J-Link V11 compiled Jun 9 2020 13:38:27
Info : Hardware version: 11.00
Info : VTarget = 3.348 V
Info : clock speed 1000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 0 was reset (pwrstat=0x5F, after clear 0x0F).
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 : Target halted. PRO_CPU: PC=0x4014A8D2
Error: cpu0: xtensa_write_memory (line 802): DSR (FFFFFFFF) indicates target still busy!
Error: cpu0: xtensa_write_memory (line 802): DSR (FFFFFFFF) indicates DIR instruction generated an exception!
Error: cpu0: xtensa_write_memory (line 802): DSR (FFFFFFFF) indicates DIR instruction generated an overrun!
Warn : esp32: Failed writing 4 bytes at address 0x3ff48000, data - 00, 20, 49, 9c, 4c, 00, 00, 00
Error: xtensa_write_uint32_list: error writing to 3ff48000
Warn : esp32_soc_reset xtensa_write_uint32_list (reg_value_pairs_pre) err=-4
in procedure 'program_esp32'

embedded:startup.tcl:480: Error: ** Unable to reset target **
in procedure 'program_esp32'
in procedure 'program_error' called at file "C:\Users\sbonomi\.espressif\tools\openocd-esp32\v0.10.0-esp32-20190313\openocd-esp32\share\openocd\scripts/target/esp32.cfg", line 119
at file "embedded:startup.tcl", line 480
Warn : Flash driver of esp32.flash does not support free_driver_priv()
Warn : Flash driver of irom does not support free_driver_priv()
Warn : Flash driver of drom does not support free_driver_priv()

I have a small uncertainty about the part identification, JTAG is claiming ver 0x1, and the USB flash load function of idf.py calls it a rev 3.

Thanks
- - Scott