how to clear the serial port interrupt flag

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to clear the serial port interrupt flag

1,013 Views
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 Kudos
1 Reply

675 Views
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 Kudos