How to change priority of dma controller RT1020

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

How to change priority of dma controller RT1020

1,244 Views
hanmant
Contributor III

Hi,

I'm using Rt1020 processor.

I want make high priority uart dma than than the cpu .

And also make the uart than Spi dma or cmsis interrupt 

Also in uart dma want make Rx priority high.

I

Can you please give me suggestions 

Labels (1)
0 Kudos
Reply
17 Replies

1,225 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @hanmant,

You can change the priority of each eDMA channel by setting its respective DCHPRIn register. The priorities go from the lowest one of '0' to the highest one of '15'. I believe what you are looking for is to set the DCHPRI register of your UART channel to the highest possible value of 15. For more information, please look at Section "6.5.5.18 Channel Priority (DCHPRI0 - DCHPRI31)" of the RT1020RM.

BR,
Edwin.

0 Kudos
Reply

1,214 Views
hanmant
Contributor III
Hi @Edwin,

Thanks for reply .
I want give more priority to DMA controller over CPU .
Can you tell me the API's to set it.
0 Kudos
Reply

1,205 Views
hanmant
Contributor III
Also how to change the priority of Uart DMA over SPI
0 Kudos
Reply

1,194 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @hanmant,

I'm afraid that the DMA cannot have a higher priority than the CPU itself.

If you wish to better manage the priorities between peripherals, I highly suggest you use FreeRTOS instead of BareMetal. In BareMetal, all you can achieve is what I previously shared with you about the DMA priorities; there is no way of changing peripheral priorities.

With FreeRTOS, you can set priorities for each task, and with a task for each peripheral, you can set priorities for each peripheral.

Please look into the FreeRTOS example codes we provide on the RT1020 SDK for more information on how to set task priorities.

BR,
Edwin.

0 Kudos
Reply

1,177 Views
hanmant
Contributor III
Hi @Edwin,
Can we using this api at least for dma ,
// Set DMA channel preemption configuration
preemptionConfig.enableChannelPreemption = true;
preemptionConfig.enablePreemptAbility = true;
preemptionConfig.channelPriority = 14; // Set priority to 14 for TX channel
EDMA_SetChannelPreemptionConfig(EXAMPLE_LPUART_DMA_BASEADDR, LPUART_TX_DMA_CHANNEL, &preemptionConfig);

preemptionConfig.channelPriority = 15; // Set priority to 15 for RX channel
EDMA_SetChannelPreemptionConfig(EXAMPLE_LPUART_DMA_BASEADDR, LPUART_RX_DMA_CHANNEL, &preemptionConfig);

Please confirm.
0 Kudos
Reply

1,141 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @hanmant,

Yes, it looks good.

BR,
Edwin. 

0 Kudos
Reply

1,030 Views
hanmant
Contributor III
Hi @Edwin
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

996 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @hanmant,

Could you be more specific? Where does the application get stuck? Do you receive a hardfault, or what kind of error do you get?

BR,
Edwin. 

0 Kudos
Reply

975 Views
hanmant
Contributor III
Hi @Edwin,

This is stuck into the i2c DMA.
but when i remove the priority related code then it works fine.
Is there priority conflict happening here? if so , then how resolve this?
0 Kudos
Reply

853 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @hanmant,

That seems to be the case. Is there a reason why you require this priority related code if the application works fine without it? Why not keep the code without this part if it works OK? 

0 Kudos
Reply

838 Views
hanmant
Contributor III
Hi @Edwin,
My uart dma communication is running at 3Mb baud rate .
So currently I'm facing problem of packets dropping.
So I want to set high priority for Uart Dma than other dma like spi ,i2c.
0 Kudos
Reply

611 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @hanmant,

As I previously mentioned, you can change the DMA's priority for each channel by using the DCHPRIn register. Have you tried using this to set up a higher priority for UART than the rest of the DMA channels?

BR,
Edwin.

0 Kudos
Reply

600 Views
hanmant
Contributor III
Hi @EdwinHz,

I'm not setting priority to another peripheral like I2C ,SPI.
Only i trying to set priority to Uart DMA channel by using the DCHPRIn register . But still my code is got stuck in I2C dma .
Is there anything is conflicting I2C Dma if Yes then How to check that and How to disable to priority of others DMA channels.
0 Kudos
Reply

440 Views
hanmant
Contributor III

Hi @EdwinHz 

I'm still waiting for my answer.

  Can you please tell how you tried at your end by taking I2C and Uart DMA and setting the priority to UART dma channel as High using the DCHPRIn registers.

Please give me example code.

 

0 Kudos
Reply

244 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @hanmant,

Please take a look at the "evkmimxrt1020_lpuart_edma_transfer" example code from the RT1020 SDK for aid on how to setup the dma + uart connection. 

BR,
Edwin.

0 Kudos
Reply

300 Views
hanmant
Contributor III

@EdwinHz 

Your not responding to my question since long time.

0 Kudos
Reply

622 Views
hanmant
Contributor III
Hi @EdwinHz,

waiting for your response.
0 Kudos
Reply