ESP32-S3 JTAG ROM UART

**txf**
Posts: 12
Joined: Thu Apr 21, 2022 3:03 pm

ESP32-S3 JTAG ROM UART

Postby **txf** » Thu Jul 28, 2022 2:08 pm

Hi,

I have an application where I need to be able to flash and have uart printing via USB. So I'm using the JTAG ROM UART. I configured it using the function from the examples and this forum:

Code: Select all

    setvbuf(stdin, NULL, _IONBF, 0);
    /* Minicom, screen, idf_monitor send CR when ENTER key is pressed */
    esp_vfs_dev_usb_serial_jtag_set_rx_line_endings(ESP_LINE_ENDINGS_CR);
    /* Move the caret to the beginning of the next line on '\n' */
    esp_vfs_dev_usb_serial_jtag_set_tx_line_endings(ESP_LINE_ENDINGS_CRLF);
    
    /* Enable non-blocking mode on stdin and stdout */
    fcntl(fileno(stdout), F_SETFL, 0);
    fcntl(fileno(stdin), F_SETFL, 0);

    usb_serial_jtag_driver_config_t usb_serial_jtag_config = (usb_serial_jtag_driver_config_t){256,256};

    /* Install USB-SERIAL-JTAG driver for interrupt-driven reads and writes */
    esp_err_t ret = usb_serial_jtag_driver_install(&usb_serial_jtag_config);
    
    if (ret != ESP_OK) {

    }

        /* Tell vfs to use usb-serial-jtag driver */
    esp_vfs_usb_serial_jtag_use_driver();
It works, but with one major issue. It blocks unless I have a terminal (or some other program) opening the Serial/COM Port.

Is there any way to printfs from blocking program execution?

**txf**
Posts: 12
Joined: Thu Apr 21, 2022 3:03 pm

Re: ESP32-S3 JTAG ROM UART

Postby **txf** » Thu Jul 28, 2022 6:19 pm

I should answer my own question.

I'll leave the answer here in case somebody needs find it via google or something.

replace:

Code: Select all

esp_vfs_usb_serial_jtag_use_driver();
with

Code: Select all

esp_vfs_usb_serial_jtag_use_nonblocking();
And it should not block.

Who is online

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