Page 1 of 1

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

Posted: Tue May 07, 2024 1:55 pm
by ThomasESP32
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,

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

Posted: Wed May 08, 2024 6:32 am
by ESP_Sprite
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.

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

Posted: Fri May 10, 2024 8:18 am
by ThomasESP32
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,

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

Posted: Fri May 10, 2024 8:34 am
by ESP_Sprite
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?

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

Posted: Fri May 10, 2024 8:41 am
by ThomasESP32
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,

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

Posted: Fri May 10, 2024 10:05 am
by ThomasESP32
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 ?

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

Posted: Fri May 10, 2024 12:14 pm
by ThomasESP32
The problem was the ESP-IDF version.
Using the 5.3 Release solve the problem.

Thank you !

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

Posted: Fri May 10, 2024 2:26 pm
by ESP_Sprite
Glad you got it to work with the new esp-idf version!