Skip to content

Commit

Permalink
[board] Set overdrive mode when required
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Mar 5, 2019
1 parent 5deee6d commit 08c3fba
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/modm/board/disco_f429zi/board.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ struct systemClock
180, // 2MHz * M=180 -> 360MHz
2 // 360MHz / P=2 -> 180MHz = F_cpu
);
PWR->CR |= PWR_CR_ODEN; // Enable overdrive mode
while (not (PWR->CSR & PWR_CSR_ODRDY)) ;
ClockControl::setFlashLatency(Frequency);
ClockControl::enableSystemClock(ClockControl::SystemClockSource::Pll);
ClockControl::setApb1Prescaler(ClockControl::Apb1Prescaler::Div4);
Expand Down
4 changes: 1 addition & 3 deletions src/modm/board/disco_f469ni/board.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ struct systemClock
360, // 1MHz * M=360 -> 360MHz
2 // 360MHz / P=2 -> 180MHz = F_cpu
);
// Enable overdrive mode
PWR->CR |= PWR_CR_ODEN;
// wait for it
PWR->CR |= PWR_CR_ODEN; // Enable overdrive mode
while (not (PWR->CSR & PWR_CSR_ODRDY)) ;
ClockControl::setFlashLatency(Frequency);
ClockControl::enableSystemClock(ClockControl::SystemClockSource::Pll);
Expand Down
2 changes: 2 additions & 0 deletions src/modm/board/disco_f746ng/board.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ struct systemClock
432, // 1MHz * M=432 -> 432MHz
2 // 432MHz / P=2 -> 216MHz = F_cpu
);
PWR->CR1 |= PWR_CR1_ODEN; // Enable overdrive mode
while (not (PWR->CSR1 & PWR_CSR1_ODRDY)) ;
ClockControl::setFlashLatency(Frequency);
ClockControl::enableSystemClock(ClockControl::SystemClockSource::Pll);
// APB1 is running only at 27MHz, since AHB / 4 = 54MHz > 45MHz limit!
Expand Down
2 changes: 2 additions & 0 deletions src/modm/board/disco_f769ni/board.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ struct systemClock
432, // 1MHz * M=432 -> 432MHz
2 // 432MHz / P=2 -> 216MHz = F_cpu
);
PWR->CR1 |= PWR_CR1_ODEN; // Enable overdrive mode
while (not (PWR->CSR1 & PWR_CSR1_ODRDY)) ;
ClockControl::setFlashLatency(Frequency);
ClockControl::enableSystemClock(ClockControl::SystemClockSource::Pll);
// APB1 is running only at 27MHz, since AHB / 4 = 54MHz > 45MHz limit!
Expand Down
2 changes: 2 additions & 0 deletions src/modm/board/nucleo_f429zi/board.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ struct systemClock
180, // 2MHz * M=180 -> 360MHz
2 // 360MHz / P=2 -> 180MHz = F_cpu
);
PWR->CR |= PWR_CR_ODEN; // Enable overdrive mode
while (not (PWR->CSR & PWR_CSR_ODRDY)) ;
ClockControl::setFlashLatency(Frequency);
ClockControl::enableSystemClock(ClockControl::SystemClockSource::Pll);
ClockControl::setApb1Prescaler(ClockControl::Apb1Prescaler::Div4);
Expand Down

0 comments on commit 08c3fba

Please sign in to comment.