how to clear the serial port interrupt flag

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

how to clear the serial port interrupt flag

1,588 次查看
wyflsxy
Contributor II

hello all,

how to clear  the serial port interrupt flag?

I can clear the port interrupt flag by " PORT_HAL_ClearPortIntFlag(BOARD_SW_LLWU_BASE); "

but how can I clear the serial port interrupt flag?

0 项奖励
回复
1 回复

1,250 次查看
marek_neuzil
NXP Employee
NXP Employee

Hello,

The UART contains many status flags that can be cleared by different way. See a reference manual - UART device.

For example RDRF flag is cleare by the following way:

Receive Data Register Full Flag

RDRF is set when the number of datawords in the receive buffer is equal to or more than the number

indicated by RWFIFO[RXWATER]. A dataword that is in the process of being received is not included in

the count. To clear RDRF, read S1 when RDRF is set and then read D. ...

The KSDK 1.2.0 contains the following function for clearing flags (see the file KSDK_1.2.0\platform\hal\src\uart\fsl_uart_hal.c) but the function can clear several flags only (other flags are cleared by different ways):

/*FUNCTION**********************************************************************

*

* Function Name : UART_HAL_ClearStatusFlag

* Description   : Clear an individual and specific UART status flag.

* This function allows the user to clear an individual and specific UART

* status flag. Refer to structure definition uart_status_flag_t for list of

* status bits.

*

*END**************************************************************************/

uart_status_t UART_HAL_ClearStatusFlag(UART_Type * base, uart_status_flag_t statusFlag)

Best Regards,

Marek Neuzil

0 项奖励
回复