UART with DMA going to Standby mode

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

UART with DMA going to Standby mode

Jump to solution
2,045 Views
shijiaguo
Contributor II

Hello all, 

 

I'm trying to use UART with DMA here, however I'm having some problems when I'm going to standby mode: it wouldn't go to standby. 

 

So what I found was that if I enable DMA in my init procedure:

LINFlexD_0.DMATXE.R = 0xFFFF; /* enable DMA */
LINFlexD_0.DMARXE.R = 0xFFFF; /* enable DMA */

(and after that I'm not even doing anything with the actual DMA module)

and disable them in my prepare to go to standby procedure:

LINFlexD_0.DMATXE.R = 0; /* disable DMA */
LINFlexD_0.DMARXE.R = 0; /* disable DMA */

I will NOT be able to go to standby. If I check the registers of TXE and RXE, after the disabling, they are both 0. 

 

However, if I don't enable it from the beginning, it WILL go to standby. 

 

Any idea if I'm disabling this in the wrong way?

Original Attachment has been moved to: main.c.zip

Labels (1)
Tags (1)
1 Solution
1,621 Views
gvictorio
Contributor III

shijiaguo‌, seems like it matters the order in which things are done when preparing the LINFlexD for a transition to STANDBY. Disabling the LINFlexD channel DMA before starting to prepare does the trick. i.e. kind of following the reverse order of the driver initialization.

/* Disable DMA First */

LINFlexD_0.DMATXE.R = 0; /* disable DMA */
LINFlexD_0.DMARXE.R = 0; /* disable DMA */

/* Now disable LINFlexD interrupts, clear ISR pending flags, etc */

View solution in original post

5 Replies
1,622 Views
gvictorio
Contributor III

shijiaguo‌, seems like it matters the order in which things are done when preparing the LINFlexD for a transition to STANDBY. Disabling the LINFlexD channel DMA before starting to prepare does the trick. i.e. kind of following the reverse order of the driver initialization.

/* Disable DMA First */

LINFlexD_0.DMATXE.R = 0; /* disable DMA */
LINFlexD_0.DMARXE.R = 0; /* disable DMA */

/* Now disable LINFlexD interrupts, clear ISR pending flags, etc */

1,621 Views
shijiaguo
Contributor II

Works like magic

0 Kudos
1,621 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

usually the pending interrupt from peripherals may block the mode transition. So ensure all peripherals interrupt flags are cleared before entering low power mode.

Also check the DMA is really inactive before you clear DMARXE/DMATXE registers.

 

Or please share the code that shows the issue, so we can check/test it.

BR, Petr

1,621 Views
shijiaguo
Contributor II

So in order to get rid of the side effect of DMA, I didn't even call the DMA module after my UART init. 

My code is very long and hard to extract, so I'm taking one of the examples from here:

Example MPC5748G Standby mode GHS614 

and adding my part of code into it. Kinda can give an idea of how I'm doing it. See the attached file in the main dialog for my code.

If you comment out these two lines in static void UART_initChannel0(void):

LINFlexD_0.DMATXE.R = 0xFFFF; /* enable DMA */
LINFlexD_0.DMARXE.R = 0xFFFF; /* enable DMA */

It should go to standby. However, if you just run the code as is, although in the static void UART_prepareStandby(void) function, those are disabled, it won't go to standby

0 Kudos
1,621 Views
shijiaguo
Contributor II

Also I made sure that all interrupts in UART and DMA were cleared and disabled. Please see if I'm missing something. Thank you! @Petr Stancik

0 Kudos