This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CMSIS RTOS: Changing processor clock

Hi,

we want to be able to change processor clock in a running CMSIS RTOS application.

As we see, we can only statically configure RTOS via RTX_CONF_CM.c (OS_CLOCK).
In addition all variables using OS_CLOCK are defined const in RTX_CM_lib.h.

Is there a way to change processor clock via SystemCoreClockUpdate() so that timer tick
of RTOS is modified accordingly ?
So that e.g. osDelay() will always wait same time amount.

Best regards
Juergen

  • You are referring to RTX4 (based on CMSIS-RTOS API) which assumes that the processor clock does not change dynamically.

    You should consider upgrading to RTX5. You may continue using CMSIS-RTOS API or migrate to CMSIS-RTOS2 API. Take a look at the migration guide:
    http://www.keil.com/pack/doc/CMSIS/RTOS2/html/os2Migration.html

    When using RTX5 and the processor clock changes you just need to setup the SysTick LOAD register correctly after calling SystemCoreClockUpdate().

    Somehing like this:

    // freq: Kernel Tick Frequency defined in RTX_Config.h (typically 1000)
    SysTick->LOAD = (SystemCoreClock / freq) - 1U;