Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Jitter problems on imx8

mondinmr
2023-10-18
2023-10-19
  • mondinmr

    mondinmr - 2023-10-18

    We are experiencing serious jitter issues on an ARM64 imx8.
    Until now, on rpi and beaglebone derivatives, and on Intel, we never encountered jitter issues unless they were already present on the device.

    In this case, as can be seen from the attached graph, we have excellent maximum latency. The cyclictest on the isolated core dedicated to IEC CODESYS tasks shows a latency of 37Β΅s, with an average of 14Β΅s.

    Usually, on all other devices, with an RT kernel, with the appropriate parameters to avoid frequency throttling, with properly managed IRQs, and with the disabling of large page sizes, the jitter measured by CODESYS is very close to the cyclictest latency.

    However, on this imx8, we are noticing a fluctuating value of +/- 300Β΅s that seems to be added to this latency, as if something occasionally miscalculates the sleep times by exactly +/- 300Β΅s.

    Two screenshoot attached.
    - Result of cyclictest
    - Jitter on CODESYS

    Tasks are assigned to isolated core!

     
  • mondinmr

    mondinmr - 2023-10-19

    SOLVED!!!

    In this imx8 max_cstate=1 in kernel boot parameters is not working!

    We found a workaround:

    #include <stdio.h>
    #include <fcntl.h>
    #include <unistd.h>
    #include <stdint.h>
    
    int main(void) {
        int fd;
        uint32_t value = 0;
    
        fd = open("/dev/cpu_dma_latency", O_WRONLY);
        if (fd < 0) {
            perror("Error opening /dev/cpu_dma_latency");
            return 1;
        }
    
        if (write(fd, &value, sizeof(value)) != sizeof(value)) {
            perror("Error writing to /dev/cpu_dma_latency");
            close(fd);
            return 1;
        }
    
        while (1) {
            pause();
        }
    }
    

    This simple code launched before CODESYS do the same work!
    Now jitter is identical as measured by cyclictest!

     

Log in to post a comment.