AnsweredAssumed Answered

how can I use a gpio input as a dma trigger source with QN9080 IC

Question asked by zxd zxd on May 15, 2019
Latest reply on May 24, 2019 by Estephania Martinez

Hi, every one, how can I use a gpio input as a dma trigger source with QN9080 IC.

 

Environment: Hardware: QN908x-DK board; Software: SDK_2.2.0_QN908XCDK

 

From the QN908x user mannual. I found that:

The DMA can use trigger input multiplexing to sequence DMA transactions without the
use of interrupt service routines

 

and in my code, I set the DMA and pinmux as fallows:

#define PININT0_DMA_CHANNEL 0

DMA_Init(DMA0);
DMA_EnableChannel(DMA0, PININT0_DMA_CHANNEL);
DMA_CreateHandle(&g_DMA_Handle, DMA0, PININT0_DMA_CHANNEL);
DMA_SetCallback(&g_DMA_Handle, DMA_Callback, NULL);

trigger.burst = kDMA_SingleTransfer;
trigger.type = kDMA_RisingEdgeTrigger;
trigger.wrap = kDMA_NoWrap;
DMA_ConfigureChannelTrigger(DMA0, PININT0_DMA_CHANNEL, &trigger);
DMA_PrepareTransfer(&transferConfig, (uint32_t*)&(GPIOA->DATA), pBuf, 1,
0x10, kDMA_PeripheralToMemory, NULL);
DMA_SubmitTransfer(&g_DMA_Handle, &transferConfig);
DMA_StartTransfer(&g_DMA_Handle);


/* Connect trigger sources to PINT */
INPUTMUX_Init(INPUTMUX);
INPUTMUX_AttachSignal(INPUTMUX, kPINT_PinInt0, kINPUTMUX_GpioPort0Pin26ToPintsel);
INPUTMUX_AttachSignal(INPUTMUX, kPINT_PinInt0, kINPUTMUX_PinInt0ToDma);

/* Initialize PINT */
PINT_Init(PINT);
/* Setup Pin Interrupt 0 for rising edge */
PINT_PinInterruptConfig(PINT, kPINT_PinInt0, kPINT_PinIntEnableRiseEdge, pint_intr_callback);

 

But the code can never go into DMA_Callback function,  if I add the code as fallowed:

PINT_EnableCallback(PINT);

to enable the gpio interrupt, the code can jump into the pint_intr_callback function rightly;That meas there has request signal in this pin. 

So that I'm wonder if my set of dma and pinmux is right or not, and how can I set them so that the dma can work ok.

 

Hope to get your help as quickly as possible.

Thanks a lot.

Outcomes