IMXRT1024 TransferGetSendCountEDMA Usage

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

IMXRT1024 TransferGetSendCountEDMA Usage

2,116件の閲覧回数
Lukas_Frank
Senior Contributor I

Hi all,

 

I am just trying to monitor transferred byte count in my project. I am in default SDK example lpuart_edma_rb_transfer and my code is like below:

.
..
...
sendXfer.data = g_tipString;
sendXfer.dataSize = sizeof(g_tipString) - 1;
txOnGoing = true;
LPUART_SendEDMA(EXAMPLE_LPUART, &g_lpuartEdmaHandle, &sendXfer);

/* Wait send finished */
while (txOnGoing)
{
LPUART_TransferGetSendCountEDMA(EXAMPLE_LPUART,&g_lpuartEdmaHandle,&transferCount);
}
...
..
.

 

this code is producing unrelated values. How can I monitor transferred byte counts continously and simeltenously?

 

Thanks and Regards.

0 件の賞賛
返信
3 返答(返信)

2,077件の閲覧回数
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
1) Could you help me about what is the correct usage of it?
-- These two functions: TransferGetReceiveCountEDMA and TransferGetSendCountEDMA can work well only on condition that the handle->txState or handle->rxState is idle.
So you'd better use the EDMA_GetRemainingMajorLoopCount() function instead of them.
Have a great day.
TIC

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信

2,092件の閲覧回数
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
LPUART_TransferGetSendCountEDMA can return the number of bytes written to the LPUART TX register when the txState is kLPUART_TxIdle, otherwise, it doesn't work.

status_t LPUART_TransferGetSendCountEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, uint32_t *count)
{
    assert(NULL != handle);
    assert(NULL != handle->txEdmaHandle);
    assert(NULL != count);

    if ((uint8_t)kLPUART_TxIdle == handle->txState)
    {
        return kStatus_NoTransferInProgress;
    }

    *count = handle->txDataSizeAll -
             ((uint32_t)handle->nbytes *
              EDMA_GetRemainingMajorLoopCount(handle->txEdmaHandle->base, handle->txEdmaHandle->channel));

    return kStatus_Success;
}


Have a great day.
TIC

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信

2,085件の閲覧回数
Lukas_Frank
Senior Contributor I

Hi Dear @jeremyzhou,

 

I tried it after transfer compilation but it is returning wrong value. For example, I am sending 70 bytes in default SDK example of EDMA LPUART Ring buffer. Scenario working fine and receivedBytes correctly setting as 70. But TransferGetReceiveCountEDMA or TransferGetSendCountEDMA is returning wrong value. Could you help me about what is the correct usage of it?

 

Thanks and Regards. 

0 件の賞賛
返信