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.

Does using BIOS_setCpuFreq(&cpuFreq1) update timer settings? ()TM4C123GH6PM/BIOS6.41

Hi,

If I change the CPU clock frequency dynamically and then do a update using

BIOS_setCpuFreq(&cpuFreq1) to  the new clock frequency, will the RTOS/BIOS  reconfigure  the settings of the timers that were created for a specifed

timeouts or is the  function BIOS_setCpuFreq(&cpuFreq1)  intended only to store the current cpu frequency for information purpose?

Regards

  • Take a look at the cdoc for the Clock_tickReconfig (<bios_install_dir>docs/cdoc/index.html). Here's the snippet of it:

    This function uses the new cpu frequency to reconfigure the timer used for generation of clock ticks such that tick period is accurate. This function is used along with Clock_tickStop() and Clock_tickStart() to allow reconfiguration of timer at runtime.

    Reconfiguration may not be supported for some types of timers, and is not supported for Clock.TickMode_DYNAMIC; in these cases, this this function call will have no effect, and will return false.
    When calling Clock_tickReconfig outside of main(), you must also call Clock_tickStop and Clock_tickStart to stop and restart the timer. Use the following call sequence:
      // disable interrupts if an interrupt could lead to
      // another call to Clock_tickReconfig or if interrupt
      // processing relies on having a running timer
      Hwi_disable() or Swi_disable();
      BIOS_setCpuFreq(&freq);
      Clock_tickStop();
      Clock_tickReconfig();
      Clock_tickStart();
      Hwi_restore() or Swi_enable()
    
    When calling Clock_tickReconfig from main(), the timer has not yet been started because the timer is started as part of BIOS_start(). As a result, you can use the following simplified call sequence in main():
      BIOS_setCpuFrequency(Types.FreqHz *freq);
      Clock_tickReconfig(Void);
    
    The return value is false if the timer cannot support the new frequency
     
    So if you change the real CPU frequency, you need to let BIOS know and reconfig the kernel's Clock module (if you had it in your configuration).
     
    Todd