cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to trigger DMA using GPIO input pin in STM32G030K8.

SKUND.11
Associate III

I have to generate a DMA request using GPIO input pin to change the polarity bit of my TIMER which I'm using as PWM(initial polarity is set to HIGH) to LOW which will change by setting the polarity bit to 1. Whenever the GPIO input pin get a rising edge, I have to trigger the DMA.

Here is the snippet code of what I'm doing.

Here i have configured DMA with request pin(GPIO_EXTI5) (giving a rising edge to this pin using a comparator, and I've checked that this pin is getting a rising edge).

0693W00000QLK5CQAX.pnghere is the config of GPIO input pin-

0693W00000QLK5bQAH.png and here is the code-

0693W00000QLK7IQAX.pnguint32_t DMA_CR_Value = TIM1->CCER | 0x2; // OR with the Timer CCER register so that CC1P bit changes to 1(HIGH to LOW)

HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1); // I have to change the polarity of this timer

HAL_DMAEx_EnableMuxRequestGenerator(&hdma_dma_generator1); //Enabling it so that request(trigger by gpio input pin) that we have made would enable

HAL_DMA_Start(&hdma_dma_generator1, (uint32_t)DMA_CR_Value,TIM1->CCER, sizeof(DMA_CR_Value)); // Src- memory to Dst - peripheral

The polarity bit doesn't seems to be changing.

1 REPLY 1
gbm
Lead III

See the errata, section 2.2.4

https://www.st.com/resource/en/errata_sheet/es0486-stm32g030x6x8-device-errata-stmicroelectronics.pdf

You may still trigger DMA via a timer by using the input pin as timer capture input.