-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STM32 HAL issue - reading internal temp after VBAT measurement. #1685
Comments
Hi, thanks for pointing that out. We'll have a deeper look when we'll add the ADC internal channels measurement in mbed Classic. FYI we have started doing this in mbed OS on another device (F0, but not public for the moment). I'll check if there is the same problem. |
Hi. I have seen such ADC-internal extensions to mbed(os?) for the F4 over at https://github.com/ARMmbed which might benefit from clearing that bit too. |
ARM Internal Ref: IOTMORF-199 |
A patch is on-going in mbed SDK (not ST HAL driver). |
@bcostm
Measuring VBAT sets the ADC_CCR_VBATE bit in ADC->CCR, and there doesn't appear to be a way with the HAL to clear it.
If it isn't cleared, VBAT remains connected to the ADC channel in preference to temperature, so VBAT readings are returned in place of temperature. See the note at the bottom of page 226 of the reference manual RM0368, DM00096844.pdf
I resorted to poking the register directly:
As per the comments in the above code, perhaps that bit should be cleared when configuring the ADC to read the temperature in stm32f4xx_hal_adc.c & stm32f4xx_hal_adc_ex.c ?
The text was updated successfully, but these errors were encountered: