cancel
Showing results for 
Search instead for 
Did you mean: 

Technical douts on STM32F7 MCU(Timers)

Edwin kaus
Associate II
Posted on November 03, 2017 at 13:57

Hai.,

I am using STM32F765BIT MCU in our application with custom board. Especially I am using this card in data acquisition system. Here the very big challenge is to measure frequency of 6 channels.(Every SEC I need to capture frequencies of all channels).

I have to capture 4 channel lower frequencies(range of 2Hz to 80Hz) & 2 channel higher frequencies (range of 70Hz to 10KHz). 

>> What is best way to met this requirement & how to use DMA in timer capture mode.

>> Also if I use multiple channels of same timer does It effect the accuracy of capture.

>> And I am worried about interrupts , I have USB,SPI & I2C interfaces and all are interrupt based(additionally this frequency capture interrupts) .Does MCU can able to manages all these interrupt effectively.

>> And I found 3 types of timers (basic timer ,advanced timer & general purpose timer), what is major difference b/w these timers, Can I use any of the timer for input capture mode .

I need to clarify these things before proceeding further , If one of your expert spare some time to clarify this It would be appreciated lot.

Best Regards

Edwin.

Thank you., 

#keil5 #input-capture-mode #stm32f765bit #timer-interrupts
5 REPLIES 5
Posted on November 03, 2017 at 14:18

10 KHz isn't a particularly high frequency. Using TIM2 and TIM5 you could support 8 channels, certainly in a range 100 KHz .. 0.001 Hz

>> What is best way to met this requirement & how to use DMA in timer capture mode

DMA probably not helpful here, multiple registers addresses

>> Also if I use multiple channels of same timer does It effect the accuracy of capture.

No, it is latching on edges

Input Capture can also decimate using the prescaler, ie timestamp every 8th rising edge.

External Count mode would require more resources, probably take a bunch of work to fit, and use internal/external triggers at 1HZ using 1PPS to latch.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Ben K
Senior III
Posted on November 03, 2017 at 15:47

>> What is best way to met this requirement & how to use DMA in timer capture mode.

You can use 2 TIM timers as Clive suggested. Look into the timers' Burst DMA mode, it facilitates transfer of several consecutive registers through DMA on a single event.

>> And I am worried about interrupts , I have USB,SPI & I2C interfaces and all are interrupt based(additionally this frequency capture interrupts) .Does MCU can able to manages all these interrupt effectively.

With the NVIC of the Cortex core you can configure the interrupts with different preemption priority, meaning each of them have the possibility to preempt any lower priority interrupt handler.

>> And I found 3 types of timers (basic timer ,advanced timer & general purpose timer), what is major difference b/w these timers, Can I use any of the timer for input capture mode .

Channels 1 to 4 of TIM timers are capable of input capture, independent of the other features. So just pick two timers that have 4 and 2 channels at least.

Posted on November 04, 2017 at 06:57

Hai .,

Thank you for the response, Unfortunately in our design we are not using both 32 bit timer, presently I am using 3 timer each has 2 channels (out of those only one is 32bit). Additionally I am using 2 basic timer of 1 sec & and 1ms time.

>> Frequency capture is simply measuring time count b/w two rising edges, that is not the issue.

>>But  For 1 channel I need to count number of pulses for every second , to achieve this is there any inbuilt counter or any mechanism. Please suggest. 

Thank you.,

Posted on November 06, 2017 at 13:59

Hai Clive 1.,

If I use DMA to transfer captured value to memory (in input capture mode), does it really make any sense(in terms of speed & accuracy). Now I got 4 channel working in capture mode (in interrupt mode). Now I am trying to do same using DMA, But I don't find any example for usage of DMA in input capture mode.

Can you please provide any information related to DMA access, And my doubt is if I enable DMA transfer will it automatically send captured value for two consecutive rising edge or we need to take one capture value and again I need to enable DMA to get next capture value . How it works. ?

If you can provide some samples routines its more helpful. 

Thank you.,

Posted on November 06, 2017 at 14:48

The frequencies you are using are low enough that interrupts should be sufficient. It also allows computation at each event.

DMA you'd want to be circular, with a buffer depth permitting a decimation, ie you do 10 computations for successive rising edges in an HT/TC interrupt.

I could create some examples but you would need to fund development work.

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