iMX RT1015 UART DMA Example Fails for 3000000 Baudrate

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

iMX RT1015 UART DMA Example Fails for 3000000 Baudrate

1,782 次查看
ergingursoy
Contributor I

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

标签 (2)
0 项奖励
回复
7 回复数

977 次查看
pierre_denis
Contributor II

Hello,

We experiment the same kind of problem with our software.

  • HARDWARE: MIMXRT1062CVL5A
  • IDE: newest tested v11.7.0 (tested multiple version)
  • SDK: newest tested v2.13.1 (tested multiple version)
  • Baudrate: 921600

Same kind of hotfix.

From our first test, nothing seems to do the trick :

  • Clear Overrun Flag
  • Modified parameters of EDMA and UART
  • Disabling Cache in the proper section

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.

 

0 项奖励
回复

974 次查看
ergingursoy
Contributor I

Hi,

I don’t remember the details but i overcame the issue by re-calculating received bytes.

I will update the details tomorrow. 

0 项奖励
回复

972 次查看
pierre_denis
Contributor II

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

0 项奖励
回复

961 次查看
ergingursoy
Contributor I

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;
}

 

0 项奖励
回复

1,741 次查看
ergingursoy
Contributor I

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

0 项奖励
回复

1,736 次查看
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复

1,760 次查看
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复