cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H723 Power Monitor Temperature and VBAT

ToddA
Associate II

All:

The STM32H723 has a temperature sensor as part of PWR.

Some questions:

1. The HAL instruction to enable is HAL_PWREx_Enable_Monitoring( ) - can temperature be enabled independently of VBAT?

2. Can TEMPL and TEMPH be changed, or are these permanently set? (I assume TEMPL corresponds to -40 C and TEMPH corresponds to +125 C)

3. Is there a way to determine that monitoring is indeed enabled? (I tried halting emulation and viewing PWR->CR2.MONEN and contents were 0.)

4. If low or high temperature is detected, what should the response be? I see zero as a normal response to HAL_PWREx_GetTemperatureLevel( ).

Regards,

Todd Anderson

 

1 ACCEPTED SOLUTION

Accepted Solutions
Sarra.S
ST Employee

Hello @ToddA, sorry for the delayed answer 

1) the HAL_PWREx_EnableMonitoring() function enables both the VBAT and temperature monitoring

2) TEMPH and TEMPL are flags, the two threshold levels are TEMPhigh and TEMPlow and they are fixed by design and cannot be changed, these values are described in the datasheet: 

SarraS_0-1714662868245.png

3) yes, you would typically check the MONEN bit in the PWR_CR2 register

4) the HAL_PWREx_GetTemperatureLevel() function can  return PWR_TEMP_BELOW_LOW_THRESHOLD or PWR_TEMP_ABOVE_HIGH_THRESHOLD as you can see: 

uint32_t HAL_PWREx_GetTemperatureLevel (void)
{
  uint32_t tempLevel, regValue;

  /* Read the temperature flags */
  regValue = READ_BIT (PWR->CR2, (PWR_CR2_TEMPH | PWR_CR2_TEMPL));

  /* Check if the temperature is below the threshold */
  if (regValue == PWR_CR2_TEMPL)
  {
    tempLevel = PWR_TEMP_BELOW_LOW_THRESHOLD;
  }
  /* Check if the temperature is above the threshold */
  else if (regValue == PWR_CR2_TEMPH)
  {
    tempLevel = PWR_TEMP_ABOVE_HIGH_THRESHOLD;
  }
  /* The temperature is between the thresholds */
  else
  {
    tempLevel = PWR_TEMP_BETWEEN_HIGH_LOW_THRESHOLD;
  }

  return tempLevel;
}

  

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
Sarra.S
ST Employee

Hello @ToddA, sorry for the delayed answer 

1) the HAL_PWREx_EnableMonitoring() function enables both the VBAT and temperature monitoring

2) TEMPH and TEMPL are flags, the two threshold levels are TEMPhigh and TEMPlow and they are fixed by design and cannot be changed, these values are described in the datasheet: 

SarraS_0-1714662868245.png

3) yes, you would typically check the MONEN bit in the PWR_CR2 register

4) the HAL_PWREx_GetTemperatureLevel() function can  return PWR_TEMP_BELOW_LOW_THRESHOLD or PWR_TEMP_ABOVE_HIGH_THRESHOLD as you can see: 

uint32_t HAL_PWREx_GetTemperatureLevel (void)
{
  uint32_t tempLevel, regValue;

  /* Read the temperature flags */
  regValue = READ_BIT (PWR->CR2, (PWR_CR2_TEMPH | PWR_CR2_TEMPL));

  /* Check if the temperature is below the threshold */
  if (regValue == PWR_CR2_TEMPL)
  {
    tempLevel = PWR_TEMP_BELOW_LOW_THRESHOLD;
  }
  /* Check if the temperature is above the threshold */
  else if (regValue == PWR_CR2_TEMPH)
  {
    tempLevel = PWR_TEMP_ABOVE_HIGH_THRESHOLD;
  }
  /* The temperature is between the thresholds */
  else
  {
    tempLevel = PWR_TEMP_BETWEEN_HIGH_LOW_THRESHOLD;
  }

  return tempLevel;
}

  

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.

LCE
Principal

Wow, -25°C and +117°C... I won't complain about these fixed values, because I just learned this feature exists, after using this H7 for 2 years now.

But it shows that I made the right choice using the internal temperature sensor, connected to ADC3.
Not the most accurate - but at +117°C some other parts of the circuit have already been fried (even though it's only STM32 internal). :grinning_face_with_sweat:

Hello @LCE

Yes, this temperature range is intended to detect out-of-range temperatures that could potentially harm the device or affect its performance.

I think the absolute measurement accuracy will not be better than +/-5°C after calibration. 

>>but at +117°C some other parts of the circuit have already been fried

Yes, regarding potential circuit damage at high temperatures, while the STM32H723 can monitor temperatures up to +117°C, operating at or near this temperature could be risky for other components in the system. so, you need to consider the entire system's thermal design and not just the STM32H723's temperature thresholds.

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.

Thanks for the reply! 

As noted by LCE, I will be using the ADC3 value of temperature for monitoring.

Regards,

Todd Anderson