cancel
Showing results for 
Search instead for 
Did you mean: 

Two DMA captures For one timer

smhhadima
Associate II
Posted on January 16, 2016 at 20:39

I have a timer (Timer1) free running.

I have assigned two input captures.

when I run this code:

 HAL_TIM_IC_Start_DMA(&htim1,TIM_CHANNEL_1,&buffer1,20);

 HAL_TIM_IC_Start_DMA(&htim1,TIM_CHANNEL_2,&buffer2,20);

only ''buffer1'' gets updated and ''buffer2'' remains all zeros

if I changed the order of the two lines only ''buffer2'' gets updated.

does it mean I cannot assign two DMA for the same counter?
6 REPLIES 6
Posted on January 16, 2016 at 22:01

You'd need to review the Reference Manual for the specific chip in question, but my understanding of the functionality is that you should be able to use two different DMA.

I suspect this is a software limitation, it would take some time/resources to prove that.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
smhhadima
Associate II
Posted on January 17, 2016 at 07:20

I am using STM32f407 on Discovery board.

I have checked the HAL driver, it seems like it supports/configures the different DMA interrupts/requests for different channels!

but the still it does not work!

Posted on January 17, 2016 at 20:50

What is the content of TIM1_DIER in those two cases?

One step back: to which channel/stream did you set the two DMAs?

JW

smhhadima
Associate II
Posted on January 18, 2016 at 20:08

I am using TIMER1

 channel 1 (DMA2 stream 1)

and

 channel 2 DMA2 stream 2)

Posted on January 18, 2016 at 20:42

I am using TIMER1 channel 1 (DMA2 stream 1) and channel 2 DMA2 stream 2)

TIM1_CH1 -> DMA2 Stream 1 Channel 6

TIM1_CH2 -> DMA2 Stream 2 Channel 6

0690X00000605KeQAI.png

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on January 18, 2016 at 22:41

Well, post the content of relevant registers of TIM1 (DIER, CCMR1, CCER) and DMA registers (registers of those two streams, plus the status register), then.

JW