Skip to main content
Associate
July 21, 2026
Question

STM32H743 ADC3 temperature sensor not reading correctly in latest STMCubeMX 6.18 but was working in earlier STM32CubeMX 6.15

  • July 21, 2026
  • 1 reply
  • 24 views

We have recently updated to the latest STM32CubeMX 6.17 and then STMCubeMX 6.18 and noticed in both versions that the internal temperature sensor is mis-reading (by something like 100x).

Previously the project was reading the temperature correctly (STMCubeMX 6.14 or 6.15 not sure exactly).

I have checked that all the ADC3 settings are the same and there are no changes causing by migrating the .IOC project.

I’ve also checked the TSEN and VREFEN are enabled in ADC3_CCR. The value is 0x00C00000.

Before I invest a lot of time rolling back to the old STM32CubeMX version and investigating what changed that broke the ADC3 internal temperature reading I’m hoping that this is known issue with the latest STM32CubeMX?

STM32CubeMX generated code:

  /** Common config
*/
hadc3.Instance = ADC3;
hadc3.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1;
hadc3.Init.Resolution = ADC_RESOLUTION_12B;
hadc3.Init.ScanConvMode = ADC_SCAN_ENABLE;
hadc3.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
hadc3.Init.LowPowerAutoWait = DISABLE;
hadc3.Init.ContinuousConvMode = ENABLE;
hadc3.Init.NbrOfConversion = 2;
hadc3.Init.DiscontinuousConvMode = DISABLE;
hadc3.Init.ExternalTrigConv = ADC_SOFTWARE_START;
hadc3.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
hadc3.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DMA_CIRCULAR;
hadc3.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN;
hadc3.Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE;
hadc3.Init.OversamplingMode = ENABLE;
hadc3.Init.Oversampling.Ratio = 1024;
hadc3.Init.Oversampling.RightBitShift = ADC_RIGHTBITSHIFT_10;
hadc3.Init.Oversampling.TriggeredMode = ADC_TRIGGEREDMODE_SINGLE_TRIGGER;
hadc3.Init.Oversampling.OversamplingStopReset = ADC_REGOVERSAMPLING_CONTINUED_MODE;
if (HAL_ADC_Init(&hadc3) != HAL_OK)
{
Error_Handler();
}

The latest version 6.18 of STM32CubeMX has changed the generated code slightly so that ADC_RESOLUTION_12B is done separately. Rolling this change back had no affect on the mis-reading.

Initialization:

#define ADC3_BufferSize 2

uint16_t ADC3_Buffer[ADC3_BufferSize];

HAL_ADCEx_Calibration_Start(&hadc3, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED);
HAL_ADC_Start_DMA(&hadc3, (&ADC3_Buffer), ADC3_BufferSize);

SCB_InvalidateDCache_by_Addr(&ADC3_Buffer, ADC3_BufferSize * sizeof(uint16_t));

Get_CPU_Temp = __HAL_ADC_CALC_TEMPERATURE(__HAL_ADC_CALC_VREFANALOG_VOLTAGE(ADC3_Buffer[1], ADC_RESOLUTION_12B), ADC3_Buffer[0], ADC_RESOLUTION_12B);

 

1 reply

Ghofrane GSOURI
ST Technical Moderator
July 21, 2026

Hello ​@ifemc 

I recommend generating the same project with both STM32CubeMX 6.15.0 and 6.18.0, then comparing the generated code using a diff tool such as WinMerge. This will help identify any changes introduced by the newer version, especially in the ADC initialization, channel configuration, oversampling, DMA handling, cache management, and internal temperature sensor/VREF setup. Even if the .ioc file appears unchanged, differences in the generated source code or updated HAL drivers may explain the incorrect temperature reading.

I will be waiting for your feedback.

THX

Ghofrane

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.
ifemcAuthor
Associate
July 23, 2026

This was difficult but I have narrowed it down to the following. I have two zip files (before and after) of the generated code:

  1. firstly with a working temperature sensor - M400-STM32H743XIH IOC before migrate (working).zip
  2. secondly with the temperature sensor misreading - M400-STM32H743XIH IOC after migrate (not working).zip

M400-STM32H743XIH IOC before migrate (working).zip

M400-STM32H743XIH IOC after migrate (not working).zip

Note: I can’t include my application code in these zip files.

I start with my working project, which was originally created in STM32CubeMX 6.14

I then upgraded to STMCubeMX 6.18 on my PC.

I open the .IOC project (created by STM32CubeMX 6.14) with STMCubeMX 6.18 and do not migrate by clicking the Continue button when prompted.

I then click GENERATE CODE.

I compiled the project and run it in my STM32H743 - which correctly reads the internal temperature (45 deg C).

The generated files are in M400-STM32H743XIH IOC before migrate (working).zip

I open the .IOC project again (created by STM32CubeMX 6.14) with STMCubeMX 6.18 and this time I migrate the project by clicking the Migrate button when prompted.

I then click GENERATE CODE.

I compiled the project and run it in my STM32H743 - which misreads the internal temperature (4990 deg C).

The generated files are in M400-STM32H743XIH IOC after migrate (not working).zip

Looking at the differences, the ADC files in particular, I cannot see what is causing this problem.