FRDMK64 UART EDMA - TX stays in busy state

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

FRDMK64 UART EDMA - TX stays in busy state

2,319件の閲覧回数
darshan_shah1
Contributor II

Hi,

I am working on FRDM-K64 and UART. Uart is connected to modem and I have use EDMA for UART. 

I am seeing after some-time, I don't get txIdle in callback and due to this my application stuck on waiting tx idle.

Indie UART EDMA driver,  txState is kUART_TxBusy.

Below are code snippets,

Here is my CallBack function,

/* UART user callback */
void UART_UserCallback(UART_Type *base, uart_edma_handle_t *handle, status_t status, void *userData)
{
tx_status = status;
if (kStatus_UART_TxIdle == status)
{
txOnGoing = false;
}
}

Here is my UART Send Function,

static int NBIOT_UART_Send(uint8_t* cmd, uint16_t len)
{
while(txOnGoing)

{

    vTaskDelay(pdMS_TO_TICKS(10));

}

txOnGoing = true;
int status = 0;
uart_transfer_t sendXfer;

sendXfer.data = cmd;
sendXfer.dataSize = len;
status = UART_SendEDMA(NBIOT_MODEM_UART, &g_uartEdmaHandle, &sendXfer);

return status;
}

Here is my EDMA Init Function,

/* Initialize the EDMA configuration. */
static void NBIOT_InitEDMA(void)
{
edma_config_t config;

/* Init DMAMUX */
DMAMUX_Init(NBIOT_UART_DMAMUX_BASEADDR);
/* Set channel for UART */
DMAMUX_SetSource(NBIOT_UART_DMAMUX_BASEADDR, UART_TX_DMA_CHANNEL, UART_TX_DMA_REQUEST);
DMAMUX_SetSource(NBIOT_UART_DMAMUX_BASEADDR, UART_RX_DMA_CHANNEL, UART_RX_DMA_REQUEST);
DMAMUX_EnableChannel(NBIOT_UART_DMAMUX_BASEADDR, UART_TX_DMA_CHANNEL);
DMAMUX_EnableChannel(NBIOT_UART_DMAMUX_BASEADDR, UART_RX_DMA_CHANNEL);

/* Init the EDMA module */
EDMA_GetDefaultConfig(&config);
EDMA_Init(NBIOT_UART_DMA_BASEADDR, &config);
EDMA_CreateHandle(&g_uartTxEdmaHandle, NBIOT_UART_DMA_BASEADDR, UART_TX_DMA_CHANNEL);
EDMA_CreateHandle(&g_uartRxEdmaHandle, NBIOT_UART_DMA_BASEADDR, UART_RX_DMA_CHANNEL);

/* Create UART DMA handle. */
UART_TransferCreateHandleEDMA(NBIOT_MODEM_UART, &g_uartEdmaHandle, UART_UserCallback, NULL, &g_uartTxEdmaHandle, NULL);
}

Please guide me how to resolve the issue.

タグ(3)
0 件の賞賛
返信
8 返答(返信)

2,152件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

Hi Darshan,

In the snippets, if txOnGoing is still true when you are going to send next cluster, you just wait 10ms. Maybe you can try to wait a longer time, or just return kUART_TxBusy immediately. 

Regards,

Jing

0 件の賞賛
返信

2,152件の閲覧回数
darshan_shah1
Contributor II

Hi,

Thank you for your response.

Above code snippets will wait till send completion. While sending data, I am enabling txOnGoing flag which will reset in UART_UserCallback.

Now, if application don't get callback and try to send next packet it will wait in while loop till  txOnGoing is false.

In my testing, I have seen even after 15 minutes, this flag is true and my application stuck on this. The only way was to reset the K64.

0 件の賞賛
返信

2,152件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

Hi,

I'm not sure if it is caused by txOnGoing. But it is possible that if you only delay 10ms and continue to send data, the last callback is executed by DMA interrupt and clear txOnGoing you have just set. Then more UART_SendEDMA() will be called while last DMA is not finished.

If this is not the reason, you can check the UART TX FIFO status(SFIFO) and DMA request flag (S1[TDRE]).  Please also check if there is any error flag in UART and EDMA.

Regards,

Jing

0 件の賞賛
返信

2,152件の閲覧回数
darshan_shah1
Contributor II

Hi,

As far as my application waiting till last packet transfer, I think there is no issue of 10ms delay. As this delay is to check if flag is false or not.

Below are register values as requested when issue occur,

S1[TDRE] - Value_1
RXUF - Value_1
TXOF - Value_0
RXOF - Value_0
RXEMPT - Value_1
TXEMPT - Value_1

0 件の賞賛
返信

2,152件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

Hi,

Can you show me your project here?

Regards,

Jing

0 件の賞賛
返信

2,152件の閲覧回数
darshan_shah1
Contributor II

Hi,

I can share UART related calls and functions. Is it fine?

0 件の賞賛
返信

2,151件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

Hi,

If I can reproduce the problem, I can debug on my frdm board.

Regards,

Jing

0 件の賞賛
返信

2,151件の閲覧回数
darshan_shah1
Contributor II

Hi,

It requires additional HW for communiation (BG95). You can guide me for the issue debugging.

UART_S1[TDRE] is set to 1 and still txState is kUART_TxBusy.

0 件の賞賛
返信