2014-09-22 07:48 AM
Hi..
In STM32F051R8 board, Iam using TIM3. I need to set timer interrupt for every every 10 seconds. Iam unable calculate the prescaler, CCR and time period values. Can any one explain me please...2014-09-22 08:17 AM
You just need the Prescaler and Period to get an Update interrupt.
You need to take your source clock frequency, multiply by 10, and then factor into two 16-bit integer numbers (1-65536), and program those as N-1 values for Prescaler/Period TIMCLK * 10 = P * Q; Prescaler = Q-1; Period = P-1; This is pretty pedestrian math.2014-09-22 09:08 AM
Hi jaikrishna.n,
You can configure the TIM peripheral to generate a time base of 10 seconds with the corresponding Interrupt request.The TIM3 input clock (TIM3CLK) is set to APB1 clock (PCLK1), since APB1 prescaler is equal to 1.2014-09-22 10:00 AM
SystemCoreClock is set to 48 MHz for STM32F0xx Devices.
2014-09-22 10:33 AM
Prescale to 1 KHz as 10 KHz / 10000 = 1 Hz, not 0.1 Hz
2014-09-25 06:11 AM
Thanks for your immediate reply, I would like to ask some more doubts.
Is it possible to set interrupt for every 10 micro seconds? How to set the value.. If you have any example code or document related to calculation please send to me. jaikrishnamail@gmail.com THANK YOU2014-09-25 08:16 AM
Ok, but you understand the relationship between frequency and period, right?
1 MHz = 1 us 48,000,000 ticks of a 48 MHz clock is 1 second 48 ticks of a 48 MHz clock is 1 micro second 480 ticks of a 48 MHz clock is 10 micro seconds So factoring 480 480 = 1 * 480 Prescaler = 1 - 1; Period = 480 - 1; I think interrupting at 10 us (100 KHz) is probably excessive for this processor, think about what purpose this serves, and if what you're attempting to do can be kept in the hardware/peripheral domain.2014-09-25 12:59 PM
2014-09-25 08:50 PM
Ok Thankyou for your replies.. I will work with receiver timeout in USART1. In RTOR register we need to enter number of baud clocks. My controller clock value is 48MHZ. Can any one explain me how to calculate baud clock value?
2014-10-06 06:49 AM