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-value2013-12-27 06:05 AM
It depends on the TIM unit, which APB bus it's on, and what APB dividers are being used.
For the typical 168 MHz system APB2 is at DIV2, and it's TIMCLKs at DIV1 (168 MHz), and APB1 is at DIV4 and it's TIMCLKs at DIV2 (84 MHz) These setting usually appear in system_stm32f4xx.c, along with the PLL settings. To run the processor at 128 MHz instead of 168 MHz you'd want to change PLL_N from 336 to 256, and adjust other related constants to match the new speed, ie SystemCoreClock At the sample rate in question I'd probably not use an interrupt, but rather use the TIM to drive the ADC, and in turn the DMA An F1 example about 3/5 down, not directly applicable to the F4 A dual F4 example about 1/4 down,2014-01-03 12:58 AM
2014-01-03 05:33 AM
2014-01-14 06:50 AM
2014-12-29 09:43 PM
2014-12-29 10:09 PM
I have tried with using the system clock's internal oscillator which is 16Mhz and APB1 prescalar as 1 which gives me tim2 also 16Mhz. It is giving me the interrupt after every 1 second as have checked with CRO after setting the prescalr value to 16000 and timer count to 1000. but why it is giving me 9 us interrupt when I am setting the prescalar to 0 and timer count to 25. It should give me 1.5625 us
Having the processor interrupt every 25 cycles, is perhaps, somewhat ill-conceived? Try having the hardware do the heavy lifting, and interrupt less frequently.2014-12-31 01:25 AM
2014-12-31 01:30 AM
the prescalar value is 2 and the timer count is 50. The sys clk is 128000000 and the tim2 frequency is 64000000
2014-12-31 06:19 AM
I really don't want to get dragged into doing your job here.
161 MHz? 160 KHz Your choice of channels is neither configured correctly, or addresses availability of resources on the STM32F4-Discovery board. How do you think sending dozens of characters at 9600 baud (say 960 chars per second) is remotely enough for the speed at which you are taking samples? I don't think I'd be sequencing the samples in this fashion, and would probably use DMA+TIM.