Page 1 of 1

Detect presence of JTAG / Detect IO_MUX is in JTAG mode.

Posted: Wed Jun 26, 2019 5:41 am
by nevercast
Hello,

My understanding of JTAG is that it is mutiplexed through IO_MUX on the VSPI bus. Pads (GPIO) 13, 14, 15, 16.

Due to a limit of GPIO (We have used every pin on the ESP32 PICO) we are using VSPI for an SPI peripheral. We cannot share this with HSPI or any other pins (they are in use). Can I detect when JTAG is in use by reading the IO_MUX registers? It does not seem to be documented in the IO_MUX Function table. From my application I wish to detect that JTAG is in use and bypass the code path that reads from the VSPI peripheral. How can this be achieved?

Cheers.

Re: Detect presence of JTAG / Detect IO_MUX is in JTAG mode.

Posted: Wed Jun 26, 2019 6:08 am
by ESP_igrr
There is a function called "esp_cpu_in_ocd_debug_mode" which can be used for this purpose. See for example https://github.com/espressif/esp-idf/bl ... host.c#L52

Re: Detect presence of JTAG / Detect IO_MUX is in JTAG mode.

Posted: Wed Jun 26, 2019 10:07 pm
by nevercast
ESP_igrr wrote: There is a function called "esp_cpu_in_ocd_debug_mode" which can be used for this purpose. See for example https://github.com/espressif/esp-idf/bl ... host.c#L52
Thanks! This is exactly what I am looking for. I cannot find documentation for this function and the ESP IDF says to not share the VSPI bus with any other function when using JTAG (a warning I'm going to have to ignore in our application). Is esp_cpu_in_ocd_debug_mode() a stable API or can I expect it to possibly change in the future, since it is not documented?