cancel
Showing results for 
Search instead for 
Did you mean: 

how to set long delay with use of timer(like up to 5 minute,)

dbgarasiya
Senior II

part number: STM32F779BI

I am using clock frequency 108 MHz ( not system clock , system clock is 216 MHZ)

I don't want to use loop

if not possible what is the maximum value i could set using timer

46 REPLIES 46

I am sure that APB1 timer clock is 108 MHz

I have attached screenshot of clock configuration

Is my calculation is right?

sorry, I had the wrong datasheet open

I found mistake, it works ok now

Thanks a lot

dbgarasiya
Senior II

Thanks to all of you @Community member​  ,@berendi​  ,@turboscrew​ ,@Community member​  for your support

dbgarasiya
Senior II

I have total 14 timers in my controller ( STM32F779BI) , I have done some timers as master-slave configration

but some timers have not master-slave configration functionality

and i know that prescaler valu maximum goes up to , i could generate maximum value of 1 millisecond

but i want to make timer of 10 milliseconds . i tried but i am getting delay of 10 ms after setting prescaler and period value

Timer clock : 108 MHz & 216 MHz , both are used for diffrent timers

how could i do that?

Dipak Garasiya

These are the limitations. You can slow down the APB clocks, or implement longer delays in software.

turboscrew
Senior III

Cascade the timers. Make one of them tick and the other to count the first one's UGs (milliseconds), not APB-clock ticks.

Now you have a longer timer, even if in two parts.

Why does everything need a unique timebase?

Can't you have one, or two TIM, establish a timebase, and then count off in increments of that?

There's not going to be particularly measurable increases in power if you wake up every minute to count off 5, for example.

Normally people have a dispatch list, the timer interrupts and updates everything in the list, and whenever one task needs executing you dispatch a call. The list can be for one-off events, or repeated events with defined periodicity.

If you use a Prescaler equivalent to the MHZ of the APB the TIM can count in 1us ticks, the Period can readily allow for 1000us (1ms) or 10000us (10ms)

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

I have configured timer 6 as below, my timer clock frequency (APB1) is 108 MHz

RCC->APB1ENR |= (1<<4);   // timer 6

TIM6->PSC = 108;

TIM6->EGR = TIM_EGR_UG;

TIM6->ARR = 10000;

TIM6->CR1 = TIM_CR1_CEN;

count = TIM6->CNT ;

I am not getting 10 millisecond of timer yet

The counters start from zero. Try PSC=107 and ARR=9999. Any closer?