cancel
Showing results for 
Search instead for 
Did you mean: 

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

KHarb.1
Senior

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

3 REPLIES 3

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

> 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

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