Portenta H7 temperature sensor

Hi,
Do the H7 has a onboard temperature sensor?
Maybe the midcarrier has one?
how to read it?
The STM32H747xI/G report having one but I don’t see how to access it from the code.

thank you

According to the documentation on the Arduino website it has a temperature sensor.
I did a Google search and found THIS

Thank you sosfcy.
interesting examples but I don’t see where it reads CPU temperature

Hi,

This will give you the MCU junction temp:

mbed::AnalogIn mcuADCVref(ADC_VREF);
mbed::AnalogIn mcuADCTemp(ADC_TEMP);
uint32_t mcuVref, mcuTemp;

void setup() {
  mcuVref = __LL_ADC_CALC_VREFANALOG_VOLTAGE(mcuADCVref.read_u16(), ADC_RESOLUTION_16B);
...
}
void loop() {
  mcuTemp = __HAL_ADC_CALC_TEMPERATURE(mcuVref, mcuADCTemp.read_u16(), ADC_RESOLUTION_16B);
...
}

Hi steve9,
thank you very much for the answer. It works!

I was unable to find any type of documentation or examples.
I mean I was aware of the internal temperature sensors from the STM datasheet, but how to go from that to the mbed/portenta implementation?

thank you

void loop() {

  mbed::AnalogIn mcuADCVref(ADC_VREF);
  uint16_t mcuADCVref_u16=mcuADCVref.read_u16();
  uint32_t mcuVref = __LL_ADC_CALC_VREFANALOG_VOLTAGE(mcuADCVref_u16,ADC_RESOLUTION_16B);

  mbed::AnalogIn mcuADCTemp(ADC_TEMP);
  uint16_t mcuADCTemp_u16 = mcuADCTemp.read_u16();
  uint32_t mcuTemp = __HAL_ADC_CALC_TEMPERATURE(mcuVref, mcuADCTemp_u16,ADC_RESOLUTION_16B);

  Serial.println("mcuADCVref_u16:"+String(mcuADCVref_u16)+"     mcuVref:"+String(mcuVref)+" mcuADCTemp_u16:"+String(mcuADCTemp_u16)+" mcuTemp:"+String(mcuTemp));
}

Reading the vRef in the loop seems better, while reding once it in the setup gives unpredictable results (at least on my unit)

I'm using GIGA R1 so quite possibly differences in power management between the two. Glad it works for you and the Portenta.