KSDK 1.1 uart with dma

cancel
Showing results for 
Search instead for 
Did you mean: 

KSDK 1.1 uart with dma

631 Views
adyr
Contributor V

I have created a project for the K64F12 using PEx with KSDK 1.1.0 and MQX. I added the fsl_uart and set the eDMA Enable option (plus the other settings) for UART4.

 

I think I have found a bug in the fsl_uart_edma_driver.c -> UART_DRV_EdmaInit function. The switch block only checks for UART0 and UART1 to setup the uartRxEdmaRequest and uartTxEdmaRequest settings. That means dma transfers don't work for the other uarts.

Our design uses UART4 and initially transfers under dma were not working. I have added:

 

case 4:

     uartRxEdmaRequest = kDmaRequestMux0UART4;

     uartTxEdmaRequest = kDmaRequestMux0UART4;

     break;

 

and now it works.

 

I presume the switch block should be setup for all the UARTS.

 

Best regards,

Adrian.

Labels (1)
0 Kudos
3 Replies

144 Views
adyr
Contributor V

I was premature in stating my fix worked. It allows me to transmit but not receive. One problem is the interrupt for transmit complete happens immediately as it is sheared by the transmit empty. I worked around that by disabling the transmitter when I wanted to receive (and vice-versa) but I still only get one byte back and then it interrupts. I also encounter hard fault interrupts when the task switches, I can reduce the number of hard fault interrupts by putting a _time_delay( 1 ); between sending and receiving but they still occur.

So for now I have abandoned using DMA for transfers.

Using interrupts is much better but I occasionally get a lock up cause by the UART_HAL_GetRxDatawordCountInFifo(baseAddr) returning 0 even though there is a byte to read. This means the interrupt flag doesn't get cleared so the interrupt routine is constantly called. If I break on the line while(UART_HAL_GetRxDatawordCountInFifo(baseAddr)) and then set the next statement to the line UART_HAL_Getchar(baseAddr, uartState->rxBuff); then normal execution returns. So it appears that data can be in the rx buffer when the fifo is empty?

0 Kudos

144 Views
overdamped
Contributor II

Is this issue going to be addressed within a future release? I'm running into the same problem when trying to perform a single byte DMA receive on LPUART with KSDK 1.2.

0 Kudos

144 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Adrian,

Thanks for your report as well as the solution! I also contacted with our KSDK team and confirmed this issue has been fixed in the 1.2 release.

Best Regards,

Kan

0 Kudos