cancel
Showing results for 
Search instead for 
Did you mean: 

Implement delay in microsecods using timer

hariprasad
Associate III
Posted on January 21, 2015 at 11:57

Hi

I want to implement delay function using timer , as this has to be used with RTOS interrupt method is preffered and the Delay can vary from 500Microsec to 5.6Millisec.

And this will be called at many location in the code the timer has to be restated again.

I have created a program to achieve the same but not able to restart the Timer .

Somebody please guide/tutor me about how to achive stop timer and restart it again??

I'm using STM32F2 .....

#stm32f4 #discovery #stm32f2 #timers
1 REPLY 1
Posted on January 21, 2015 at 13:49

Interrupting at 1us is problematic. This has been covered repeatedly.

Not sure you need to keep stopping/starting. If you must interrupt, consider a free running 32-bit timer where you advance or use multiple compare registers.

For brief delays, just use a free running timer or DWT_CYCCNT, and wait for a prescribed number of cycles, at 1us (1MHz) or faster.

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/stm32f4%20discovery%20wrong%20core%20clock&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F&currentviews=4...

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