logo elektroda
logo elektroda
X
logo elektroda

Using the built-in USB Serial/JTAG Controller on the ESP32-C3 chip like a UART

TvWidget 7512 30
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19485282
    TvWidget
    Level 38  
    The ESP32-C3 chip has a built-in USB Serial/JTAG Controller. Is it possible to use this in your own program just like the UART ? If it is possible, how to do it ?
  • ADVERTISEMENT
  • #2 19485424
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #3 19485480
    TvWidget
    Level 38  
    In "Component config" I only found the option "Channel for console output". There, however, USB cannot be selected.
  • #4 19485520
    Anonymous
    Level 1  
  • #5 19485609
    TvWidget
    Level 38  
    In the case of this USB Serial on the ESP32-C3, is it possible to change the descriptor ?
  • #6 19485625
    Anonymous
    Level 1  
  • #7 19486141
    TvWidget
    Level 38  
    I am still puzzled by this JTAG Controller. Is it possible to enter a program via USB ?
  • ADVERTISEMENT
  • #8 19486143
    Anonymous
    Level 1  
  • #9 19486154
    TvWidget
    Level 38  
    Programming the ESP32 via USB seems to require that this port is triggered after a reset. So it can't just be about enabling the option in sdkconfig. The processor should have a software fuse for this. Am I combining things correctly ?
  • #10 19486264
    Anonymous
    Level 1  
  • #11 19486292
    TvWidget
    Level 38  
    Do I understand correctly that the USB port will always be enabled in "Download Boot" mode and in "SPI Boot" mode only if the corresponding option is set in sdkconfig ?
    Let's say I want to crash the device into an ESP32-C3 in the form of a USB dongle. If there is no button in it, will it fail to replace the firmware via USB ?
  • #12 19486308
    Anonymous
    Level 1  
  • #13 19486325
    TvWidget
    Level 38  
    khoam wrote:
    Not the USB port, but the ESP32-C3 chip itself can be set in one of these two modes. If it is set in "Download Boot" mode then it can be programmed from UART 0 or USB.
    .
    I am interested in the hardware aspect. When will the GPIO18 and GPIO19 pins be used for USB ? Is it always after a reset ?
    I don't need to replace the firmware via USB. I am just trying to understand when and what mode this port is used.
  • #14 19486334
    Anonymous
    Level 1  
  • #15 19486601
    TvWidget
    Level 38  
    I have a board with an ESP32-C3. I wanted to check in practice how it is with this USB. Is ESP-IDF 4.4 matching Elcipse on Windows available for download somewhere ?
    Or do you know when the official version 4.4 can be expected ?
  • #16 19486613
    Anonymous
    Level 1  
  • #17 19486652
    TvWidget
    Level 38  
    For Eclipse, this version 4.4 does not fit. Trying to display sdkconfig ends with an error. After creating a new project and trying to compile it, messages of type appear:
    Code: Python
    Log in, to see the code
    .
  • #18 19486662
    Anonymous
    Level 1  
  • #19 19486676
    TvWidget
    Level 38  
    Now the lwip is missing. How to "git clone the repository" ?
  • #21 19486935
    TvWidget
    Level 38  
    It turned out that in Eclipse you just have to select the master version and everything else will happen automatically. You don't even need to know the address where the ESP-IDF is located. The editor for the sdkconfig file now works too, and of course the "USB serial" option appeared in it.

    So far I have been using ESP32 but typing NodeMCU into them with minor adjustments. I found the LUA language very convenient in my applications. Unfortunately NodeMCU seems to have stopped at ESP-IDF 3.3. Replacing ESP-IDF with version 4 is beyond my capabilities. So when it comes to ESP32-C3 and USB, I am left with only native applications.
  • #22 19487144
    Anonymous
    Level 1  
  • #23 19493333
    TvWidget
    Level 38  
    I switched the console to USB in sdkconfig. Everything basically works. However, it seems to me that sending a new message e.g. using printf interrupts the sending of the previous one. Is there any mechanism to wait for all the characters in the buffer to be sent ?

    By the way... USB programming works in "spi boot" mode.

    I tried to use the JTAG Controller via USB. I selected in Eclipse "ESP-IDF GDB OpenOCD Debugging" but the program is looking for an FTDI chip. Am I doing something wrong ?
    Code: Python
    Log in, to see the code
    .
  • #24 19493374
    Anonymous
    Level 1  
  • #25 19493397
    TvWidget
    Level 38  
    khoam wrote:
    Did you configure the USB driver according to Link ?
    .
    USB works but VID=0x303A and PID=0x1001. The program expects a JTAG adapter based on FTDI. Probably something wrong I selected in Eclipse or I don't have something installed.
  • #26 19493492
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #27 19494298
    TvWidget
    Level 38  
    Or do you know from which version of ESP-IDF is EPS32-C3 supported ?
  • #28 19494299
    Anonymous
    Level 1  
  • #29 19494523
    TvWidget
    Level 38  
    khoam wrote:
    I think the driver " Espressif - WinUSB support for JTAG (ESP32-C3) " is not properly installed.
    .
    Under Run->Debug configurations... I can create a so-called new configuration for ESP-IDF GDB OpenOCD Debugging .
    After this operation, a window with several tabs appears. One of them is Debugger . After selecting it, in the field Config Options something like this is entered:
    -s ${openocd_path}/share/openocd/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover-kit-1.8v.cfg .
    Following the information on this page https://docs.espressif.com/projects/esp-idf/e...l#jtag-debugging-tip-openocd-configure-target
    I typed -s ${openocd_path}/share/openocd/scripts -f interface/esp_usb_jtag.cfg -f board/esp32c3-builtin.cfg .
    Now this error appears:
    Code: Python
    Log in, to see the code
    .
    Is there anything else I should install ?
  • #30 19494835
    Anonymous
    Level 1  

Topic summary

The ESP32-C3 chip features a built-in USB Serial/JTAG Controller that can be utilized similarly to a UART for console output. To enable this functionality, users must select CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG in the sdkconfig, which is available in ESP-IDF version 4.4 and later. Programming via USB requires the chip to be in "Download Boot" mode, which can be triggered by manipulating GPIO states during reset. Users have reported challenges with USB driver configurations and JTAG debugging setups in Eclipse, particularly regarding driver recognition and communication issues. The discussion also touches on the use of Arduino Core for ESP32 and the importance of ensuring proper installation of dependencies for successful operation.
Summary generated by the language model.
ADVERTISEMENT