Arm Community
Site
Search
User
Site
Search
User
Support forums
Arm Development Studio forum
1 us delay generation
Jump...
Cancel
Locked
Locked
Replies
4 replies
Subscribers
119 subscribers
Views
3594 views
Users
0 members are here
Options
Share
More actions
Cancel
Related
How was your experience today?
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion
1 us delay generation
avadhoot kumthekar
over 12 years ago
Note: This was originally posted on 11th May 2011 at
http://forums.arm.com
Dear all,
I am using Linux OS with arm-elf tool chain. I am not able to generate 1 us delay using 'for loop' method of 'C' programming language.Is there anything that i can try?
thanks & regards
Avadhoot
Jerry Fan
over 12 years ago
Note: This was originally posted on 11th May 2011 at
http://forums.arm.com
sleep() can be used to get delay, but the accuracy is poor, almost 1ms, that is the tick of the linux system. So 1us can not be got by sleep() Cycle conter has a much high accuracy, that is the 1/CPU_freq. But the problem is that if "WFI" was used, for example, the idle task may use that instruction in some RTOS, the CPU will suspend, that is the cycle conter was supend. If "WFI" instruction was not used in Linux, cycle counter is a good way to delay 1us. I think some system API can be called to do that.
Cancel
Vote up
0
Vote down
Cancel
Etienne SOBOLE
over 12 years ago
Note: This was originally posted on 11th May 2011 at
http://forums.arm.com
Maybe you could use the Cycle Counter Register
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0344b/Bgbjjhaj.html
I never succed to use it, maybe you'll have more chance !
Cancel
Vote up
0
Vote down
Cancel
Martin Weidmann
over 12 years ago
Note: This was originally posted on 11th May 2011 at
http://forums.arm.com
Generating a reliable delay of a given length using a loop is difficult with modern processors, doubly so when running under a rich OS such as Linux. There is just so much going on you don't have control over.
Not done much Linux app development, but can't you use some sort of wait()/sleep() call from the OS?
Cancel
Vote up
0
Vote down
Cancel
Marcus Harnisch
over 12 years ago
Note: This was originally posted on 12th May 2011 at
http://forums.arm.com
Not sure if usleep(2) is precise enough.
--
Marcus
Cancel
Vote up
0
Vote down
Cancel