cancel
Showing results for 
Search instead for 
Did you mean: 

What are GPIO events? How do I connect an event to a peripheral, specifically the DMA?

mleo2
Associate III

I've been reading about GPIO and what can be triggered. I see an event can be triggered. Events can be connected to peripherals to have some control without the CPU intervening. I can't find good documentation showing how to connect or effect peripherals. I'm hoping there is a way to trigger a DMA channel to transfer data with a GPIO without a timer in between.

Are GPIO events the way to trigger a DMA transfer with an external signal? Interrupts are too slow. Timers can do it but are they necessary?

12 REPLIES 12
mleo2
Associate III

One issue with something like this is the DMA channel. TIM1_UP is one channel 6, and TIM1_CH1 is on channel 2. Is there a problem with using:

 __HAL_LINKDMA(tim_icHandle,hdma[TIM_DMA_ID_CC1],hdma_tim1_ch1);?

I'll experiment with this tomorrow.

You still haven't told us which STM32 are you using.

Also, note, that Cube inevitably implements only a fraction of what's possible in the hardware. Cube (the "library") is only a vehicle to make CubeMX clickables work, so you cannot entirely freely mix and match symbols and expect it will work. Start with understanding the hardware by reading relevant sections in Reference Manual; and if you want something which cannot be clicked in CubeMX, you may find Cube gets into your way more than helps.

JW

BarryWhit
Senior

I'm assuming UPDATE occurs every edge that's being watched.

 

No, the update event is when the timer's counter has counted a total of Period_Value (ARR) ticks and

restarts the count. Think of the update event more like triggering event at fixed-frequency. 

 

TIM_DMA_ID_CC1 is what you want (CC1 means Capture/Compare event on channel 1).

 

HAL_DMA_Start_IT(&hdma_tim1_ch1, (uint32_t)clockedData_1, (uint32_t)&(GPIOB->BSRR), 13);

 

yes, you want to manually invoke HAL_DMA_Start_IT and specify the GPIO register you wish to DMA against.

 

- If you feel a post has answered your question, please click "Accept as Solution".
- Once you've solved your issue, please consider posting a summary with any additional details you've learned. Your new knowledge may help others in the future.