Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: How to get "nano second" delays in Linux? (AT91SAM9G25)
PostPosted: Thu Feb 09, 2012 2:06 pm 
Offline

Joined: Mon Dec 19, 2011 7:01 pm
Posts: 25
Hi
I'm using SAM9g25 Evaluation Board and Kernel is 2.6.39 and buildroot is 2011-05.

Is there any method to produce "nano second" delays (may be 100ns or 500ns etc) in linux (OR rather in SAM9G25)?

I have to interface a Graphics LCD which requires delays in terms of nano seconds.

I used "nanosleep" call, but it seems it is not implemented properly. It produces "MUCH MUCH" greater delays. :(

Thanks.


Top
 Profile  
 
 Post subject: Re: How to get "nano second" delays in Linux? (AT91SAM9G25)
PostPosted: Fri Feb 10, 2012 5:40 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 784
This best way to acheive very brief delays on an ARM9 is to decrement a register in a tight assembler loop. With the cache enabled the timing can be made to the rough granularity of the CPU clock. Your ability to get exact/repeatable times will be very difficult, careful analysis should at least permit you to expect a minimum number of cycles.

For longer delays, try to find a free running counter, ideally running at the fastest speed possible, and wait for subtracted time stamps to indicate a sufficient number of cycles has expired. Reading across multiple buses, with different, sync/async, speeds, cacheing, contention, etc may also add unpredictable delays.

For accurate nano-second level signal placements, people use hardware, clocked sufficiently fast to acheive the granularity desired.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: