清晰的uart接收我nterrupts

5 posts / 0 new
Last post
mohit3112
Offline
Last seen:6 months 3 weeks ago
Expert
加入:2014-08-04 13:45
清晰的uart接收我nterrupts

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

PY_Dialog
Offline
Last seen:2 years 7 months ago
Staff
加入:2014-08-25 09:59
Hi Mohit3112,

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

mohit3112
Offline
Last seen:6 months 3 weeks ago
Expert
加入:2014-08-04 13:45
i need UART before connection

i need UART before connection , but only for transmitting some data not for receiving data so i have to enable UART normally

Thanks
Mohit

mohit3112
Offline
Last seen:6 months 3 weeks ago
Expert
加入:2014-08-04 13:45
Is there a way to clear rev

Is there a way to clear rev buffer of uart without reading data from it ?

PY_Dialog
Offline
Last seen:2 years 7 months ago
Staff
加入:2014-08-25 09:59
Hi mohit3112,

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