Skip to main content
Visitor II
October 21, 2021
Solved

STM32MP1 DIE TEMP- FREQ-VBAT

  • October 21, 2021
  • 3 replies
  • 2179 views

is there any way find dts config /sys/ file to check stm32mp1  in linux sdk ?

cpu temp 

freq

battery voltage vbat measurement.

    This topic has been closed for replies.
    Best answer by Kevin HUBER

    Hi @Ara.1​ ,

    I don't know why, but it seems that these kernel configs are missing in your configuration.

    CONFIG_CPU_FREQ=y
    CONFIG_CPU_FREQ_STAT=y
    CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
    CONFIG_CPU_FREQ_GOV_POWERSAVE=m
    CONFIG_CPU_FREQ_GOV_USERSPACE=m
    CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
    CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
    CONFIG_CPUFREQ_DT=y

    Please add them by enabling:

    0693W00000GVoWSQA1.png0693W00000GVoVyQAL.png 

    If you are using the starter package, they are already enabled, but for testing purpose, I removed these configurations from my linux on my MP157f-dk2 with the starter package and I get the same issue than you.

    root@stm32mp1:~# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
    cat: /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq: No such file or directory

    Please have a look at this page if you don't know how to modify your linux configuration: https://wiki.st.com/stm32mpu/wiki/Menuconfig_or_how_to_configure_kernel

    PS: If you built your kernel in a different build directory (different of kernel source code directory), remember to specify it when using the make command of the wiki page.

    Hope it helps,

    Regards,

    Kevin

    3 replies

    Ara.1Author
    Visitor II
    October 22, 2021

    is there any way find dts config /sys/ file to check stm32mp1 

    cpu temp  ?

    freq ?

    battery volatge vbat measurement. ?

    Technical Moderator
    October 22, 2021

    Hello @Ara.1​ 

    To know the current CPU frequency (in Hz), you could use this standard Linux command:

    • cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq

    To know the die temperature using DTS IP, you could use this standard Linux command:

    • cat cat /sys/class/thermal/thermal_zone0/temp

    Result to be divided by 1000 for a temperature value in °C

    Note that on 800MHz devices with starter package, DFVS is implemented, which automatically reduce cpu frequency to 400MHz and VDDCORE in case of low activity (or if too hot die temperature).

    Please have a look to https://wiki.st.com/stm32mpu/wiki/How_to_change_the_CPU_frequency

    To measure the VBAT value, you should use the internal ADC2 channel 15, but currently, this is not available on Linux.

    Development team are working on it and should be available in next ecosystem revision (expected in few weeks from now), and I understand at that time it could be accessed using IIO framework.

    VBAT on ADC2 Channel 15 is already available on Cortex-M4 using HAL SW.

    Regards.

    In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

    Ara.1Author
    Visitor II
    October 22, 2021

    Hi Patric,

    Temperature info got it

    but CPU cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq is not there

    for cpu freq any dts change required?

    Technical Moderator
    October 22, 2021

    Hi,

    Tested ok on my side with both Ecosystem V3 (kernel 5.10) and Ecosystem V2 (kernel 5.4) using Starter Package on both STM32MP157F-DK2 and STM32MP157C-DK2 boards.

    Maybe missing the &cpu0_opp_table, even if fixed frequency on your board (although obviously useless to check the frequency if it is fixed).

    see https://wiki.st.com/stm32mpu/wiki/How_to_change_the_CPU_frequency#OPP_table

    Regards.

    Ara.1Author
    Visitor II
    October 25, 2021

    https://wiki.st.com/stm32mpu/wiki/How_to_change_the_CPU_frequency#OPP_table

    is this link to be handled in kernel dts ? if not, let us know how to do it ?

    yes if its cpu freq fixed its no use for us, but i need to see the adoption of frequency based on load at cpu side ? do we have any window on dts file configfor gettting the cur freq ?