I am now currently using QNX 6.5.0 on omap3530 for robotics applications. I created a timer with an interval of 20ms to activate the main() program in a continuous method. The main() program will further creates other thread performing various tasks such as sensor data reading, control algorithms and servo driving, all in a 20ms interval fashion. A snippet of the main() is listed below.
m_chMain = ChannelCreate(0); sigevent event; event.sigev_notify = SIGEV_PULSE; event.sigev_coid = ConnectAttach(ND_LOCAL_NODE, 0, m_chMain, _NTO_SIDE_CHANNEL, 0); event.sigev_priority = getprio(0); event.sigev_code = PULSECODE_MAIN; itimerspec timer; timer_t idTimer; timer_create(CLOCK_REALTIME, &event, &idTimer); ...start other threads
The current problem is that in most of the time, the timer intervals between each activation of the main() program can be strictly close to 20ms, while there are still quite a lot of times that the intervals became like up to 26ms… For other threads created within the main(), the sum of each execution time is less than 20ms. So i am quite confused how the timer will notify the main() with such an incorrect time interval. Please kindly suggest. Thank you.