Linux task scheduling

Is it possible to schedule a program to run every 5 ms or 10 ms, etc.? I need to generate a pulse through the serial port for 1 kHz and 15 kHz. But the program should only switch contacts in the serial port, so the frequency must be created by the scheduler. Is this possible in linux with rt patch?

+4
source share
4 answers

I believe that the best solution is to generate a momentum in a loop, for example:

for (;;) {
    generate_pulse(); /* generate a pulse */
    sleep(5ms);       /* or 10ms */
}
+1
source

is this possible in linux with a rt patch?

I suggest switching to RT patch if the time is critical.

Xenomai is an RT patch that I used on the 2.6 kernel a few days ago.

, 1 . http://www.xenomai.org/documentation/trunk/html/api/trivial-periodic_8c-example.html

+1

PPS, ( , 2.6, 3.x , , ) mainline linux kernel.

PPS txt

PPS ( Carrier Detect) (ACK-pin) CPU GPIO ( ), , , .

-, //, , , .

API- /usr/include/linux/pps.h.

+1

- . - . ( ) , . . timer_create() timer_settime() . , fork() execl(). (). , .

0

Source: https://habr.com/ru/post/1530172/


All Articles