ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My simple application is toggle the CPU GPIO (GPIO control made by direct memory access using mmap of /dev/mem)
But somehow, the GPIO signal toggling is delayed. I monitor the GPIO with Oscilloscope and see that the signal is toggle a few second after the application toggle command.
Processes in Linux/UNIX use priority/niceness to determine when they scheduled. It sounds like you're looking for "Real Time priority". Haven't dealt with this in Linux but have in UNIX. Found the following discussion of Real Time for Linux that may be of help to you:
I don’t need a real time performance. But I have to understand the delay reason for the following simple flow :
1)set GPIO to “1”
2) printf(“GPIO value == 1\r\n”)
3)sleep(20) - sleep for 20second
4)set GPIO to “0”
5) printf(“GPIO value == 0\r\n”)
6)sleep(20) - sleep for 20second
5)goto 1)
>> printf message is after GPIO setting !!!
Monitor result:
GPIO value == 1
After few seconds (~4 ) the signal is “1”
….here is the sleep delay
GPIO value == 0
After few seconds (~4 ) the signal is “0”
….here is the sleep delay
so why the GPIO signal is delayed after the printf message ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.