Skip to main content
Visitor II
April 4, 2024
Solved

How to save CNT values from multiple timers via DMA trigger with STM32G473?

  • April 4, 2024
  • 2 replies
  • 3888 views

I’m using an STM32G473 and I have TIM20 CHANNEL1 configured in output compare mode. When the compare value is reached, I want to move CNT values from TIM1, TIM5, TIM6, TIM7 and TIM15 to 5 static locations in memory.

I’m not sure if I can use DMA to streamline this. I’m using CubeMX and HAL and I’m looking for examples of something like this, but so far I only see DMA examples for transferring to and from the triggering peripheral. Can DMA do this?

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    You'd need multiple DMA triggered by a common source, say TIMx_UP or TIMx_CCx at zero phase

    The transactions wouldn't occur at the same instant.

    You might be able to create an Input Capture case where TIMx->CNT moves to TIMx->CCx and then recover the latched value at your leisure.

    2 replies

    Graduate II
    April 4, 2024

    You'd need multiple DMA triggered by a common source, say TIMx_UP or TIMx_CCx at zero phase

    The transactions wouldn't occur at the same instant.

    You might be able to create an Input Capture case where TIMx->CNT moves to TIMx->CCx and then recover the latched value at your leisure.

    KHarb.1Author
    Visitor II
    June 21, 2024

    I changed the design a bit to allow it to do basically what you're proposing.

    Super User
    April 5, 2024

    > You might be able to create an Input Capture case

    ... based on master-slave connection between TIM20 and the "target" TIMx...

    > where TIMx->CNT moves to TIMx->CCx and then recover the latched value at your leisure.

    ... or you use the target TIM's CCx signal to trigger DMA of that TIM's CCRx into memory buffer.

    > I’m using CubeMX and HAL

    That may make your task harder.

    JW