ESP32-S3 disabling JTAG

atlex92
Posts: 4
Joined: Fri Feb 14, 2020 2:00 pm

ESP32-S3 disabling JTAG

Postby atlex92 » Mon Feb 12, 2024 8:24 am

Hi.

I'm working with esp32-s3 devkit N32R8V version:
https://docs.espressif.com/projects/esp ... itc-1.html

According to documentation, GPIO_39, GPIO_40, GPIO_41, GPIO_42 are occupied for JTAG and can't be used as GPIOs (e.g. in OUTPUT mode for push/pull operations).

As far as I understood, usage of JTAG can be disabled with eFuses.

https://docs.espressif.com/projects/esp ... ESP32%2DS3.
Here it is said:
Burning DIS_USB_JTAG eFuse will permanently disable the connection between USB_SERIAL_JTAG and the JTAG port of the ESP32-S3.
But when I run

Code: Select all

espefuse --port /dev/ttyUSB0 summary
I got
Security fuses:
FLASH_CRYPT_CNT Flash encryption mode counter = 0 R/W (0x0)
FLASH_CRYPT_CONFIG Flash encryption config (key tweak bits) = 0 R/W (0x0)
CONSOLE_DEBUG_DISABLE Disable ROM BASIC interpreter fallback = 0 R/W (0x0)
ABS_DONE_0 secure boot enabled for bootloader = 0 R/W (0x0)
ABS_DONE_1 secure boot abstract 1 locked = 0 R/W (0x0)
JTAG_DISABLE Disable JTAG = 0 R/W (0x0)
DISABLE_DL_ENCRYPT Disable flash encryption in UART bootloader = 0 R/W (0x0)
DISABLE_DL_DECRYPT Disable flash decryption in UART bootloader = 0 R/W (0x0)
DISABLE_DL_CACHE Disable flash cache in UART bootloader = 0 R/W (0x0)
So I can see only JTAG_DISABLE eFuse, not DIS_USB_JTAG.

When I try to run

Code: Select all

espefuse --port /dev/ttyUSB0 burn_efuse JTAG_DISABLE 1
I receive this:
espefuse.py v2.8
Connecting....
Burning efuse JTAG_DISABLE (Disable JTAG) 0x0 -> 0x1. This is an irreversible operation.
Type 'BURN' (all capitals) to continue.
BURN
WARNING: Detected crystal freq 0.00MHz is quite different to normalized freq 26MHz. Unsupported crystal in use?

A fatal error occurred: Efuse JTAG_DISABLE failed to burn. Protected?
What I am doing wrong? And is there a way to disable JTAG to be able to use GPIO_39, GPIO_40, GPIO_41, GPIO_42 for my own purposes?

ESP_Sprite
Posts: 9772
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3 disabling JTAG

Postby ESP_Sprite » Tue Feb 13, 2024 1:55 am

atlex92 wrote:
Mon Feb 12, 2024 8:24 am
According to documentation, GPIO_39, GPIO_40, GPIO_41, GPIO_42 are occupied for JTAG and can't be used as GPIOs (e.g. in OUTPUT mode for push/pull operations).
You are correct in that these are the JTAG pin, but mistaken in that they are occupied like this by default (by default, the USB32-S3 uses the USB-serial-JTAG converter, not discrete JTAG pins) and also wrong in that they cannot be used as GPIOs. You can easily reconfigure them using the same function calls you use to initialize other GPIOs to whatever function you want.

atlex92
Posts: 4
Joined: Fri Feb 14, 2020 2:00 pm

Re: ESP32-S3 disabling JTAG

Postby atlex92 » Tue Feb 13, 2024 10:04 am

ESP_Sprite wrote:
Tue Feb 13, 2024 1:55 am
atlex92 wrote:
Mon Feb 12, 2024 8:24 am
According to documentation, GPIO_39, GPIO_40, GPIO_41, GPIO_42 are occupied for JTAG and can't be used as GPIOs (e.g. in OUTPUT mode for push/pull operations).
You are correct in that these are the JTAG pin, but mistaken in that they are occupied like this by default (by default, the USB32-S3 uses the USB-serial-JTAG converter, not discrete JTAG pins) and also wrong in that they cannot be used as GPIOs. You can easily reconfigure them using the same function calls you use to initialize other GPIOs to whatever function you want.
Actually I tried to configure them in OUTPUT mode and then perform push/pull operations. But Then I can't see 3.3V on these pins when I set logic '1' there. Can it be particularly issue with EPS32-S3 Espressif's devkit? Like these pins are internally connected with some pull down resistors etc.?

ESP_Sprite
Posts: 9772
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3 disabling JTAG

Postby ESP_Sprite » Wed Feb 14, 2024 2:03 am

How did you configure them? You may need to do an gpio_reset_pin() on the GPIO to get them out of JTAG mode.

atlex92
Posts: 4
Joined: Fri Feb 14, 2020 2:00 pm

Re: ESP32-S3 disabling JTAG

Postby atlex92 » Thu Feb 15, 2024 7:50 am

ESP_Sprite wrote:
Wed Feb 14, 2024 2:03 am
How did you configure them? You may need to do an gpio_reset_pin() on the GPIO to get them out of JTAG mode.
It was just with gpio_set_direction.

But gpio_reset_pin solved everything. Thanks a lot!

radurotaru19
Posts: 4
Joined: Wed Dec 07, 2022 2:09 pm

Re: ESP32-S3 disabling JTAG

Postby radurotaru19 » Tue Mar 26, 2024 9:25 pm

Hi guys,

I am facing a similar issue with using these pins. I have a custom hardware board and I am using GPIO 39 to 42 for SPI

GPIO39 SCK
GPIO40 MISO
GPIO41 MOSI
GPIO42 CS

After boot, the SPI connected device works for 2 seconds then it just drops.
I created an issue here viewtopic.php?f=13&t=38902 and here https://github.com/espressif/esp-idf/issues/13478

Any help would be appreciated as I've spent 30h+ on this so far.

Marc-Aurele
Posts: 15
Joined: Mon Jan 07, 2019 3:48 pm

Re: ESP32-S3 disabling JTAG

Postby Marc-Aurele » Thu May 02, 2024 8:37 am

atlex92 wrote:
Thu Feb 15, 2024 7:50 am
ESP_Sprite wrote:
Wed Feb 14, 2024 2:03 am
How did you configure them? You may need to do an gpio_reset_pin() on the GPIO to get them out of JTAG mode.
It was just with gpio_set_direction.

But gpio_reset_pin solved everything. Thanks a lot!
Indeed, great, it is working.

thx

Who is online

Users browsing this forum: No registered users and 69 guests