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.
Hello,
Just to confirm, did you enable the clock gating of the pin mux you are using? Also, which examples are you using as a base? Is it going to a hardfault or some kind of fault when not entering to the callback?
Regards,
Estephania
Hello,
I get the problem now, I'll try to reproduce it on my side. Something that it's still not fully clear for me, it's will you use the DMA just to pass the data like that? Or will you use it with I2C, ADC, SPI?
Regards,
Estephania
hello jive:
1. I have enabled the inputmux clock by calling INPUTMUX_Init(INPUTMUX); and that the pin interrupt call back can normally entering if I enable the pin interrupt callback also confirmed that.
2. there wasn't any error after I enabled the DMA transmission, the DMA transmission just cannot be triggered with the pin interrupt hardware trigger,
if I use software trigger by setting the SWRTIG bit in xfercfg register, the dma tranmission can be triggerred normally.
3. My project based on the 'pin_interrupt' and 'dma_memory_to_memory' project in driver examples.
4. Any more, I tryed use the SCT0 DMA request0 and timer CTIMER0 Match 0 DMA request to trigger the DMA transmission, but neither of them work.
——To sum up: the problem is seemingly focus on the hardware trigger of DMA transmission. And unfortunately there isn't any examples about this apply in the sdk.
Apart from these, with the hardware trigger mode of DMA, I still can not understand the meaning of setting the trigger type and trigger level,
as if we use SCT0 DMA reques0 to trigger the dma transmission, How shoud we set the trigger type and level, and how can the trigger source output the signal setted by the trigger type and level.
also, if we use pin interrupt 0 as dma hardware trigger, the falling or rising edge checking should be setted with PINT_PinInterruptConfig or DMA_ConfigureChannelTrigger, This perplex me so much.
look forward to your reply.
Thanks a lot.