2012-02-25 01:34 AM
hi,
I am using STM32VL board.. In my application i am reading voltage for every 6.25micro sec. so i'm using timer TIM2 in interupt mode for that. can any one tell me what value i need to set fro prescaler and period. Sys clock is 24Mhz and ADC clock is 12 MZ. thanks a lot in advance #timer-value2012-02-25 05:50 AM
I am using STM32VL board.. In my application i am reading voltage for every 6.25micro sec. so i'm using timer TIM2 in interupt mode for that. can any one tell me what value i need to set fro prescaler and period. Sys clock is 24Mhz and ADC clock is 12 MZ.
Some basic math involved, 6.25 us is 160 KHz, TIMCLK is 24 MHz 24,000,000 / 160,000 = 150; Prescale = 0; // ie 1 - 1, no division Period = 150 - 1;2012-02-27 02:31 AM
hi,
Thanks a lot for ur help. can you tell me why subtraction is required there..??2012-02-27 02:34 AM
hi ..
thanks a lot for the help.. can u tell me why subtration is required there?2012-02-27 05:02 AM
can u tell me why subtration is required there?
The value is the final count, zero based, thus a divide by N is achieved by programming a value of N-1 into the period. Please refer to part documentation for more details.
2013-12-25 10:49 PM
Can anyone tell me how to generate an interrupt of 1.5625 microsecond. I am using Timer 2 . Timer frequency is 84000000. what is the value I should set in ARR and prescalar. Please help me
2013-12-25 11:25 PM
2013-12-26 04:12 AM
1.5625 microsecond = 640 KHz, seems a bit high for an interrupt rate. If you are looking to generate a pin output, connect the timer directly, and don't use interrupts, or consider more carefully what it is you're trying to do.
84,000,000 / 640,000 = 132.25 That's non-integer, so either you'll have to tolerate the frequency being off slightly, or run the CPU at a speed that is cleanly divisible (ie 128 MHz, or whatever) Prescaler = 0; Period = 132 - 1;2013-12-26 10:41 PM
Thanks for the reply. My task is to read the adc channels after 1.5625 microsecond this is the requirement. Input frequency is 160 khz. if we set the vale to 131 we get 1.571428571 us. which is not my requirement. therfore can you explain me briefly so that I can considered my requirement as I am new to stm32 controller.
Thanks in Advance2013-12-26 10:49 PM
how to set the sysclk to 128000000 as 128000000/200 = 640 khz. but I have a doubt that timer frequency is 84 mhz or the maximum is 168 Mhz . So can we set it to 128000000. if yes please say me how to do this. I will be greatful to you as i have no idea and I am new to stm32f4