In my application , i am enabling uart receive interrupts only when app_connection_func runs i.e. when my device connects to a phone. any interrupts before connection should be ignored . but as soon as I am enabling uart receive interrupts . i am getting previously ignored interrupts. To solve this problem i am trying to reset the receive fifo before enabling the uart interrupts like this :
SetBits16(UART2_SRR_REG,UART_RFR,1);
while((GetWord16(UART2_SRR_REG) & UART_RFR)==1){}
but its not working for me so is there any suggestion i want to clear all the previous uart interrupts .
Mohit
Hi Mohit3112,
Then you should not initiate uart before connection is made. Means set flag and don't let uart initiation run in periph_init() unless connection is made.
Rgds!
PY
i need UART before connection , but only for transmitting some data not for receiving data so i have to enable UART normally
Thanks
Mohit
Is there a way to clear rev buffer of uart without reading data from it ?
Hi mohit3112,
If you use fifo mode, you can set UART_XFR bit or UART_RFR bit of register UART_SRR_REG (0x50001088) to reset fifo.
Regards!
PY