Skip to content
This repository has been archived by the owner on Jan 7, 2019. It is now read-only.

Commit

Permalink
Fix comments for enablePll calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sh4rK committed Jan 13, 2018
1 parent 658cb81 commit 9b44afb
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ struct systemClock {
ClockControl::enableInternalClock(); // 16MHz
ClockControl::enablePll(
ClockControl::PllSource::InternalClock,
4, // 16MHz / N= 4 -> 4MHz
84, // 4MHz * M=84 -> 336MHz
4, // 16MHz / M= 4 -> 4MHz
84, // 4MHz * N=84 -> 336MHz
4, // 336MHz / P= 4 -> 84MHz = F_cpu
8 // 336MHz / Q= 7 -> 48MHz = F_usb
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ struct systemClock {
ClockControl::enableInternalClock(); // 16MHz
ClockControl::enablePll(
ClockControl::PllSource::InternalClock,
4, // 16MHz / N=4 -> 4MHz
96, // 4MHz * M=96 -> 384MHz
4, // 16MHz / M=4 -> 4MHz
96, // 4MHz * N=96 -> 384MHz
4, // 384MHz / P=4 -> 96MHz = F_cpu
8 // 384MHz / Q=8 -> 48MHz = F_usb
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ struct systemClock
ClockControl::enableExternalClock(); // 8 MHz
ClockControl::enablePll(
ClockControl::PllSource::ExternalClock,
4, // 8MHz / N=4 -> 2MHz
180, // 2MHz * M=180 -> 360MHz
4, // 8MHz / M=4 -> 2MHz
180, // 2MHz * N=180 -> 360MHz
2, // 360MHz / P=2 -> 180MHz = F_cpu
7 // 360MHz / Q=7 -> ~51MHz = F_usb => bad for USB
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ struct systemClock
ClockControl::enableExternalCrystal(); // 8 MHz
ClockControl::enablePll(
ClockControl::PllSource::ExternalCrystal,
4, // 8MHz / N=4 -> 2MHz
180, // 2MHz * M=180 -> 360MHz
4, // 8MHz / M=4 -> 2MHz
180, // 2MHz * N=180 -> 360MHz
2, // 360MHz / P=2 -> 180MHz = F_cpu
7 // 360MHz / Q=7 -> ~51MHz = F_usb => bad for USB
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ struct systemClock
ClockControl::enableExternalCrystal(); // 8 MHz
ClockControl::enablePll(
ClockControl::PllSource::ExternalCrystal,
8, // 8MHz / N=8 -> 1MHz !!! Must be 1 MHz for PLLSAI !!!
360, // 1MHz * M=360 -> 360MHz
8, // 8MHz / M=8 -> 1MHz !!! Must be 1 MHz for PLLSAI !!!
360, // 1MHz * N=360 -> 360MHz
2, // 360MHz / P=2 -> 180MHz = F_cpu
7 // 360MHz / Q=7 -> ~51MHz (value ignored! PLLSAI generates 48MHz for F_usb)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ struct systemClock {
ClockControl::enableExternalCrystal(); // 8MHz
ClockControl::enablePll(
ClockControl::PllSource::ExternalCrystal,
4, // 8MHz / N=2 -> 2MHz
168, // 2MHz * M=168 -> 336MHz
4, // 8MHz / M=2 -> 2MHz
168, // 2MHz * N=168 -> 336MHz
2, // 336MHz / P=2 -> 168MHz = F_cpu
7 // 336MHz / Q=7 -> 48MHz = F_usb
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ struct systemClock
ClockControl::enableExternalClock(); // 25 MHz
ClockControl::enablePll(
ClockControl::PllSource::ExternalClock,
25, // 25MHz / N=25 -> 1MHz
432, // 1MHz * M=432 -> 432MHz
25, // 25MHz / M=25 -> 1MHz
432, // 1MHz * N=432 -> 432MHz
2, // 432MHz / P=2 -> 216MHz = F_cpu
9 // 432MHz / Q=9 -> 48MHz = F_usb
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ struct systemClock
ClockControl::enableExternalClock(); // 25 MHz
ClockControl::enablePll(
ClockControl::PllSource::ExternalClock,
25, // 25MHz / N=25 -> 1MHz
432, // 1MHz * M=432 -> 432MHz
25, // 25MHz / M=25 -> 1MHz
432, // 1MHz * N=432 -> 432MHz
2, // 432MHz / P=2 -> 216MHz = F_cpu
9 // 432MHz / Q=9 -> 48MHz = F_usb
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ struct systemClock {

// ClockControl::enablePll(
// ClockControl::PllSource::MultiSpeedInternalClock,
// 1, // 4MHz / N=1 -> 4MHz
// 16, // 4MHz * M=16 -> 64MHz <= 344MHz = PLL VCO output max, >= 64 MHz = PLL VCO out min
// 1, // 4MHz / M=1 -> 4MHz
// 16, // 4MHz * N=16 -> 64MHz <= 344MHz = PLL VCO output max, >= 64 MHz = PLL VCO out min
// 1, // 64MHz / P=1 -> 64MHz = F_cpu
// 2 // 64MHz / Q=2 -> 32MHz = F_usb
// );
Expand Down

0 comments on commit 9b44afb

Please sign in to comment.