JTAG conflicts with I2C

marclee
Posts: 51
Joined: Fri Apr 09, 2021 1:09 pm

JTAG conflicts with I2C

Postby marclee » Fri Apr 09, 2021 1:50 pm

JTAG programming doesn't work if running firmware contains I2C

Device: ESP32-S2-Saola-1R, containing ESP32-S2-WROOVER
JTAG-Programmer: Segger JLINK

JTAG pins are connected correctly and programming of a fresh device works fine unless I2C ist implemented in running firmware.

openocd -d2 -f openocd.cfg -c "init; reset halt; program_esp build/file.bin 0x10000 verify reset exit"

openocd.cfg:
source [find interface/jlink.cfg]
source [find target/esp32s2.cfg]
adapter_khz 10000


Once the running firmare contains I2C, JTAG doesn't work any more:
  1. Open On-Chip Debugger  v0.10.0-esp32-20200709 (2020-07-09-08:54)
  2. Licensed under GNU GPL v2
  3. For bug reports, read
  4.     http://openocd.org/doc/doxygen/bugs.html
  5. debug_level: 2
  6.  
  7. adapter speed: 10000 kHz
  8.  
  9. Info : J-Link V10 compiled Mar  7 2019 15:19:19
  10. Info : Hardware version: 10.10
  11. Info : VTarget = 3.328 V
  12. Info : clock speed 10000 kHz
  13. Info : JTAG tap: esp32s2.cpu tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
  14. Info : esp32s2: Target halted, PC=0x40000400, debug_reason=00000001
  15. Info : Detected ESP32-S2 chip
  16. Info : Listening on port 3333 for gdb connections
  17. Info : JTAG tap: esp32s2.cpu tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
  18. Info : esp32s2: Target halted, PC=0x400003C3, debug_reason=00000000
  19. Info : esp32s2: Core 0 was reset.
  20. Info : esp32s2: Target halted, PC=0x40000400, debug_reason=00000000
  21. ** Programming Started **
  22. Info : esp32s2: Target halted, PC=0x4003001C, debug_reason=00000001
  23. Info : Flash mapping 0: 0x9a80020 -> 0xc010aab0, 158272 KB
  24. Info : Flash mapping 1: 0x980020c0 -> 0xfe9fa108, 3147814 KB
  25. Info : Flash mapping 2: 0x0 -> 0x1240b80, 0 KB
  26. Info : Flash mapping 3: 0x1211fc0 -> 0x0, 18471 KB
  27. Info : Flash mapping 4: 0x0 -> 0x10000, 0 KB
  28. Info : Flash mapping 5: 0xf8f3b80 -> 0x7fff, 0 KB
  29. Info : Flash mapping 6: 0x0 -> 0x0, 0 KB
  30.  
  31. ...
  32. much more lines like this
  33. ...
  34.  
  35. Segmentation fault
I2C-Code:
  1. esp_err_t i2c_device_init(void)
  2. {
  3.   i2c_config_t conf = \
  4.   {
  5.     .mode = I2C_MODE_MASTER,
  6.     .sda_io_num = 34,
  7.     .sda_pullup_en = GPIO_PULLUP_DISABLE,
  8.     .scl_io_num = 35,
  9.     .scl_pullup_en = GPIO_PULLUP_DISABLE,
  10.     .master.clk_speed = 50000,
  11.   };
  12.  
  13.   esp_err_t err = i2c_param_config(I2C_NUM_0, &conf);
  14.  
  15.   if (err != ESP_OK) { return (err); }
  16.   else { return (i2c_driver_install(I2C_NUM_0, conf.mode, 0, 0, 0))
  17. }
JTAG pins don't conflict with I2C pin mapping.

JTAG works if I start the device in BOOT mode (GPIO0 = LOW during reset). But we don't want the need of pressing a button while updating firmware.

Does anybody has an idea how to get JTAG working even if I2C is running?

Best regards, Marc

Who is online

Users browsing this forum: No registered users and 109 guests