This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

RTX osTimerStart() interval short

Hi! I'm trying to learn osTimerStart(), \ble_app_hrs_rtx. Compiling was successful, and it is working. If I set the timer interval shorter than 25 ms, the timer cycle becomes abnormally short. The cycle of other timers also becomes short.Is this a specification?

For example //#define RR_INTERVAL_INTERVAL 300 #define RR_INTERVAL_INTERVAL 10

  • I tried to set the RR_INTERVAL_INTERVAL to 10, and the rr_interval_timeout_handler() triggers around 10 ms, not even close to 264 or 284. I tested with SDK 11.0.0 and ble_app_hrs_rtx. Have you changed anything else? Are you doing anything else? What board are you using? nRF51 DK? PCA10028?

  • When you set RR_INTERVAL_INTERVAL to 10 ms, Please check the main loop repeats, Is it 1000 ms cycle?. Perhaps, the cycle is about 920 ms. To reproduce this phenomenon, there is only one change point, "# define RR_INTERVAL_INTERVAL 10". What I use is our original board. If you can not reproduce, please answer the question about the argument of os_resume. 2 is correct? or 0 is ?

  • I did some more testing, and I was able to reproduce. I'm not sure what the issue is, but I'm looking into it. Hopefully I will have more information for you tomorrow.

  • It seems to get a better if you add

    if(expected_time != 0)
    {
        expected_time--;
    }
    

    just before os_resume(expected_time); in RTX_Conf_CM.c, but this is only without SoftDevice, or without using the SoftDevice. Starting to advertise seems to disturb the timing and actually I get like 1200 ms instead of 1000 ms. This is with RR set to 10, I see that most RR intervals are 10 ms, but some increases to 16-17 ms when the SoftDevice is advertising, and I think that is why I see 1200 ms, not 1000 ms.

    To be honest, I recommend not using RTX, at least not together with the SoftDevice. It is unstable, and not well tested. We have actually decided to remove the support for it.

    If you absolutely need an RTOS I recommend to rather look into FreeRTOS.

    See this and this for more information.

    I'm sorry for any inconvenience this has caused you.

Related