Skip to main content

Using UART2 interrupt based

1 year ago

Using UART2 interrupt based

Posted bymahmed10610分 3 replies
0 upvotes

Hi , i am using custom board based on DA1468x and i am using UART 1 and UART 2 in my project.

UART 1 is being used for printf and i want to use UART2 to communicate between another board DA1468x based.

Writing is not an problem i have sucessfully wrote bytes to UART2.

Problem is that how should i read bytes from uart. Should i poll in another task for UART2 read or should i use interrupt. In my previous experience on other microcontroller i have used interrupt based uart reception but in this case i am confused. What do you suggest.

And if interrupt based method is recommeneded so is there any example code available for interrupt assigning to uart2 reception because i cannot find so far.

Thanks alot

1 year ago

PM_Dialog

Hi mahmed106,

You could use UART1 for the printf() and UART2 with the adapters. By default, the printf () is using UART2 but you could change it to UART1 if you should add #define CONFIG_RETARGET and #define CONFIG_RETARGET_UART HW_UART1 into custom_config_xxx.h heder file. For the UART2, we recommend the usage of the adapters. In general we recomned the usage of the adapters in a multitasking environment as the FreeRTOS. Be aware that UART2 has implemented HW flow control (rts/cts). There is no need for two different tasks for UART1 and UART2.

Thanks, PM_Dialog

1 year ago

mahmed106 10分

So does this means that if data is recieved on uart and i read it bit later i will recieve complete data or not?

I mean is there any hardware/software FIFO for uart reception, that i can read later or i have to read at that exact instance?

accepted answer!

1 year ago

PM_Dialog

Hi mahmed106,

According to the datasheet, only UART2 supports 16 bytes Transmit and receive FIFOs. There is DMA support on both UARTs.

Thanks, PM_Dialog