Shield Code 6.0
Loading...
Searching...
No Matches
modded_system_sam3xa.c File Reference

Rewrite of system_sam3xa.c to support the external crystal oscillator on the shield. 317 Lab changes are flagged in comments. This is compiled into modded_libsam_3x8e_gcc_rel.a, which is linked into the final binary with replace_libsam.py. We have to do this because the Arduino framework uses a precompiled library for initial chip setup. This allows us to modify clock settings without changing the Platformio build process. More...

#include "cmsis_include/sam3xa.h"
Include dependency graph for modded_system_sam3xa.c:

Go to the source code of this file.

Macros

#define SYS_BOARD_OSCOUNT   (CKGR_MOR_MOSCXTST(0x8))
 
#define SYS_BOARD_PLLAR   (CKGR_PLLAR_ONE | CKGR_PLLAR_MULA(0xdUL) | CKGR_PLLAR_PLLACOUNT(0x3fUL) | CKGR_PLLAR_DIVA(0x1UL))
 
#define SYS_BOARD_MCKR   (PMC_MCKR_PRES_CLK_2 | PMC_MCKR_CSS_PLLA_CLK)
 

Functions

void SystemInit (void)
 Setup the microcontroller system. Initialize the System and update the SystemFrequency variable.
 
void SystemCoreClockUpdate (void)
 
void system_init_flash (uint32_t dw_clk)
 

Variables

uint32_t SystemCoreClock = CHIP_FREQ_MAINCK_RC_4MHZ
 

Detailed Description

Rewrite of system_sam3xa.c to support the external crystal oscillator on the shield. 317 Lab changes are flagged in comments. This is compiled into modded_libsam_3x8e_gcc_rel.a, which is linked into the final binary with replace_libsam.py. We have to do this because the Arduino framework uses a precompiled library for initial chip setup. This allows us to modify clock settings without changing the Platformio build process.

Definition in file modded_system_sam3xa.c.

Macro Definition Documentation

◆ SYS_BOARD_MCKR

#define SYS_BOARD_MCKR   (PMC_MCKR_PRES_CLK_2 | PMC_MCKR_CSS_PLLA_CLK)

Definition at line 21 of file modded_system_sam3xa.c.

◆ SYS_BOARD_OSCOUNT

#define SYS_BOARD_OSCOUNT   (CKGR_MOR_MOSCXTST(0x8))

Definition at line 19 of file modded_system_sam3xa.c.

◆ SYS_BOARD_PLLAR

#define SYS_BOARD_PLLAR   (CKGR_PLLAR_ONE | CKGR_PLLAR_MULA(0xdUL) | CKGR_PLLAR_PLLACOUNT(0x3fUL) | CKGR_PLLAR_DIVA(0x1UL))

Definition at line 20 of file modded_system_sam3xa.c.

Function Documentation

◆ system_init_flash()

void system_init_flash ( uint32_t  dw_clk)

Initialize flash.

Definition at line 174 of file modded_system_sam3xa.c.

◆ SystemCoreClockUpdate()

void SystemCoreClockUpdate ( void  )

Definition at line 78 of file modded_system_sam3xa.c.

◆ SystemInit()

void SystemInit ( void  )

Setup the microcontroller system. Initialize the System and update the SystemFrequency variable.

Definition at line 29 of file modded_system_sam3xa.c.

Variable Documentation

◆ SystemCoreClock

uint32_t SystemCoreClock = CHIP_FREQ_MAINCK_RC_4MHZ

Definition at line 23 of file modded_system_sam3xa.c.