Debugging fails due to conflicting usage of GPIOs

Hi altogether,

I’m trying to use an ESP-Prog to debug a sketch running on an ESP32 with an ILI9341 touchscreen on a pre-built board, which connects ESP32 and the touchscreen.

While debugging a simple blink-demo (without the touchscreen) works fine, the debug session can’t be established when all components (ESP32, Touchscreen and ESP-Prog) are connected. First I was a little bit puzzled, 'til I recognized that the reason is the usage of the GPIOs 14 and 15 which are used by the board designer to control background light of the touchscreen resp. as chip select for the touchscreen. Unfortunately these ports are obviously part of the JTAG interface of the ESP32 (TMS/TDO).

To avoid this clash I see two (theoretical) solutions. Separating PCB-tracks and reconnecting to alternate GPIOs (16 and 17 look fine) or reassigning TMS/CDO to these GPIOs - possibly via something like PIN_FUNC_SELECT. However after reading some docs I am in doubt that the latter will work.

Could somebody please give me an advice how to proceed?

You have to change the SPI pins in the user_setup.h file. The touchscreen in it’s default definition is in conflict with the ESP-prog.

Hello heinzmuellerger,

thx for your reply. Unfortunately I do not believe, that the SPI settings are part of my particular problem - as they are yet already assigned to other GPIOs. To make things - hopefully :wink: - a little bit clearer I’ll add the schematics for the relevant parts of the pre-build board


My problem is, that I am still hesitating to cut the PCB lines and replace them by some wire to the alternate GPIOs and I would still prefer a less invasive method (reassigning TDO/TCK to other GPIOs), but I am in doubt that this is really possible.

Kind regards

arduhe

What I miss in the schematics are the wires of the debugger.
I use a EP32_DEVKIT_V1 and can debug with the esp-prog perfectly.

The esp-prog is connected to the default GPIOs for my ESP32, i.e.

  • TMS → GPIO14
  • TCK → GPIO13
  • TDO → GPIO15
  • TDI → GPIO12

and works absolutely fine - as long as I do not try to access the touchscreen via the pins 14/15 from my sketch, for example when running a simple blink-sketch. Debugging also is working when I alter the pin numbers in my sketch to 16/17, but of course the touchscreen is not working with this setting :wink:

This cannot work as GPIO14 (ESP_Prog Module TMS: test mode select) and GPIO15 (ESP_Prog Module TDO: test data out) are part of the esp-prog. They cannot serve the TFT display the same time.

What pre-built board do you have?

Well - this is really obvious and no new finding.

The main question is still remaining - is it possible to reassign TMS/CDO to other ports to avoid the conflict. I am in doubt that is possible, because - as far as I understood - reassigning JTAG lines, which are connected internally via IO_MUX, is not as free as it would be if they were connected to the GPIO matrix. It would be fine if somebody could please confirm that or otherwise explain how to proceed.

1 Like

Per ESP32D2WD SPI and JTAG pin with MUX - ESP32 Forum it seems that it is not possible to reassign the JTAG pins.

1 Like

Thx Boris,

this was the missing link I was looking for. Unfortunately my own searches in the esp-forum didn’t match this

You’re welcome!

Unfortunately, you have to cut the wires and re-route.

1 Like