Page 1 of 1

OpenOCD with Sparkfun ESP32 Thing

Posted: Mon Feb 12, 2018 5:52 pm
by PiMaker
Hello,

I'm attempting to follow http://esp-idf.readthedocs.io/en/latest/api-guides/jtag-debugging/ to set up a Sparkfun ESP32 Thing but using the Segger J-Link Plus JTAG. I created an OpenOCD "board" configuration file for it by setting the following:

Code: Select all

transport select jtag
adapter_khz 20000
source [find target/esp32.cfg]


My CPU ID came back as 0x89001a65 instead of 0x120034e5, so I get errors:

Code: Select all

$ bin/openocd.exe -s share/openocd/scripts -f interface/jlink.cfg -f board/sparkfun-esp32-thing.cfg
Open On-Chip Debugger 0.10.0-dev-ga859564 (2017-07-24-16:18)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz
force hard breakpoints
Info : No device selected, using first device.
Info : J-Link V10 compiled Jan  9 2017 17:48:51
Info : Hardware version: 10.10
Info : VTarget = 3.277 V
Info : Reduced speed from 20000 kHz to 15000 kHz (maximum).
Info : Reduced speed from 20000 kHz to 15000 kHz (maximum).
Info : clock speed 20000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x89001a65 (mfg: 0x532 (<unknown>), part: 0x9001, ver: 0x8)
Warn : JTAG tap: esp32.cpu0       UNEXPECTED: 0x89001a65 (mfg: 0x532 (<unknown>), part: 0x9001, ver: 0x8)
Error: JTAG tap: esp32.cpu0  expected 1 of 1: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : TAP esp32.cpu1 does not have IDCODE
Info : JTAG tap: auto0.tap tap/device found: 0xf0400639 (mfg: 0x31c (SiliconBlue Technologies), part: 0x0400, ver: 0xf)
Error: Trying to use configured scan chain anyway...
Warn : AUTO auto0.tap - use "jtag newtap auto0 tap -irlen 2 -expected-id 0xf0400639"
Error: auto0.tap: IR capture error; saw 0x0003 not 0x0001
Warn : Bypassing JTAG setup events due to errors
Info : esp32: Debug controller was reset (pwrstat=0x40, after clear 0x40).


So, I changed it in esp32.cfg but got a different error:

Code: Select all

$ bin/openocd.exe -s share/openocd/scripts -f interface/jlink.cfg -f board/sparkfun-esp32-thing.cfg
Open On-Chip Debugger 0.10.0-dev-ga859564 (2017-07-24-16:18)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz
force hard breakpoints
Info : No device selected, using first device.
Info : J-Link V10 compiled Jan  9 2017 17:48:51
Info : Hardware version: 10.10
Info : VTarget = 3.277 V
Info : Reduced speed from 20000 kHz to 15000 kHz (maximum).
Info : Reduced speed from 20000 kHz to 15000 kHz (maximum).
Info : clock speed 20000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x820034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x8)
Info : TAP esp32.cpu1 does not have IDCODE
Info : JTAG tap: auto0.tap tap/device found: 0xf0400699 (mfg: 0x34c (XRONET Corporation), part: 0x0400, ver: 0xf)
Warn : AUTO auto0.tap - use "jtag newtap auto0 tap -irlen 2 -expected-id 0xf0400699"
Error: auto0.tap: IR capture error; saw 0x0003 not 0x0001
Warn : Bypassing JTAG setup events due to errors
Info : esp32: Debug controller was reset (pwrstat=0x40, after clear 0x40).


Really, I'm just fumbling around getting used to debugging on the ESP32 and I know I'll have to go through at least some of these steps when we implement it in our design so it's good practice. Can someone point me in the right direction? Thanks.

Re: OpenOCD with Sparkfun ESP32 Thing

Posted: Tue Feb 13, 2018 3:33 pm
by PiMaker
Just a note that this is what happens when your clock frequency is too high in the configuration.

First, the J-Link Plus states that the max interface speed is 15/50 MHz based on the model. Second, the impedance you create by connecting it will have a large effect on the frequency you can use.

I suspected a clock issue when I saw a few instances of the CPUID returning different values depending on how the wires were laying. Once I slowed it down to 10MHz, it was predictable and everything started working normally.