ESP32-S3 USB JTAG bridge ?

adrien_m
Posts: 3
Joined: Thu Jan 20, 2022 1:04 pm

ESP32-S3 USB JTAG bridge ?

Postby adrien_m » Thu Jan 20, 2022 1:28 pm

I understand from the TRM that it should be possible to use the USB JTAG controller as a bridge to an external device by setting this register :
USB_SERIAL_JTAG_USB_JTAG_BRIDGE_EN Set this bit usb_jtag, the connection between
usb_jtag and internal JTAG is disconnected, and MTMS, MTDI, MTCK are output through GPIO
Matrix, MTDO is input through GPIO Matrix. (R/W)
However I was not able to get this to work.
Is this possible ? Am I missing something here ? (maybe some setup needed related to the GPIO matrix ?)

Thanks
Attachments
esp32jtagtrm.png
esp32jtagtrm.png (130.12 KiB) Viewed 3970 times

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

Re: ESP32-S3 USB JTAG bridge ?

Postby ESP_Sprite » Fri Jan 21, 2022 2:12 am

Yes. You need to route the signals out through the GPIO matrix. Here's some code (note: it's a modified example of test code for another chip; I haven't tested it on an actual C3, but it should get you on the way)

Code: Select all

	WRITE_PERI_REG(USB_SERIAL_JTAG_CONF0_REG, READ_PERI_REG(USB_SERIAL_JTAG_CONF0_REG)|USB_SERIAL_JTAG_USB_JTAG_BRIDGE_EN);

    esp_rom_gpio_connect_out_signal(3, 36, false, false); //tck
    esp_rom_gpio_connect_out_signal(4, 37, false, false); //tms
    esp_rom_gpio_connect_out_signal(5, 38, false, false); //tdi
    esp_rom_gpio_connect_out_signal(8, 127, false, false); //srst, wire to reset or EN of target
    esp_rom_gpio_connect_in_signal(9, 39, false); //tdo
    
(Note that this uses GPIO 3,4,5,8,9, but you can pick any GPIO for any signal.)

I'd be interested to hear if you get this to work, I can't remember if we tested this functionality after tapeout.

adrien_m
Posts: 3
Joined: Thu Jan 20, 2022 1:04 pm

Re: ESP32-S3 USB JTAG bridge ?

Postby adrien_m » Fri Jan 21, 2022 9:02 am

Thanks, however this is for the C3, I'm looking at the S3 and in the TRM the only signal numbers documented are usb_jtag_tdo_bridge (as an input, seems strange ?) and usb_jtag_trst.
Do you know if the other signals are missing from the documentation ? Or if it's just not possible to route them on this device ?
Attachments
esp32s3matrix.png
esp32s3matrix.png (121.97 KiB) Viewed 3947 times

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

Re: ESP32-S3 USB JTAG bridge ?

Postby ESP_Sprite » Fri Jan 21, 2022 9:15 am

Whoops, you're right, in my mind there's less of a reason to use that functionality in the 'big' S3 so my mind automagically assumed it was about the C3.
Looks like it's not in the TRM, we probably need to fix that. TCK, TMS and TDI are signal 85-87; TRST is 251 (in the output matrix), TDO is 251 (in the input matrix). You should use the same code I posted earlier, simply substitute the numbers.

adrien_m
Posts: 3
Joined: Thu Jan 20, 2022 1:04 pm

Re: ESP32-S3 USB JTAG bridge ?

Postby adrien_m » Fri Jan 21, 2022 10:27 am

Great, doing a very quick test I can see what looks like correct signals output from the pins with my logic analyzer, I will report after doing a full test.

Who is online

Users browsing this forum: No registered users and 43 guests