Skip to content

Commit

Permalink
[stm32] Fix STM32G0 ADC
Browse files Browse the repository at this point in the history
The internal voltage regulator is not enabled and calibration never
suceeds.
  • Loading branch information
chris-durand committed Jul 26, 2023
1 parent a05cc62 commit 5d03d53
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/modm/platform/adc/stm32f0/adc_impl.hpp.in
Expand Up @@ -28,6 +28,11 @@ modm::platform::Adc{{ id }}::initialize()
{
Rcc::enable<Peripheral::Adc{{ id }}>();

%% if target.family in ["g0"]
ADC1->CR |= ADC_CR_ADVREGEN;
modm::delay_us(20);
%% endif

if constexpr (mode == ClockMode::Synchronous) {
constexpr auto result = Prescaler::from_power(
SystemClock::Apb, frequency, {{2 if target.family in ["f0"] else 1}}, 4);
Expand Down

0 comments on commit 5d03d53

Please sign in to comment.