I was trying to use UART2 with this statement:
uart_set_pin(EX_UART_NUM, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); // as per esp-idf UART example
and my external serial device output was connected to GPIO16, but the statement doesn work.
instead
uart_set_pin(EX_UART_NUM, 17, 16, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); // works Ok
so the documentation for uart_set_pin and UART_PIN_NO_CHANGE is a little confusing:
"UART ** pin GPIO number, if set to UART_PIN_NO_CHANGE, use the current pin. " and my wild guess was that current pin eventaually mean the pin listed in esp32_datasheet_en.pdf pg47 table IO_MUX which for UART2 are 16(RXD) and 17(TXD), but obviously either my guess is wrong, or there is some bug in the SDK?
Could you explain where is the problem?
Thanks
uart_set_pin problem with UART_PIN_NO_CHANGE ?
Re: uart_set_pin problem with UART_PIN_NO_CHANGE ?
UART_PIN_NO_CHANGE means do not set this pin, it does not mean UART_PIN_DEFAULT. There is no UART_PIN_DEFAULT. The reason the example works is because the bootloader configures UART0. Really it is not helpful though and you should always specify your pins on the first call.
Re: uart_set_pin problem with UART_PIN_NO_CHANGE ?
Thanks WiFive, I guessed that UART_PIN_NO_CHANGE might mean what you said, but left it behind as I didn't imagine how then in the example the driver could guess which are the pins to use
One more question:
in uart_events_example_main.c > uart_event_task() there is one buffer allocated that is never used:
uint8_t* dtmp = (uint8_t*) malloc(BUF_SIZE);
Just at the end (which btw is not reacheble) is purged.
Is dtmp has some hidden use(s) there or is just some leftover/or for future use - let say if there will be some code to procced the uart data inside uart_event_task()?
One more question:
in uart_events_example_main.c > uart_event_task() there is one buffer allocated that is never used:
uint8_t* dtmp = (uint8_t*) malloc(BUF_SIZE);
Just at the end (which btw is not reacheble) is purged.
Is dtmp has some hidden use(s) there or is just some leftover/or for future use - let say if there will be some code to procced the uart data inside uart_event_task()?
Re: uart_set_pin problem with UART_PIN_NO_CHANGE ?
Probably just forgot to copy the data there
Re: uart_set_pin problem with UART_PIN_NO_CHANGE ?
@WiFive
can you test ?
can you test ?
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
Who is online
Users browsing this forum: Google [Bot] and 95 guests