473,325 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

nanosecond delay using arm linux c complier

I am new to ARM linux, i am working on AT91RM9200 board and using ARM linuc C complier.. i want to know how to produce nanosecond delay using software...
Jun 26 '07 #1
16 10027
Motoma
3,237 Expert 2GB
I am new to ARM linux, i am working on AT91RM9200 board and using ARM linuc C complier.. i want to know how to produce nanosecond delay using software...
Take a look at the nanosleep function.
You may need to recompile your kernel to increase the timer interrupt frequency in order to improve the resolution of the nanosleep function.
I do not know what the clock-speed on that chip is, you may have to move your code into the kernel, if that fine of a resolution is attainable.
Jun 26 '07 #2
Take a look at the nanosleep function.
You may need to recompile your kernel to increase the timer interrupt frequency in order to improve the resolution of the nanosleep function.
I do not know what the clock-speed on that chip is, you may have to move your code into the kernel, if that fine of a resolution is attainable.


Thank ... I am using 18.432 MHZ Clock now i need to generate 100 nanosecond delay through software. i am using Kernal 2.4.19.. please giude me..
Jun 29 '07 #3
Motoma
3,237 Expert 2GB
Thank ... I am using 18.432 MHZ Clock now i need to generate 100 nanosecond delay through software. i am using Kernal 2.4.19.. please giude me..
Did you take a look at the nanosleep function?
Do you have experience in rebuilding your kernel? If you did so, do you know how to get the new kernel onto your device?
Jun 29 '07 #4
Did you take a look at the nanosleep function?
Do you have experience in rebuilding your kernel? If you did so, do you know how to get the new kernel onto your device?


i tried it bit didn't get in nanosecond... No i didn't rebuilding kernel... help me plese ...
Jul 2 '07 #5
Motoma
3,237 Expert 2GB
i tried it bit didn't get in nanosecond... No i didn't rebuilding kernel... help me plese ...
If nanosleep does not give you the resolution you are looking for (probably gives 10ms resolution for you :P ) and you don't have the knowledge to rebuild your kernel, I would suggest you build yourself a function, which performs some rudimentary calculation and returns. This will be your no-op function, and it's sole purpose will be to take up a small amount of time (hopefully less than a nanosecond). You may want to set this as a macro as calling a function may push you over the time you want. What you will then do is call the linux program time (or the built in C timing functions) and use that to measure the amount of time your no-op function takes. Once you know this, you can semi-accurately judge how many will give you the 100 nanoseconds you need.
Jul 2 '07 #6
If nanosleep does not give you the resolution you are looking for (probably gives 10ms resolution for you :P ) and you don't have the knowledge to rebuild your kernel, I would suggest you build yourself a function, which performs some rudimentary calculation and returns. This will be your no-op function, and it's sole purpose will be to take up a small amount of time (hopefully less than a nanosecond). You may want to set this as a macro as calling a function may push you over the time you want. What you will then do is call the linux program time (or the built in C timing functions) and use that to measure the amount of time your no-op function takes. Once you know this, you can semi-accurately judge how many will give you the 100 nanoseconds you need.
Hi.. i am trying out these ... i heared about GAS ASSEMBLER but i don't where can get it, how to install it,how to use it and is it possible to write assembly code in GCC ? how to compile it?
Jul 5 '07 #7
Motoma
3,237 Expert 2GB
Hi.. i am trying out these ... i heared about GAS ASSEMBLER but i don't where can get it, how to install it,how to use it and is it possible to write assembly code in GCC ? how to compile it?
Well, you could try using inline assembly in your C code, but I have no experience with this.
Jul 5 '07 #8
Well, you could try using inline assembly in your C code, but I have no experience with this.

I have one doubt that i tried nanosleep command but i got only in millisecond using C in GCC compiler if i use the GAS can i attain my gaol...
Jul 14 '07 #9
Motoma
3,237 Expert 2GB
I have one doubt that i tried nanosleep command but i got only in millisecond using C in GCC compiler if i use the GAS can i attain my gaol...
Did you try inline ASM?
Did you try the "no-op loop?"
Jul 15 '07 #10
drhowarddrfine
7,435 Expert 4TB
How many nanoseconds are you talking about? If you really mean one nanosecond then it isn't going to happen. Processor instruction time isn't that fast so even assembly can't do it.

GAS is the gnu assembler. You probably have AS on your machine which is the assembler for gcc, at least on FreeBSD it is. But, like I said, you won't get nanosecond measurement with that.
Jul 15 '07 #11
Did you try inline ASM?
Did you try the "no-op loop?"

S.. i mean the same ....i need 800ns delay...
Jul 16 '07 #12
How many nanoseconds are you talking about? If you really mean one nanosecond then it isn't going to happen. Processor instruction time isn't that fast so even assembly can't do it.

GAS is the gnu assembler. You probably have AS on your machine which is the assembler for gcc, at least on FreeBSD it is. But, like I said, you won't get nanosecond measurement with that.


i need a dealy of 800 ns... is it possible ???????
Jul 16 '07 #13
Motoma
3,237 Expert 2GB
Take a look at this post, I think it has the information you are looking for.
Jul 16 '07 #14
drhowarddrfine
7,435 Expert 4TB
I haven't delved into instruction timing in a long time but I don't think he can get 800ns out of any routine. But I don't know anything about an embedded system like this either. And to react to 800ns would be quite a task.
Jul 17 '07 #15
Can u help me how to rebuild the GCC and kernel...
Jul 24 '07 #16
Motoma
3,237 Expert 2GB
Can u help me how to rebuild the GCC and kernel...
In all honesty, no, we cannot help you with that task.
The process of rebuilding your kernel is complicated and involves a lot of tuning and knowledge of your hardware; two things which only you (hopefully) will be able to do.
I would strongly suggest contacting the supplier and finding out if they have a toolkit you can use for building software on the processor, and seeing if they have any documentation for re-flashing the system. Another great idea would be to join the development mailing list for the device you are working with. Also, try some thorough Googling.
Jul 24 '07 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: richard | last post by:
I am trying to do non-delay mode read from cin, i.e. char ch; ... while( cin.getch(ch) ) { ... } I want getch to return whenever there is a char typed (not wait till a newline is seen).
2
by: amos_s12 | last post by:
Hello everybody Is there a possibility to make a delay between two sql statements, namely one sql statement is performed, then there is a delay of some seconds and then rhe next statement is...
8
by: Macgyver | last post by:
Hi all, does anyone know how to generate a millisecond delay in C, compiling under Linux? I understand the function sleep() will generate a delay down to a resolution of one second, but I need...
17
by: silveira neto | last post by:
Using a delay in C, using Linux. gcc-3.3 This program do a boy in a bike runing in the screen. :D Its cool to see about games and delay in C. #include<stdio.h> int branco(int j){ int k; for...
8
by: John | last post by:
Hi all: Is there a C function to make a procedure sleep or delay for a few seconds/minutes on Linux and Sun OS platform? Thanks
2
by: qbin_wang | last post by:
Hi: now i want to download a free c complier which can be used in windows system.and i see many posts in the comp.lang.c,but i don't find the answer.who can tell me the true and correct website...
14
by: Rene Grothmann | last post by:
I have managed to communicate between forms and Java applets. A button press sends the content of the text area to an applet, a second button gets some text from the applet and puts it into the...
2
by: ShawnD | last post by:
I'm having some issues when trying to read input off of a pipe using a python script. I'm trying to process packet data from tcpdump in real-time, so it's a filter that needs to read data while the...
11
by: W.K. | last post by:
Hello, I have a question about using GNU C++ proprietary software development, is this possible or against the GNU license? Any good commercial cross platform complier recommendation ? ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.