diff --git a/sparkfun/samd/boards.txt b/sparkfun/samd/boards.txt index bdac485f..5d766b21 100644 --- a/sparkfun/samd/boards.txt +++ b/sparkfun/samd/boards.txt @@ -155,6 +155,62 @@ samd21_proRF.build.pid=0x214F samd21_proRF.bootloader.tool=openocd samd21_proRF.bootloader.file=zero/Sparkfun_SAMD21_ProRF.bin +samd21_proRF_no_bl.name=SparkFun SAMD21 Pro RF (no bootloader, 8 MHz) +samd21_proRF_no_bl.vid.0=0x1B4F +samd21_proRF_no_bl.pid.0=0x214F +samd21_proRF_no_bl.vid.1=0x1B4F +samd21_proRF_no_bl.pid.1=0x215F +samd21_proRF_no_bl.upload.tool=bossac +samd21_proRF_no_bl.upload.protocol=sam-ba +samd21_proRF_no_bl.upload.maximum_size=262144 +samd21_proRF_no_bl.upload.use_1200bps_touch=true +samd21_proRF_no_bl.upload.wait_for_upload_port=true +samd21_proRF_no_bl.upload.native_usb=true +samd21_proRF_no_bl.build.mcu=cortex-m0plus +samd21_proRF_no_bl.build.f_cpu=8000000L +samd21_proRF_no_bl.build.usb_product="SFE SAMD21 Pro RF" +samd21_proRF_no_bl.build.usb_manufacturer="SparkFun" +samd21_proRF_no_bl.build.board=SAMD_ZERO +samd21_proRF_no_bl.build.core=arduino +samd21_proRF_no_bl.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags} +samd21_proRF_no_bl.build.ldscript=linker_scripts/gcc/flash_without_bootloader.ld +samd21_proRF_no_bl.build.openocdscript=openocd_scripts/arduino_zero.cfg +samd21_proRF_no_bl.build.variant=SparkFun_ProRF +samd21_proRF_no_bl.build.variant_system_lib= +samd21_proRF_no_bl.build.extra_combine_flags= +samd21_proRF_no_bl.build.vid=0x1B4F +samd21_proRF_no_bl.build.pid=0x214F +samd21_proRF_no_bl.bootloader.tool=openocd +samd21_proRF_no_bl.bootloader.file=zero/Sparkfun_SAMD21_ProRF.bin + +samd21_proRF_no_bl_24.name=SparkFun SAMD21 Pro RF (no bootloader, 24 MHz) +samd21_proRF_no_bl_24.vid.0=0x1B4F +samd21_proRF_no_bl_24.pid.0=0x214F +samd21_proRF_no_bl_24.vid.1=0x1B4F +samd21_proRF_no_bl_24.pid.1=0x215F +samd21_proRF_no_bl_24.upload.tool=bossac +samd21_proRF_no_bl_24.upload.protocol=sam-ba +samd21_proRF_no_bl_24.upload.maximum_size=262144 +samd21_proRF_no_bl_24.upload.use_1200bps_touch=true +samd21_proRF_no_bl_24.upload.wait_for_upload_port=true +samd21_proRF_no_bl_24.upload.native_usb=true +samd21_proRF_no_bl_24.build.mcu=cortex-m0plus +samd21_proRF_no_bl_24.build.f_cpu=24000000L +samd21_proRF_no_bl_24.build.usb_product="SFE SAMD21 Pro RF" +samd21_proRF_no_bl_24.build.usb_manufacturer="SparkFun" +samd21_proRF_no_bl_24.build.board=SAMD_ZERO +samd21_proRF_no_bl_24.build.core=arduino +samd21_proRF_no_bl_24.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags} +samd21_proRF_no_bl_24.build.ldscript=linker_scripts/gcc/flash_without_bootloader.ld +samd21_proRF_no_bl_24.build.openocdscript=openocd_scripts/arduino_zero.cfg +samd21_proRF_no_bl_24.build.variant=SparkFun_ProRF +samd21_proRF_no_bl_24.build.variant_system_lib= +samd21_proRF_no_bl_24.build.extra_combine_flags= +samd21_proRF_no_bl_24.build.vid=0x1B4F +samd21_proRF_no_bl_24.build.pid=0x214F +samd21_proRF_no_bl_24.bootloader.tool=openocd +samd21_proRF_no_bl_24.bootloader.file=zero/Sparkfun_SAMD21_ProRF.bin + samd21_proRF_1w.name=SparkFun SAMD21 Pro RF 1W samd21_proRF_1w.vid.0=0x1B4F samd21_proRF_1w.pid.0=0x8D21 diff --git a/sparkfun/samd/cores/arduino/startup.c b/sparkfun/samd/cores/arduino/startup.c index d66bfa8e..27e9cd07 100644 --- a/sparkfun/samd/cores/arduino/startup.c +++ b/sparkfun/samd/cores/arduino/startup.c @@ -227,7 +227,13 @@ void SystemInit( void ) /* ---------------------------------------------------------------------------------------------- * 5) Switch Generic Clock Generator 0 to DFLL48M. CPU will run at 48MHz. */ +#if F_CPU != 8000000L + +#if F_CPU == 24000000L + GCLK->GENDIV.reg = GCLK_GENDIV_DIV(2) | GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_MAIN ) ; // Generic Clock Generator 0 +#else GCLK->GENDIV.reg = GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_MAIN ) ; // Generic Clock Generator 0 +#endif while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ) { @@ -245,6 +251,7 @@ void SystemInit( void ) { /* Wait for synchronization */ } +#endif /* ---------------------------------------------------------------------------------------------- * 6) Modify PRESCaler value of OSC8M to have 8MHz @@ -277,7 +284,8 @@ void SystemInit( void ) PM->APBBSEL.reg = PM_APBBSEL_APBBDIV_DIV1_Val ; PM->APBCSEL.reg = PM_APBCSEL_APBCDIV_DIV1_Val ; - SystemCoreClock=VARIANT_MCK ; + //SystemCoreClock=VARIANT_MCK ; + SystemCoreClock = F_CPU; /* ---------------------------------------------------------------------------------------------- * 8) Load ADC factory calibration values diff --git a/sparkfun/samd/platform.txt b/sparkfun/samd/platform.txt index c145b308..e4cc19fc 100644 --- a/sparkfun/samd/platform.txt +++ b/sparkfun/samd/platform.txt @@ -183,7 +183,7 @@ tools.openocd.erase.pattern= tools.openocd.bootloader.params.verbose=-d2 tools.openocd.bootloader.params.quiet=-d0 -tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify reset; shutdown" +tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{runtime.platform.path}/bootloaders/{bootloader.file}} verify reset; shutdown" # # OpenOCD sketch upload - version with configurable bootloader size @@ -210,4 +210,4 @@ tools.openocd-withbootsize.erase.pattern= tools.openocd-withbootsize.bootloader.params.verbose=-d2 tools.openocd-withbootsize.bootloader.params.quiet=-d0 -tools.openocd-withbootsize.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify reset; shutdown" +tools.openocd-withbootsize.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{runtime.platform.path}/bootloaders/{bootloader.file}} verify reset; shutdown"