Search by Tags

Apalis/Colibri iMX6 DVFS on Windows Embedded Compact

 
Applicable for

Subscribe for this article updates

DVFS support

Images and BSPs from version 1.3b4 include DVFS support.
This can be used to reduce power consumption and temperatures by decreasing the CPU frequency and voltage when the running applications don't require its full processing power.

Configuration

DVFS is not enabled by default, to enable it you need to set the following registry entry:

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Clock]
   "EnableDVFS"=dword:1

The DVFS implementation will measure CPU load (on all cores) over a defined time span (by default 100ms) and increases or decreases CPU speed accordingly. If CPU usage is under a certain threshold frequency will be decreased, if it's above an high-usage threshold it will be increased. If CPU load is close to 100% the frequency will be immediately increased to the maximum.

The values for polling time, the priority of the thread that performs the monitoring, and frequency limits can be configured using the following registry entries.

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Clock]
    "MaxFrequency"=dword:XXXXXXXX ; maximum CPU frequency in Hz, if not specified, system will use maximum CPU speed 
    "MinFrequency"=dword:XXXXXXX  ; minimum CPU frequency, if not specified system will use 78MHz
    "PollingTime"=dword:XXX       ; polling time in ms for CPU load measurement, default is 100ms
    "PanicThreshold"=dword:XX     ; percentage of CPU usage that will trigger increase to max CPU frequency,
                                  ; default is 95%
    "UsageThreshold"=dword:XX     ; percentage of CPU usage that will trigger decrease of CPU frequency, 
                                  ; default is 30%. 
                                  ; Speed will be decreased when usage is less than 30% and increased
                                  ; when more than 70% (100%-UsageThreshold)
    "DVFSPriority"=dword:XX       ; priority of the monitoring thread, default is 1, using low priorities may lead
                                  ; to slow response times when CPU usage increases

Temperature monitoring

The clock driver can also monitor temperature using the internal temperature sensor of the SOC. If the temperature reaches a maximum threshold, the maximum CPU frequency will be limited until temperature will return in the acceptable range. Temperature monitoring is enabled by default if you activate DVFS and can be configured using registry entries.

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Clock]
    "MaxFrequency"=dword:XXXXXXXX ; maximum CPU frequency in Hz, if not specified, system will use maximum CPU speed 
    "TemperaturePollingTime"=dword:XXXXX  ; Polling time in milliseconds, default time is 10000 (10s)
    "TempThreshold"=dword:XX              ; Temperature in C that activates the frequency limitation 
                                          ; default is 80C
    "TemperaturePriority"=dword:XXX       ; priority of the thread that will do temperature measurement, 
                                          ; default is 240, usually does not require high priorities

Control DVFS from application

Using the Toradex CE Libraries (clocklib), applications can require that the CPU frequency is kept inside a certain range of frequencies. This can be used to immediately increase frequency (setting the minimum value) when an application needs maximum processing power or to limit power consumption (limiting the maximum value) when the device is running on battery or has other issues that require limiting the power required by the CPU.

Other settings that could be used to limit power consumption

If your application is not using OpenGL or other APIs like the XAML Runtime that require usage of the GPU you can turn it off reducing power consumption and temperatures in a significative way. To keep the GPU turned off you need to add those entries to the registry:

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Clock]
    "Enable2D3D"=dword:0 ; GPU will not be powered-up at boot
 
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\GCHAL\]
    "Dll"="_libGALCore.dll" ; prevent GPU driver loading, otherwise it will stop and prevent boot completition

Detecting issues

The DVFS implementation is based on CPU usage. An application or driver may use a higher percentage of CPU time and this will prevent reduction of CPU clock. If the application using a high amount of CPU time is running at low priority the effect may not be noticeable in terms of latencies or UI responsiveness but will have an high impact on power consumption. On multi-core system even an application using 100% of CPU time may not be noticed by the end user because other cores will be used to grant responsiveness.
To check if DVFS is operating as expected you may enable some additional serial debug messages that will report current CPU frequency, usage and temperature.
To enable this feature add the following registry key:

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Clock]
    "DebugMessages"=dword:1 

This feature should not be enabled on a production system.