-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
338d5d3
commit 39a6a54
Showing
3 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright (c) 2021, Tomasz Wasilczyk | ||
* | ||
* This file is part of the modm project. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
#include <modm/architecture/interface/clock.hpp> | ||
#include <modm/platform.hpp> | ||
|
||
using namespace std::chrono_literals; | ||
using namespace modm::platform; | ||
|
||
struct SystemClock | ||
{ | ||
// Chosen to achieve 300MHz system clock | ||
static constexpr uint32_t PllAMult = 25; | ||
static constexpr uint32_t Frequency = 300'000'000; // TODO: PllAMult * 12'000'000 (OSC12M); | ||
|
||
static bool inline | ||
enable() | ||
{ | ||
// TODO: enable OSC12M? | ||
// TODO: enable MAINCK? | ||
ClockGen::setFlashLatency<Frequency>(); // TODO: what is this for? | ||
ClockGen::updateCoreFrequency<Frequency>(); // TODO: what is this for? | ||
ClockGen::enablePllA<PllAMult>(); | ||
ClockGen::selectMasterClk<MasterClkSource::MAIN_CLK, MasterClkPrescaler::CLK_1>(); | ||
return true; | ||
} | ||
}; | ||
|
||
int | ||
main() | ||
{ | ||
WDT->WDT_MR = (WDT_MR_WDDIS_Msk); // turn off Watchdog | ||
SystemClock::enable(); | ||
SysTickTimer::initialize<SystemClock>(); | ||
|
||
using Led0 = modm::platform::GpioD17; | ||
using Led1 = modm::platform::GpioD16; | ||
using Led2 = modm::platform::GpioD15; | ||
|
||
Led0::setOutput(false); | ||
Led1::setOutput(true); | ||
Led2::setOutput(false); | ||
|
||
while (1) | ||
{ | ||
Led0::toggle(); | ||
modm::delay(500ms); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
source [find interface/jlink.cfg] | ||
transport select swd | ||
|
||
source [find target/atsamv.cfg] | ||
|
||
# Set boot mode selection to Flash (instead of SAM-BA on ROM) | ||
init | ||
halt | ||
atsamv gpnvm set 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<library> | ||
<options> | ||
<option name="modm:target">samv70n20b-aabt</option> | ||
<option name="modm:build:build.path">../../../build/samv/blink</option> | ||
<option name="modm:build:openocd.cfg">openocd.cfg</option> | ||
</options> | ||
<modules> | ||
<module>modm:build:scons</module> | ||
<module>modm:platform:core</module> | ||
<module>modm:platform:clock</module> | ||
<module>modm:platform:gpio</module> | ||
<module>modm:architecture:delay</module> | ||
<module>modm:platform:clockgen</module> | ||
</modules> | ||
</library> |