questions around new uart component

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

questions around new uart component

Postby jumjum123 » Mon Nov 14, 2016 9:05 am

After seeing new files in ESP-IDF for uart, I tried to get my hands on.
First step was to get a better understanding whats going on behind the curtain.
As expected I have a lot of questionmarks, would be great if somebody could help
- is it possible, to use UART2 without rx ? AFAIK with devkit only tx is available for uart2
- is it possible, to use any pin for uarts(mainly RX/TX) using uart_set_pin ?
- where are default pins for UART0/1/2 defined in components ?
- in examples, uart_int_num is always 17, is this mandatory ?
- could uart_int_num be the same for using UART0 and UART2 ?
- in examples, queue size is always 10, is this best choice or is this mandatory ?
- in example 7 is an arg RINGBUF_TYPE_BYTEBUF which is not found in definition of uart_driver_install is this for future changes ?
- in example 7, stacksize in xTaskCreate is 16384, why is it that big ?
- in example 7, flow_ctrl is set to HW_FLOWCTRL_DISABLE, some lines later, cts and rts are set in uart_set_pin, what is the reason for that ?
- last and least, soc/uart_struct.h is included twice in uart.h

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

Re: questions around new uart component

Postby ESP_Sprite » Mon Nov 14, 2016 11:05 am

*takes deep breath* Yes, you can use UART2 without RX, just don't map the pin to anywhere. Yes, you can use any pin (except for the input-only GPIOs for the Tx signal) for Rx/Tx of all uarts. Only UART0 has a default Rx/Tx pin, the others do not; you will have to assign those manyually. I don't see a hardcoded interrupt 17; you can pass any interrupt number to uart_driver_install. Sharing of interrupts unfortunately is not supported yet; maybe we will introduce this in a later esp-idf version. The optimum queue size depends on the priority of the task that reads the UART as well as how busy the rest of the system is (and with what); for normal use, 10 should be sufficient. RINGBUF_TYPE_BYTEBUF and the double incudes are bugs, I'll see if I can fix these (if they're not fixed already). In example 7, I don't think the stack size has any significance. I don't know about the flow control disabled / pins assigned thing, will ask the dev.

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

Re: questions around new uart component

Postby jumjum123 » Mon Nov 14, 2016 12:02 pm

Wow!, fully answered and very quick. :o Hopefully, your breath is back to normal :oops:
Answers are a big help for me.
Mapping of rx and tx to other pins is big.
No problem anymore to switch between terminal and other UART-devices.
Thanks a lot.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: questions around new uart component

Postby WiFive » Mon Nov 14, 2016 5:19 pm

Support for auto baudrate detection?

Who is online

Users browsing this forum: Baidu [Spider] and 315 guests