Skip to main content
Explorer
June 16, 2024
Solved

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

  • June 16, 2024
  • 12 replies
  • 4864 views

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?

    This topic has been closed for replies.
    Best answer by BarryWhit

    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.

     

    12 replies

    Super User
    June 17, 2024

    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

    BarryWhitAnswer
    Graduate II
    June 17, 2024

    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.