2019-07-27 02:22 AM
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
2019-11-04 01:10 PM
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)