cancel
Showing results for 
Search instead for 
Did you mean: 

How do use internal temperature sensor?

Mario Luzeiro
Senior

On STM32MP1, how to use the internal temperature sensor, ADC2_INP12 and internal factory calibration?

Any example?

Is it possible to access these data via A7 or just on M4 ?

1 ACCEPTED SOLUTION

Accepted Solutions
PatrickF
ST Employee

HI @Mario Luzeiro​ 

On Linux side, you have to use the Digital junction Temperature Sensor (https://wiki.st.com/stm32mpu/wiki/DTS_internal_peripheral)

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

The analog ADC junction temperature sensor input has been kept for legacy and could be used by Cortex-M4 HAL if needed.

As there is two different sensors (DTS and ADC one) at two different locations and calibrated differently, please expect few degrees of difference.

The Digital internal Temperature Sensors is usually used for informing/protecting the system from overheating.

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'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4
PatrickF
ST Employee

HI @Mario Luzeiro​ 

On Linux side, you have to use the Digital junction Temperature Sensor (https://wiki.st.com/stm32mpu/wiki/DTS_internal_peripheral)

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

The analog ADC junction temperature sensor input has been kept for legacy and could be used by Cortex-M4 HAL if needed.

As there is two different sensors (DTS and ADC one) at two different locations and calibrated differently, please expect few degrees of difference.

The Digital internal Temperature Sensors is usually used for informing/protecting the system from overheating.

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'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
DShri.1
Associate II

Hi @PatrickF​ 

I am trying to read the DTS value, without success. The Linux command returns the following error:

root@stm32mp1:~# cat /sys/class/thermal/thermal_zone0/temp
cat: /sys/class/thermal/thermal_zone0/temp: Invalid argument

Also I would like to be able to access the DTS reading from the M4 side. I have tried controlling it using the DTS registers as recommended in the reference manual, however all registers seem to remain at their reset value even after writing to it. Hence I am unable to start the sensor from DTS_CFGR1 register.

Any insights would be appreciated. Thanks

Hi @PatrickF (ST Employee)​ 

I am trying to read the DTS value, without success. The Linux command returns the following error:

root@stm32mp1:~# cat /sys/class/thermal/thermal_zone0/temp

cat: /sys/class/thermal/thermal_zone0/temp: Invalid argument

Also I would like to be able to access the DTS reading from the M4 side. I have tried controlling it using the DTS registers as recommended in the reference manual, however all registers seem to remain at their reset value even after writing to it. Hence I am unable to start the sensor from DTS_CFGR1 register.

Any insights would be appreciated. Thanks

Hi @DShri.1​ 

you might use an outdated ecosystem starter Package or if custom board/SW, the DTS might not be enabled in the Device Tree (See https://wiki.st.com/stm32mpu/wiki/Thermal_overview).

Could you try to do "uname -r" (should be 5.15.67 for ecosystem v4.1)

if not, and if you are on an ST development board, please follow the https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP1_boards/STM32MP157x-DK2/Let%27s_start/Populate_the_target_and_boot_the_image

DTS cannot be used by Cortex-M4 (as clock is enabled by Linux only when it is required).

Maybe you need to use RPMsg/OPENAMP to have Linux providing DTS temperature to Cortex-M4 FW.

Regards

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.