UART3 overrun error occurs RT1020

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UART3 overrun error occurs RT1020

Jump to solution
2,205 Views
hanmant
Contributor III

Hi,

I'm using uart3 interrupt of RT1020 ,i'm using uart3 for rs-485 communication and its speed is 3MBps.

Also, I'm using LPSPI4 CMSIS driver handler for other communication .

Individually uart3 works fine but after adding spi handler , it will start occurring Overrun.

Still im clearing overrun flag but why this flag is getting set .

Also ,one query when this flag set ,in this case will i receive all data or lost

Uart_status register.PNG

?

Labels (1)
Tags (2)
0 Kudos
Reply
1 Solution
947 Views
mayliu1
NXP Employee
NXP Employee

Hi @hanmant ,

I use MIMXRT1020-EVK board  as edma_b2b_transfer_master, MIMXRT1064-EVK board as edma_b2b_transfer_slave.  

mayliu1_4-1732184845065.jpeg

 

I create a project based on  MIMXRT1020-EVK board, I set this board as I2C master, add UART TX, UART RX, totally using 4 DMA channels.   I modify some code  both of MIMXRT1020-EVK project  and MIMXRT1064-EVK project. 

The result is both projects run Okay.

mayliu1_5-1732184992668.png

So please check your code, the critical code I have shown you bellow. 

mayliu1_0-1732184067449.png

mayliu1_1-1732184078401.png

mayliu1_2-1732184103892.png

mayliu1_3-1732184133614.png

Please try it, and tell me to close this case.

If you still have question, Please create a new case.

 

BR

mayliu

View solution in original post

0 Kudos
Reply
38 Replies
649 Views
mayliu1
NXP Employee
NXP Employee

Dear @hanmant ,

 

I wish you success, and also I have a little advice.

It is better put NVIC_SetPriority function after LPUART_TransferCreateHandleEDMA function.

I'm waiting for your good news.

mayliu1_0-1730453159868.png

Best Regards

mayliu

0 Kudos
Reply
610 Views
hanmant
Contributor III
Hi @mayliu

This piece of code is not working ,means when i add this lines code in my code then whole application got stuck
const edma_channel_Preemption_config_t Channel_preemption_config = {
.enableChannelPreemption = false,
.enablePreemptAbility = true,
.channelPriority = 15U
};
const edma_channel_Preemption_config_t Channel14_preemption_config = {
.enableChannelPreemption = false,
.enablePreemptAbility = true,
.channelPriority = 14U
};

EDMA_SetChannelPreemptionConfig(EXAMPLE_LPUART_DMA_BASEADDR,LPUART_TX_DMA_CHANNEL, &Channel_preemption_config);
EDMA_SetChannelPreemptionConfig(EXAMPLE_LPUART_DMA_BASEADDR, LPUART_RX_DMA_CHANNEL, &Channel14_preemption_config);

Note: with this uart DMA there is another i2c DMA also there but i have not set priority of i2c DMA
0 Kudos
Reply
602 Views
mayliu1
NXP Employee
NXP Employee

Dear @hanmant ,

 

Thanks for the update. 

you said your whole application got stuck when you add the functions.

Can you tell me the detail information when your whole application got stuck.

1: where your application got stuck, Please tell me which function.

2: when your application got stuck, Please read your RT1020 Registers, Faults, Peripherals status, check whether something unusual.

The following Fig is just a demo to help you check the problem.

mayliu1_0-1731480630949.png

Wish it helps you!

Best Regards

mayliu

0 Kudos
Reply
596 Views
hanmant
Contributor III

Hi @mayliu1 

Thanks for update.

it is getting stuck into I2c DMA.

here i have one question : Is it conflicting priority between I2C DMA and UART DMA 

but in I2C DMA i have not set the Priority.

0 Kudos
Reply
587 Views
mayliu1
NXP Employee
NXP Employee

Hi @hanmant ,

I do not think this problem related with current case subject" UART3 overrun error occurs RT1020".

I import SDK demo as you do, I find that this demo "lpi2c_edma_b2b_transfer_master" need  lpi2c instance on the other board as slave.

mayliu1_0-1731493594740.png

Because of no I2C slave,  lpi2c_master_callback can not be called, so you application got stuck.

mayliu1_1-1731493614957.png

 

BR

mayliu

 

0 Kudos
Reply
583 Views
hanmant
Contributor III
Hi @mayliu,
This is "lpi2c_edma_b2b_transfer_master" my whole project name under this name i have added all modules like uart dma ,spi and i2c dma etc.
When i removed priority related then application works fine
0 Kudos
Reply
582 Views
mayliu1
NXP Employee
NXP Employee

Hi @hanmant ,

 

Thanks for your update.

The reason of your Application got stuck  is the I2C master node of your development board needs to be connected to the I2C slave node.

I verified it with my development board, and if I don't connect to the I2C slave node, I get an error  as you. If I use two development board, one is "lpi2c_edma_b2b_transfer_master", the other is "lpi2c_edma_b2b_transfer_slave". connect two boards correctly, the program run well.  

You can create a "lpi2c_edma_b2b_transfer_master" project and don't add any other code to validate.

 

Best Regards

mayliu

0 Kudos
Reply
564 Views
hanmant
Contributor III
Hi @mayliu,
Thank for update,
My custom board RT1020 is i2c master and it is connected with slave DAC and it is works fine.
But my problem is when i'm tried to add the channel priority(EDMA_SetChannelPreemptionConfig) config code then the code will stuck into i2c dma.
0 Kudos
Reply
520 Views
mayliu1
NXP Employee
NXP Employee

Hi @hanmant ,

 

Thanks for your update.

I rechecked your reply, I think you are right. Most likely, it is because conflicting priority between I2C DMA and UART DMA.

 

Wish it helps you.
If you still have question about it, please kindly let me know.

 

Best Regards

mayliu

 

0 Kudos
Reply
518 Views
hanmant
Contributor III
Hi @mayliu,
Thank for reply.
Can please tell me how to resolve this issue.
Still I'm facing this DMA priority issue.
0 Kudos
Reply
474 Views
mayliu1
NXP Employee
NXP Employee

Hi @hanmant ,

 

Thanks for the reply.

If you do not mind, Please create a new case because current case list too much item.

If you want your modules work well with DMA, especially some modules need to be processed in a timely manner, you should consider the prioritization of all DMA channels used.

I do not know your project and DMA priority configuration. So please send me your code if it is convenient.

If not convenient, I suggest you consider this two function, double check the parameters.

void EDMA_SetChannelPreemptionConfig(DMA_Type *base, uint32_t channel, const edma_channel_Preemption_config_t *config)
NVIC_SetPriority

 

Wish it helps you.
If you still have question about it, please kindly let me know.

 

BR 

mayliu

0 Kudos
Reply
467 Views
hanmant
Contributor III
Hi @mayliu,
Thank for reply.
Can you simulate these things at your side by just adding Two DMA's one is UART and another is I2C and check priority get conflicts or not
0 Kudos
Reply
445 Views
mayliu1
NXP Employee
NXP Employee

Hi @hanmant ,

 

Thanks for your reply, I will try do it on my side.

Please let me know if your project is using the FreeRTOS operating system or using a bare board. I will try to create a project as you do and validate , It is very import.

Please keep patience,thanks.

BR

mayliu

0 Kudos
Reply
441 Views
hanmant
Contributor III
Hi @mayliu ,
Thanks for reply.
I'm using bare matel not freeRTOS.
Please bare board project and check.
0 Kudos
Reply
948 Views
mayliu1
NXP Employee
NXP Employee

Hi @hanmant ,

I use MIMXRT1020-EVK board  as edma_b2b_transfer_master, MIMXRT1064-EVK board as edma_b2b_transfer_slave.  

mayliu1_4-1732184845065.jpeg

 

I create a project based on  MIMXRT1020-EVK board, I set this board as I2C master, add UART TX, UART RX, totally using 4 DMA channels.   I modify some code  both of MIMXRT1020-EVK project  and MIMXRT1064-EVK project. 

The result is both projects run Okay.

mayliu1_5-1732184992668.png

So please check your code, the critical code I have shown you bellow. 

mayliu1_0-1732184067449.png

mayliu1_1-1732184078401.png

mayliu1_2-1732184103892.png

mayliu1_3-1732184133614.png

Please try it, and tell me to close this case.

If you still have question, Please create a new case.

 

BR

mayliu

0 Kudos
Reply
397 Views
hanmant
Contributor III
Hi @mayliu,
Thanks for your valuable suggest.
Can you please share your code with me.
0 Kudos
Reply
346 Views
mayliu1
NXP Employee
NXP Employee

Hi @hanmant 

Thanks for your reply. 

According to NXP's policy, I can not send you the source code directly .

My verification code is based on MIMXRT1020-EVK and MIMXER1064-EVK board, I do not think my verification code suitable for your customized board.

Also, I have sent you a screenshot of the critical code about your question. 

I merge the following three project into my verification project.

For MIMXRT1020-EVK board:

1: evkmimxrt1020_pit

2: evkmimxrt1020_lpi2c_edma_b2b_transfer_master

3:evkmimxrt1020_lpuart_edma_transfer

For MIMXRT1064-EVK board:

1: evkmimxrt1064_lpi2c_edma_b2b_transfer_slave

If your I2C program still doesn't work properly, I suspect that there might be some issues with your I2C program. I suggest you disable other functions and test the I2C alone to see if it works normally.

I think the current issue I have solved. Please tell me to close this case.

If you still have problem, Please create a new case, thanks.

 

BR

mayliu

0 Kudos
Reply
1,038 Views
mayliu1
NXP Employee
NXP Employee

Hi @hanmant 

Thank you so much for your interest in our products and for using our community.

Usually, there are various causes of UART overrun errors, and it is necessary to consider various aspects such as data processing speed and interrupt processing.


In order to better help you solve the problem, please reply to the question below.
First, Please tell me which DMA_UART interface function you call to receive UART data
Second, Please tell me where and when you call DMA_UART interface function.

I have a few suggestions for you.
1: Set the DMA_UART interrupt priority to be higher than other modules.
2: Use ping pong buffer to receive UART data.

Wish it helps you.
If you still have question about it, please kindly let me know.

Wish you a nice day!

 

Best Regards

mayliu

0 Kudos
Reply