stm32: support stm32f401 adc_temperature sensor (#5572)

> The temperature sensor is internally connected to the ADC_IN18

> The TSVREFE bit must be set to enable the conversion of both internal channels: the ADC1_IN16 or ADC1_IN18 (temperature sensor) and the ADC1_IN17 (VREFINT).

Ref.: https://www.st.com/resource/en/reference_manual/dm00096844-stm32f401xb-c-and-stm32f401xd-e-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdf

Signed-off-by: Kamil Trzciński <ayufan@ayufan.eu>
This commit is contained in:
Kamil Trzciński 2022-06-20 18:13:02 +02:00 committed by GitHub
parent f2a5800cea
commit 0256967def
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -28,7 +28,7 @@ static const uint8_t adc_pins[] = {
ADC_TEMPERATURE_PIN,
#elif CONFIG_MACH_STM32F2 || CONFIG_MACH_STM32F4x5
ADC_TEMPERATURE_PIN, 0x00, 0x00,
#elif CONFIG_MACH_STM32F446
#elif CONFIG_MACH_STM32F401 || CONFIG_MACH_STM32F446
0x00, 0x00, ADC_TEMPERATURE_PIN,
#endif
@ -108,7 +108,9 @@ gpio_adc_setup(uint32_t pin)
}
if (pin == ADC_TEMPERATURE_PIN) {
#if !(CONFIG_MACH_STM32F1 || CONFIG_MACH_STM32F401)
#if CONFIG_MACH_STM32F401
ADC1_COMMON->CCR = ADC_CCR_TSVREFE;
#elif !CONFIG_MACH_STM32F1
ADC123_COMMON->CCR = ADC_CCR_TSVREFE;
#endif
} else {