This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

real-time kernel patch

Other Parts Discussed in Thread: AM3517

hello

is there a real-time kernel patch available for the kernel which is delivered with the PSP for the AM3517? currently i'm using the PSP 03.00.00.02 which has the kernel version 2.6.31-rc7.

Update:

The main reason why I have asked for a RT patch for the AM3517 PSP is because I've noticed that the time resolution of the kernel seems to be very low. I've written a small test application that calls clock_gettime() before and after a for-loop:


#include <time.h>
#include <stdio.h>
#include <string.h>


void diff(struct timespec* t1, struct timespec* t2);

int main()
{
    int i;
    struct timespec ts_before, ts_after;
    memset(&ts_before, 0, sizeof ts_before);
    memset(&ts_after, 0, sizeof ts_after);

    printf("looping 500x ... \n");
    clock_gettime(CLOCK_MONOTONIC, &ts_before);
    for (i = 0; i < 500; ++i );
    clock_gettime(CLOCK_MONOTONIC, &ts_after);
    diff(&ts_before, &ts_after);

    printf("looping 1000x ... \n");
    clock_gettime(CLOCK_MONOTONIC, &ts_before);
    for (i = 0; i < 1000; ++i );
    clock_gettime(CLOCK_MONOTONIC, &ts_after);
        diff(&ts_before, &ts_after);

    printf("looping 2000x ... \n");
    clock_gettime(CLOCK_MONOTONIC, &ts_before);
    for (i = 0; i < 2000; ++i );
    clock_gettime(CLOCK_MONOTONIC, &ts_after);
    diff(&ts_before, &ts_after);

    printf("looping 3000x ... \n");
    clock_gettime(CLOCK_MONOTONIC, &ts_before);
    for (i = 0; i < 3000; ++i );
    clock_gettime(CLOCK_MONOTONIC, &ts_after);
    diff(&ts_before, &ts_after);

    printf("looping 5000x ... \n");
    clock_gettime(CLOCK_MONOTONIC, &ts_before);
    for (i = 0; i < 5000; ++i );
    clock_gettime(CLOCK_MONOTONIC, &ts_after);
    diff(&ts_before, &ts_after);

    return 0;
}

void diff(struct timespec* t1, struct timespec* t2)
{
        int diff_s = t2->tv_sec - t1->tv_sec;
        int diff_ns = t2->tv_nsec - t1->tv_nsec;
        printf("time diff %ds, %dns\n", diff_s, diff_ns);
}

 

The output of the program is the following:

looping 500x ...
time diff 0s, 0ns
looping 1000x ...
time diff 0s, 0ns
looping 2000x ...
time diff 0s, 30517ns
looping 3000x ...
time diff 0s, 30518ns
looping 5000x ...
time diff 0s, 61035ns

looping 500x ...
time diff 0s, 30518ns
looping 1000x ...
time diff 0s, 30518ns
looping 2000x ...
time diff 0s, 30517ns
looping 3000x ...
time diff 0s, 30518ns
looping 5000x ...
time diff 0s, 61035ns

looping 500x ...
time diff 0s, 0ns
looping 1000x ...
time diff 0s, 30517ns
looping 2000x ...
time diff 0s, 30518ns
looping 3000x ...
time diff 0s, 61035ns
looping 5000x ...
time diff 0s, 91553ns

As you can see, only get multiples of 30.5usec! For me this leads to the conclusion that the resolution of clock_gettime() is only 30usec when it should be less than 10usec I'd have guessed...

Can anyone confirm this and does anyone have a solution for getting a higher resolution clock/timer?

thx, dominique

  • Instead of using the 32KHz timer for the system clock, can you use the MPU timer? You have to reconfigure your kernel to use it.  Do a make menuconfig, scroll down to System Type, then TI OMAP Implementations, and then System Timer.  The default is the 32KHz timer.  If you select this you can then change the clock to be the mpu timer.  The Kconfig help for this is:

    Select this option if you want to use the OMAP mpu timer. This    
    timer provides more intra-tick resolution than the 32KHz timer,  
    but consumes more power.

    I built a kernel this way and ran the sample code:

    looping 500x ...
    time diff 0s, 8692ns
    looping 1000x ...
    time diff 0s, 13614ns
    looping 2000x ...
    time diff 0s, 24806ns
    looping 3000x ...
    time diff 0s, 36574ns
    looping 5000x ...
    time diff 0s, 59881ns

    Steve K.

  • Hi Steve

    This was a exactly what I figured out as well and it indeed solved my problems about the POSIX time resolution. I have to admit tho, that I totally forgot about this posting :-(