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:
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:
// Configure the PDB and the ADC here
/* Configure DMAMUX */
DMAMUX_SetSource(DMAMUX0, 0, kDmaRequestMux0ADC1 & 0xFF);
/* Configure EDMA one shot transfer */
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);
/* Wait for debug console output finished. */
while (!(kUART_TransmissionCompleteFlag & UART_GetStatusFlags((UART_Type *)BOARD_DEBUG_UART_BASEADDR)))
* 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
// Switch to WAIT mode
MCU never wakes up unless I press SW3.