2010-11-12 03:51 PM
timer overflow interrupt
2011-05-17 05:14 AM
I need to use timer overflow interruption to blink a LED in STM32F107C.
I am using IAR IDE for programming.
Can somebody help me?
Try looking at the STM32 example code, pretty sure both IAR and Keil come with plenty of example code if you care to look it over. Examples\ST\STM32F10xFWLib\Examples\TIM\TimeBase SysTick example might also be instructive.
2011-05-17 05:14 AM
Hi,
What's the best way to debug? I mean, I'd like to know if the timer is running. Thanks2011-05-17 05:14 AM
What's the best way to debug? I mean, I'd like to know if the timer is running.
This will depend a lot on the equipment you have. I'd have the timer output on a pin, and check it on an oscilloscope, but I'm more interested in fine granularity timing. For 1/4 Hz or slower toggling an LED works fine for visual inspection. You could also snap shot the CPU instruction cycle counter at the interrupt, and print it out to the serial port in a foreground task. This would provide a fine grain measurement of period and interrupt latency. You could count the observed interrupt, print that out once a second. You should be able to breakpoint the timer interrupt handler with a USB JTAG pod (J-Link for IAR), you can in Keil, but at least one forum member has claimed this is not possible in IAR. Kind of doubt that, but whatever. Break points will however mess with the periodicity. The STM32VL Discovery board includes a STM32F100 and an ST-LINK JTAG debugger. It has a couple of LEDs, and easy access to the GPIO pins. Costs ~$10 + shipping. They are good for checking/validating code and ideas outside of a more complex board/project environment. They don't have an RS232 serial connection, which makes the a little less than ideal, but a lot better than some STM32 stamp boards without a proper JTAG connection.2011-05-17 05:14 AM
Hello Peter,
I do not know how my reply will help you. The things which I needed to make the interrupts work I have mention some where else in the blog. Any way these are the things I needed to done2011-05-17 05:14 AM
Hi again,
Thanks for the answers. Now I have to configure the timer to start on the rising edge os the GPS 1PPS. Which of the following modes of timer do I have to configure: 1) Input capture mode 2) External trigger sync 3) Another? Thanks2011-05-17 05:14 AM
Timers and external trigger synchronization
Slave mode: Reset mode Slave mode: Trigger mode2011-05-17 05:14 AM
Both? Do I have to configure anything else? GPIO? NVIC?
I tried unsuccessfully, the entire day, to config PC7/TIM3 (I have no restrictions about Ports/Timers) to detect the GPS' 1PPS rising border. Does anyone, please, has an example of using this? I'm using the examples located in C:\Program Files\IAR Systems\Embedded Workbench 5.4 Kickstart\arm\examples\ST\STM32F10x\stm32f10x_stdperiph_lib\Project\STM32F10x_StdPeriph_Examples. I used The ''InputCapture'' example and modified to GPIOC. Maybe should I use the ''ExtTrigger_Synchro''? Thank you very much!2011-05-17 05:14 AM
I would say the Reset Mode, if I wanted to start the timer ticking at the 1PPS. There will be a slight latency, but it's only a 16-bit counter so you're not going to get fantastic granularity if it ticks over a second period with out wrapping. Assuming here you're trying to count off milliseconds, or 100's of microseconds.
Are you looking to mark time from the top-of-second, or count the 1PPS pulses? Or measure the pulse width. Input Capture is going to count pulses.2011-05-17 05:14 AM
I have to measure how many clocks (periods) I have during 1s.
The nominal clock is 25Mhz. I have to measure it using the GPS 1PPS as reference to check the real clock. Thanks again!