LPC802 TXRDY interrupt in UART0

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

LPC802 TXRDY interrupt in UART0

跳至解决方案
923 次查看
asier
Contributor III

Hi,

I've enabled interrupt for Tx_Ready in Uart0. As soon as I enable interrupt, code jump to the interrupt callback, I check status flag and exit from the callback. Problem is that code is going to interrupt callback continuosly. Is there any way to clear TXRDY flag and avoid continous interrupt callback ?

The idea is to send a byte in tx uart and then get interrupt one time when byte is sent. What am I doing wrong ? 

Thanks,

Asier.

0 项奖励
1 解答
860 次查看
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello

 

I apologize for the delayed answer, I suggest you use the function USART_TransferSendNonBlocking, This function sends data using an interrupt method. This is a non-blocking function, which returns directly without waiting for all data to be written to the TX register. When all data is written to the TX register in the IRQ handler, the USART driver calls the callback function and passes the ref kStatus_USART_TxIdle as status parameter.

 

Let me know if this is helpful, if you have more questions do not hesitate to ask me.

Best regards,

Omar

在原帖中查看解决方案

0 项奖励
3 回复数
901 次查看
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello asier

 

The TXRDY flag is cleared when data is written to TXDAT. I suggest you refer to the usart interrupt example located at the SDK of your device.

 

Let me know if this is helpful, if you have more questions do not hesitate to ask me.

Best regards,

Omar

0 项奖励
891 次查看
asier
Contributor III

Hello Omar,

It is clear that TXRDY flag is set when TXDAT is sent and reset when TXDAT is written. 

My problem occurs when TXDAT is sent and hence TXRDY is set. In that case the interrupt callback does not happens only once but it interrups the code continously. How could manage this situation to attend interrupt once and then clear interrupt condition ?

Thanks in advance,

Asier.

0 项奖励
861 次查看
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello

 

I apologize for the delayed answer, I suggest you use the function USART_TransferSendNonBlocking, This function sends data using an interrupt method. This is a non-blocking function, which returns directly without waiting for all data to be written to the TX register. When all data is written to the TX register in the IRQ handler, the USART driver calls the callback function and passes the ref kStatus_USART_TxIdle as status parameter.

 

Let me know if this is helpful, if you have more questions do not hesitate to ask me.

Best regards,

Omar

0 项奖励