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
questions around new uart component
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: questions around new uart component
*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.
Re: questions around new uart component
Wow!, fully answered and very quick. Hopefully, your breath is back to normal
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.
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.
Re: questions around new uart component
Support for auto baudrate detection?
Who is online
Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 372 guests