how can i use USB-SERIAL port communicate with PC?

wanzhilin88
Posts: 25
Joined: Sat Jan 08, 2022 3:11 am

how can i use USB-SERIAL port communicate with PC?

Postby wanzhilin88 » Sun Jan 16, 2022 2:01 am

hello!
i want communicate with PC by using esp32-c3's USB-SERIAL-JTAG port as usual uart,
but,i don't known how to initialize it,don't know which API can send data to the usb-serial port or receive data from it.
would you tell me the details?

there are some functions in ESP-IDF 4.4:
static void usb_serial_jtag_write_and_flush(const uint8_t *buf, uint32_t wr_len)
static void usb_serial_jtag_isr_handler_default(void *arg)
esp_err_t usb_serial_jtag_driver_install(usb_serial_jtag_driver_config_t *usb_serial_jtag_config)
int usb_serial_jtag_read_bytes(void* buf, uint32_t length, TickType_t ticks_to_wait)
int usb_serial_jtag_write_bytes(const void* src, size_t size, TickType_t ticks_to_wait)

these functions are interface of usb-serial-jtag port?how to use it? where to find examples about?

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

Re: how can i use USB-SERIAL port communicate with PC?

Postby ESP_Sprite » Sun Jan 16, 2022 11:34 am

The most trivial use case is to use menuconfig to configure the USB-serial-JTAG as your standard input/output. You can then use the standard Unix functions (printf, getc, ...) to use it.

wanzhilin88
Posts: 25
Joined: Sat Jan 08, 2022 3:11 am

Re: how can i use USB-SERIAL port communicate with PC?

Postby wanzhilin88 » Mon Jan 17, 2022 12:38 am

good,thanks very much.

wangshuoran
Posts: 37
Joined: Fri Dec 24, 2021 12:40 pm

Re: how can i use USB-SERIAL port communicate with PC?

Postby wangshuoran » Sat Jan 22, 2022 4:20 am

ESP_Sprite wrote:
Sun Jan 16, 2022 11:34 am
The most trivial use case is to use menuconfig to configure the USB-serial-JTAG as your standard input/output. You can then use the standard Unix functions (printf, getc, ...) to use it.
If my upper computer send datas to esp32-c3, what function or API let esp32-c3 capture these data?

wanzhilin88
Posts: 25
Joined: Sat Jan 08, 2022 3:11 am

Re: how can i use USB-SERIAL port communicate with PC?

Postby wanzhilin88 » Wed Jan 26, 2022 7:54 am

in my example, i try to use the function:usb_serial_jtag_write_bytes() to get data from PC
but this function work not good.
sometimes it can get data form PC,sometimes can not.

wanzhilin88
Posts: 25
Joined: Sat Jan 08, 2022 3:11 am

Re: how can i use USB-SERIAL port communicate with PC?

Postby wanzhilin88 » Wed Jan 26, 2022 7:56 am

sorry, i mean usb_serial_jtag_read_bytes()

wangshuoran
Posts: 37
Joined: Fri Dec 24, 2021 12:40 pm

Re: how can i use USB-SERIAL port communicate with PC?

Postby wangshuoran » Sun Feb 13, 2022 1:55 am

thank you. If you use scanf or gets maybe easy to realize function.

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 389 guests