ESP32S3 : Write to the USB/JTAG port does not work properly !

ThomasESP32
Posts: 206
Joined: Thu Jul 14, 2022 5:15 am

ESP32S3 : Write to the USB/JTAG port does not work properly !

Postby ThomasESP32 » Tue May 07, 2024 1:55 pm

Good afternoon,

I am working with an Esp32S3. In the sdkconfig file, I have
defined the USB/JTAG port as output for the console.

So, when the firmware is resetted, I can see outputs from the firmware on this console.

Now, I would like to write thing to this console from my firmware manually. So I have installed the usb_jtag driver this way :

usb_serial_jtag_driver_config_t usb_serial_jtag_config;
usb_serial_jtag_config.rx_buffer_size = COM_MSG_MAX_LEN;
usb_serial_jtag_config.tx_buffer_size = COM_MSG_MAX_LEN;
Err = usb_serial_jtag_driver_install(&usb_serial_jtag_config);

Using the usb_serial_jtag_read_bytes(DataRead, COM_MSG_MAX_LEN, 50); I can get string that I enter in my firmware and do some actions. Here, everything is ok.

However, when I use the usb_serial_jtag_write_bytes(Msg, Length, 0); function in order to write thing to the console.
The strings that I want to output are not written at all... I need to wait that the firmware write something to the console automatically (For example, when I start a driver or something like that), in order to see my lines...


Do you know why please ?
Could you help me on this subject please ?

Best regards,

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

Re: ESP32S3 : Write to the USB/JTAG port does not work properly !

Postby ESP_Sprite » Wed May 08, 2024 6:32 am

The USB-serial-JTAG unit buffers up to 64 bytes before sending it to the host, to make optimal use of the USB protocol bandwidth. If you write less than that and want the host to get it, you'll need to call the function to flush it make it send the buffer.

ThomasESP32
Posts: 206
Joined: Thu Jul 14, 2022 5:15 am

Re: ESP32S3 : Write to the USB/JTAG port does not work properly !

Postby ThomasESP32 » Fri May 10, 2024 8:18 am

Could you tell me what is the function to use in order to flush the datas ?
I don't see it in the library.

Or could you please provide me an example to send the 64 bytes of datas at each call of the write methods ?

Best regards,

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

Re: ESP32S3 : Write to the USB/JTAG port does not work properly !

Postby ESP_Sprite » Fri May 10, 2024 8:34 am

Hm, looking at the code, the driver should actually be smart enough to do the flush automatically. I think that code changed a bit recently, though. What ESP-IDF version are you using?

ThomasESP32
Posts: 206
Joined: Thu Jul 14, 2022 5:15 am

Re: ESP32S3 : Write to the USB/JTAG port does not work properly !

Postby ThomasESP32 » Fri May 10, 2024 8:41 am

Ok,
what is strange is that two weeks ago, printing on the console using usb_jtag_write worked properly.

Now, I try with the ESP-IDF 5.1.4 and it dos not work.
I have also tried with the 5.2.0 and 5.2.1 version and the result is the same.

I don't understand what has changed since two weeks ago.

Best regards,

ThomasESP32
Posts: 206
Joined: Thu Jul 14, 2022 5:15 am

Re: ESP32S3 : Write to the USB/JTAG port does not work properly !

Postby ThomasESP32 » Fri May 10, 2024 10:05 am

Do you have other ideas please ?
When I install the driver, I define the tx and rx buffer size to 256 bytes. (This is not 64 bytes but it worked before).
Do you think 64 is the max size I should define ??

When I send datas to the usb_jtag driver do you think I should
always but 64 as tx size when I cann the usb_jtag_write function ?

ThomasESP32
Posts: 206
Joined: Thu Jul 14, 2022 5:15 am

Re: ESP32S3 : Write to the USB/JTAG port does not work properly !

Postby ThomasESP32 » Fri May 10, 2024 12:14 pm

The problem was the ESP-IDF version.
Using the 5.3 Release solve the problem.

Thank you !

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

Re: ESP32S3 : Write to the USB/JTAG port does not work properly !

Postby ESP_Sprite » Fri May 10, 2024 2:26 pm

Glad you got it to work with the new esp-idf version!

Who is online

Users browsing this forum: Bing [Bot] and 121 guests