UART TX Complete Interrupt

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

UART TX Complete Interrupt

1,373 Views
Vagni
Contributor IV

I am developing my application with KDS 3.0.0 + KSDK 1.3.0 + PEx + MQX_Standard on my K66 custom board.

I have to drive an UART in interrupt mode, so I use the fsl_uart PEx component, which relays on fsl_uart_driver and fsl_uart-hal KSDK modules.

With that component I can start receiving and/or transmitting in interrupt mode through the UART_DRV_ReceiveDATA() and UART_DRV_SendData() functions. I can install RX and TX call-back functions, which are called from the UART interrupt handler upon every character reception and transmission events.

Unfortunately, the TX call-back function is called only upon a TX Data Register Empty (TDRE) event. Instead, in may application I need to catch also the Transmission Complete (TC) event: how can I get that functionality with KSDK?

 

Unfortunately, the How To RS485 with KSDK component fsl_uart discussion does not help me.

 

Should I use the UART_HAL_SetIntMode() function to enable the TC event (TCIE) as interrupt source? And how?

Even if TC event were enabled as interrupt source, should I manually add the TC event handler into the UART interrupt handler generated by PEx and define and use a new TC call-back function of my own?

 

Thank you for your help.

Labels (1)
0 Kudos
3 Replies

512 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Alessandro,

You can use this code to enable the TC interrupt :

UART_BWR_C2_TCIE(UART1, 1u);

It is defined in the file of :MK22F51212_extension.h  (KSDK_1.3.0\platform\devices\MK22F51212\include)

pastedImage_0.png

Hope it helps



-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

Have a great day,
Alice

0 Kudos

512 Views
Vagni
Contributor IV

Thank you, Alice.

Now I know how to enable the TC interrupt.

Should I enable it in UART_DRV_CompleteSendData() function after the last transmitted character?

But what about handling the TC interrupt? Should I manually modify the UART_DRV_IRQHandler() function and add my TCcallback() function?

0 Kudos

512 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Alessandro,

- I think you can enable the TC interrupt on the UART of initialization code .

- Yes , you need install  the TCcallback() function by yourself  , you can refer to the "UART_DRV_InstallTxCallback" function .

Hope it helps

Alice

0 Kudos