LPC5506 USART DMA TX causes IRQHandler stuck in loop with kUSART_TxIdleFlag

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

LPC5506 USART DMA TX causes IRQHandler stuck in loop with kUSART_TxIdleFlag

351 Views
JoakimA
Contributor I

Hello,

I have setup USART DMA using the SDK and Config Tools on the LPC55S06-EVK board, and I'm trying to send something on FLEXCOMM1. I also have interrupts enabled so that I can feed RX bytes as they come in, which works great by checking kUSART_RxFifoNotEmptyFlag in FLEXCOMM1_IRQHandler().

However, once I send something on TX using DMA, it does send the data out but as soon as the data has finished sending the FLEXCOMM1_IRQHandler() is called constantly with the flag kUSART_TxIdleFlag. The loop causes other code to no longer being able to run.

I understand from the docs that USART_TransferSendDMA() sets up an interrupt that should notify that the transfer is complete, and I have a callback function setup for that aswell, however it never gets there since the FLEXCOMM1_IRQHandler() loop is stuck.

Inside the  FLEXCOMM1_IRQHandler(), if I try to disable the interrupt like this once the flag kUSART_TxIdleFlag is reached:

 

USART_DisableInterrupts(USART1, kUSART_TxIdleInterruptEnable);

 



It stops the loop, but then additional DMA transfers stops working. It only works for the first one.

The reason I cannot also use DMA or non-blocking interrupt method for RX also is because I don't know the expected number of bytes that are incoming, I just want to get them directly with the interrupt. Sending should be non-blocking so I want to use DMA for that.

Any ideas on what I should do when TX transfer is complete to make the interrupt handler loop not get stuck without breaking additional DMA transfers? It's worth to also mention that I don't have any interrupts enabled for TX, but I'm guessing the DMA transfer enables some.

Labels (1)
Tags (2)
0 Kudos
3 Replies

304 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

For uart transmitting character, I suppose that you can select either uart transmitting interrupt mode or DMA mode, but not both. Assume the scenario, when you transmit a char with both DMA and interrupt, after the char transfer is over, if you enable both interrupt and DMA, the uart transmitting ISR is entered, in the ISR, you write a char to transmitter reg of uart, the DMA is also requested, the DMA will read a char from memory and write the char to transmitter reg of uart,it conflicts.

Pls try to use either either uart transmitting interrupt mode or DMA mode. If you use DMA, you can enable the DMA interrupt, disable uart interrupt.

 

Pls have a try

BR

XiangJun Rong

0 Kudos

299 Views
JoakimA
Contributor I

Hello and thanks for the reply,

What I try to achieve is:

TX
I want to send data non-blocking (Either with Interrupt or DMA, whatever works best).
So either USART_TransferSendNonBlocking() or USART_TransferSendDMA().

RX
Whenever I get a new byte, I want to get it and feed it to processing functions. I don't know the expected amount of bytes, so I cannot use USART_TransferReceiveDMA().

What is the best way to accomplish this, since enabling the IRQ causes conflict?

0 Kudos

264 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suggest you use interrupt mode to transfer data for both transmitter and receiver, or use interrupt mode to transfer data for receiver and use DMA to transfer data for transmitter.

Hope it can help you

BR

XiangJun Rong

 

0 Kudos