AnsweredAssumed Answered

Kinetis K65F DMA wakeup in WAIT mode

Question asked by Charles Klibbe on Feb 26, 2016
Latest reply on Mar 9, 2016 by Charles Klibbe

Hi,

 

I am using a K65M180M and have a requirement to put the device in WAIT mode and the DMA must wake-up the MCU after the transfer is complete.

 

The MCU uses the PDB to trigger the ADC and the DMA stores the ADC results. The DMA works fine in RUN mode.

 

My problem is that the DMA does not wake-up the MCU once the transfer has completed. I tested the PDB and ADC interrupt and they wake-up the MCU but the DMA interrupt does not wait up the MCU. I have the SW3 pin interrupt enabled, on the TWR-K65F180M board, and it wakes the MCU it as well. I have tried using the SW3 to wake the MCU and retrigger the DMA but it still does not wake-up from WAIT mode.

 

I can't find any examples that use the DMA in WAIT mode and I have been through the following documents and can't see why it will not work:

KQRUG

AN4590

AN4822

AN4447

 

Can anyone give me advice as to why it may not wake-up?

 

PS. This it the procedure I use at the moment to get the MCU into WAIT mode:

    SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll);

     // Configure the PDB and the ADC here

    /* Configure DMAMUX */

    DMAMUX_Init(DMAMUX0);

    DMAMUX_SetSource(DMAMUX0, 0, kDmaRequestMux0ADC1 & 0xFF);

    DMAMUX_EnableChannel(DMAMUX0, 0);

    /* Configure EDMA one shot transfer */

    EDMA_GetDefaultConfig(&userConfig);

    EDMA_Init(DMA0, &userConfig);

    EDMA_CreateHandle(&g_EDMA_Handle, DMA0, 0);

    EDMA_SetCallback(&g_EDMA_Handle, EDMA_Callback, NULL);

    EDMA_PrepareTransfer(&transferConfig, (void *)ADC16_GetDataRegisterAddress(DEMO_ADC16_BASE), sizeof(uint16_t), &AudioBuffer[ActiveBuffer], sizeof(int16_t),

                         sizeof(int16_t), AUDIO_BUFFER_SIZE * 2, kEDMA_PeripheralToMemory);

    EDMA_SubmitTransfer(&g_EDMA_Handle, &transferConfig);

 

    /* Wait for debug console output finished. */

    while (!(kUART_TransmissionCompleteFlag & UART_GetStatusFlags((UART_Type *)BOARD_DEBUG_UART_BASEADDR)))

    {

    }

    DbgConsole_Deinit();

        /*

         * Set pin for current leakage.

         * Debug console RX pin: Set to pinmux to disable.

         * Debug console TX pin: Don't need to change.

         */

        PORT_SetPinMux(DEBUG_CONSOLE_RX_PORT, DEBUG_CONSOLE_RX_PIN, kPORT_PinDisabledOrAnalog);

 

     // SW3 interrupt enable

        PORT_SetPinInterruptConfig(APP_WAKEUP_BUTTON_PORT, APP_WAKEUP_BUTTON_GPIO_PIN, APP_WAKEUP_BUTTON_IRQ_TYPE);

     // Start the DMA

    EDMA_StartTransfer(&g_EDMA_Handle);

 

   // Switch to WAIT mode

    SMC_SetPowerModeWait(SMC);

 

MCU never wakes up unless I press SW3.

 

Regards,

Charles

Outcomes