STM32G431RB NUCLEO Internal Temperature Sensor Channel with Embedded Coder

9 views (last 30 days)
Hi all,
I followed the Simulink example below.
And I found a problem with CubeMX 6.4.0, which is compatible with Embedder Coder Support Package.
When I generated code with CubeMX 6.4.0, the ADC initialization went wrong. (at main.c line 197)
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(ADC1), LL_ADC_PATH_INTERNAL_VREFINT);
While I generated code with CubeMX 6.12.1, the ADC initialized well. (at main.c line 197)
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(ADC1), LL_ADC_PATH_INTERNAL_VREFINT | LL_ADC_PATH_INTERNAL_TEMPSENSOR);
Due to the lack of temperature path, The measurement of room temperautre was about -90°C with CubeMX 6.4.0.
I couldn't figure out how to run CubeMX 6.12.1 with Embedded Coder.
Is there any way to solve this problem?
MATLAB related version:
- MATLAB 2023a
- Embedded Coder Support Package for ARM Cortex-M Processors V23.1.0
- Embedded Coder Support Package for STMicroelectronics STM32 Processors V23.1.3
STM32 related version:
- STM32CubeMX V.6.4.0
(STM32Cube_FW_G4_V1.5.1)
- STM32CubeMX V.6.12.1
(STM32Cube_FW_G4_V1.6.1)
Also the attached files are Simulink, and CubeMX projects.

Accepted Answer

재은
재은 on 26 Nov 2024
Solved by typing the code below at ADC initialization.
/* USER CODE BEGIN ADC1_Init 2 */
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(ADC1), LL_ADC_PATH_INTERNAL_VREFINT | LL_ADC_PATH_INTERNAL_TEMPSENSOR);
/* USER CODE END ADC1_Init 2 */
Thanks.

More Answers (0)

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!