cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMxIDE v1.0.2 for STM32f031x6 ADC usage problem

istepne
Associate III

I am using CubeMxIDE v1.0.2 with STM32f031F6

Tring to read internal batt and temperature. But can not successfull..

I found that SMT32F031x6.h library file and corrected the following lines

#define ADC_CCR_VREFEN_Pos       (22U)                                       

#define ADC_CCR_TSEN_Pos         (23U)                                       

#define ADC_CCR_VBATEN_Pos       (24U)                                       

with below

#define ADC_CCR_VREFEN_Pos       (21U)

#define ADC_CCR_TSEN_Pos         (22U)

#define ADC_CCR_VBATEN_Pos       (23U)

and now it works.

Please can you check it is OK or if I am wrong lets give me a solution

Regards

Murat

1 REPLY 1
istepne
Associate III

It is weird but, I have upgraded to Cube FW_F0_V1.11.0 and CubeIDE v1.1.0.

Stil I can not get the Vbat register. Reads as 0 always. Then I changed again as previously made.

After changing the definitios on "SMT32F031x6.h" file as below, it works!!!

(Project->Options->C++ Build->Settings->MCU GCC Compiler->Optimization->OptimizationLevel="Optimize for size (-Os)" )

#define ADC_CCR_VREFEN_Pos       (21U)

#define ADC_CCR_TSEN_Pos         (22U)

#define ADC_CCR_VBATEN_Pos       (23U)