Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to configure wait states with defines #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions inc/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@

#define CPU_FREQUENCY 48000000

#ifndef FLASH_WAIT_STATES //allow for other wait states
#define FLASH_WAIT_STATES 1
#endif

#ifndef BOOT_USART_MODULE
#define BOOT_USART_MODULE SERCOM3
Expand Down
2 changes: 1 addition & 1 deletion src/init_samd21.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static void dfll_sync(void) {

void system_init(void) {

NVMCTRL->CTRLB.bit.RWS = 1;
NVMCTRL->CTRLB.bit.RWS = FLASH_WAIT_STATES;

#if defined(CRYSTALLESS)
/* Configure OSC8M as source for GCLK_GEN 2 */
Expand Down
2 changes: 1 addition & 1 deletion src/init_samd51.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ uint32_t current_cpu_frequency_MHz = 48;

void system_init(void) {
// Automatic wait states.
NVMCTRL->CTRLA.bit.AUTOWS = 1;
NVMCTRL->CTRLA.bit.AUTOWS = FLASH_WAIT_STATES;

// Output GCLK0 to Metro M4 D5. This way we can see if/when we mess it up.
// PORT->Group[1].PINCFG[14].bit.PMUXEN = true;
Expand Down