Hi,
I tried to use driver example 'evkmimxrt1020_lpuart_edma_rb_transfer' code to communicate for 3000000 baudrate but it fails.
The issue is EXAMPLE_RxEDMACallback function does not seem to be called. I tried to use original version as 115200 baudrate and the function called successfully.
I modified the idle interrupt routine of the example to get the data.
The original part as;
void EXAMPLE_LPUART_IRQHandler(void)
{
uint32_t status = LPUART_GetStatusFlags(EXAMPLE_LPUART);
uint32_t enabledInterrupts = LPUART_GetEnabledInterrupts(EXAMPLE_LPUART);
/* If new data arrived. */
if ((0U != ((uint32_t)kLPUART_IdleLineFlag & status)) &&
(0U != ((uint32_t)kLPUART_IdleLineInterruptEnable & enabledInterrupts)))
{
(void)LPUART_ClearStatusFlags(EXAMPLE_LPUART, kLPUART_IdleLineFlag);
isIdleLineDetected = true;
receivedBytes = EXAMPLE_RING_BUFFER_SIZE -
EDMA_GetRemainingMajorLoopCount(EXAMPLE_LPUART_DMA_BASEADDR, LPUART_RX_DMA_CHANNEL);
receivedBytes += (EXAMPLE_RING_BUFFER_SIZE * ringBufferFlag) - ringBufferIndex;
if (receivedBytes > 32U)
{
__NOP();
}
}
LPUART_TransferEdmaHandleIRQ(EXAMPLE_LPUART, &g_lpuartEdmaHandle);
SDK_ISR_EXIT_BARRIER;
}
The ringBufferFlag should be increased to rollover but the EXAMPLE_RxEDMACallback is not called so the flag is not changed which causes that the receiveBytes calculation fails.
So I changed the calculation as;
void EXAMPLE_LPUART_IRQHandler(void)
{
uint32_t status = LPUART_GetStatusFlags(EXAMPLE_LPUART);
uint32_t enabledInterrupts = LPUART_GetEnabledInterrupts(EXAMPLE_LPUART);
/* If new data arrived. */
if ((0U != ((uint32_t)kLPUART_IdleLineFlag & status)) &&
(0U != ((uint32_t)kLPUART_IdleLineInterruptEnable & enabledInterrupts)))
{
(void)LPUART_ClearStatusFlags(EXAMPLE_LPUART, kLPUART_IdleLineFlag);
isIdleLineDetected = true;
receivedBytes = EXAMPLE_RING_BUFFER_SIZE -
EDMA_GetRemainingMajorLoopCount(EXAMPLE_LPUART_DMA_BASEADDR, LPUART_RX_DMA_CHANNEL);
receivedBytes += (EXAMPLE_RING_BUFFER_SIZE * ringBufferFlag) - ringBufferIndex;
if (receivedBytes > 32U)
{
receivedBytes -= (EXAMPLE_RING_BUFFER_SIZE * ringBufferFlag) - ringBufferIndex;
ringBufferFlag++;
receivedBytes += (EXAMPLE_RING_BUFFER_SIZE * ringBufferFlag) - ringBufferIndex;
__NOP();
}
}
LPUART_TransferEdmaHandleIRQ(EXAMPLE_LPUART, &g_lpuartEdmaHandle);
SDK_ISR_EXIT_BARRIER;
}
Now the code receive every byte I sent but I do not feel ok to modify it like that.
Could you please have a look at it?
iMXRT1020
Regards
Hello,
We experiment the same kind of problem with our software.
Same kind of hotfix.
From our first test, nothing seems to do the trick :
We saw that the problems is that the micro is bypassing EXAMPLE_RxEDMACallback (allowing to increment ce ringBufferFlag for later byte calculation: wrong number => wrong calculation => problem encountered)
Seems to happen only when project uses other IRQs and these IRQs are triggered. Even if the EXAMPLE_RxEDMACallback is still pending (as we can't go to UART IDLE CALLBACK and have no EXAMPLE_RxEDMACallback theoretical event), UART IDLE Callback show wrong ringBufferFlag.
Any lead will be appreciate.
Will do more tests next week.
Regards.
Hi,
I don’t remember the details but i overcame the issue by re-calculating received bytes.
I will update the details tomorrow.
Hi ergingursoy,
Yes we had to do the same but maybe your solution may be better than ours so don't hesitate to share.
Nevertheless, it is a pity and I am very curious to get at the bottom of this and get an explanation for this phenomenan.
Regards
Hi @pierre_denis,
I removed the line ringBufferFlag++ from LPUART_RxEDMACallback.
In the LPUARTx_IRQHandler, i added the following code after receivedBytes calculation;
if (receivedBytes > BUFFER_SIZE)
{
receivedBytes -= (BUFFER_SIZE * ringBufferFlag) - ringBufferIndex;
ringBufferFlag++;
receivedBytes += (BUFFER_SIZE * ringBufferFlag) - ringBufferIndex;
}
Hello,
I have been using the evaluation board MIMXRT1015-EVK.
The version of IDE: v11.5.1
The SDK version: 2.11.0 (manifest version: 3.9)
The same problem is valid for MIMXRT1021-EVK.
Regards,
Ali Ergin
Hello,
I suggest trying the IDE version 11.6.0 and the SDK version 2.12.0 [RT1020] and version 2.12.0 [RT1015], if the issue still please let me know.
Best regards,
Pavel
Hello,
I'm following your case give me a chance to review your information and replay this issue. I need more information, Could you tell me what version of IDE and then SDK are you using? Are you using an evaluation board or a custom board?
I look forward to receiving your comments,
Pavel