Skip to content

Commit

Permalink
Fix issues with low frequency clock.
Browse files Browse the repository at this point in the history
  • Loading branch information
h2zero committed Jul 9, 2022
1 parent 0346651 commit 3f348a4
Show file tree
Hide file tree
Showing 30 changed files with 40 additions and 30 deletions.
2 changes: 1 addition & 1 deletion boards/BT5032A_TB.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_BT5032A_TB",
"extra_flags": "-DARDUINO_BT5032A_TB -DUSE_LFXO",
"f_cpu": "64000000L",
"mcu": "nrf52832_xxaa",
"variant": "BT5032A_TB"
Expand Down
2 changes: 1 addition & 1 deletion boards/BT5040.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_BT5040 -DUSE_NORDIC_BL",
"extra_flags": "-DARDUINO_BT5040 -DUSE_NORDIC_BL -DUSE_LFXO",
"f_cpu": "64000000L",
"mcu": "nrf52840_xxaa",
"variant": "nRF52840_Dongle",
Expand Down
2 changes: 1 addition & 1 deletion boards/Sinobit.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m0",
"extra_flags": "-DARDUINO_SINOBIT -DDEVICE_RAM_SIZE=16",
"extra_flags": "-DARDUINO_SINOBIT -DDEVICE_RAM_SIZE=16 -DUSE_LFRC",
"f_cpu": "16000000L",
"mcu": "nrf51822",
"variant": "Sinobit"
Expand Down
2 changes: 1 addition & 1 deletion boards/adafruit_clue_nrf52840.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_CLUE",
"extra_flags": "-DARDUINO_NRF52840_CLUE -DUSE_LFRC",
"f_cpu": "64000000L",
"hwids": [
[
Expand Down
2 changes: 1 addition & 1 deletion boards/adafruit_cplaynrf52840.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_CIRCUITPLAY",
"extra_flags": "-DARDUINO_NRF52840_CIRCUITPLAY -DUSE_LFRC",
"f_cpu": "64000000L",
"hwids": [
[
Expand Down
2 changes: 1 addition & 1 deletion boards/adafruit_feather_nrf52832.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52832_FEATHER",
"extra_flags": "-DARDUINO_NRF52832_FEATHER -DUSE_LFXO",
"f_cpu": "64000000L",
"mcu": "nrf52832_xxaa",
"variant": "feather_nrf52832"
Expand Down
2 changes: 1 addition & 1 deletion boards/adafruit_feather_nrf52840.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_FEATHER",
"extra_flags": "-DARDUINO_NRF52840_FEATHER -DUSE_LFXO",
"f_cpu": "64000000L",
"hwids": [
[
Expand Down
2 changes: 1 addition & 1 deletion boards/adafruit_feather_nrf52840_sense.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_FEATHER_SENSE",
"extra_flags": "-DARDUINO_NRF52840_FEATHER_SENSE -DUSE_LFRC",
"f_cpu": "64000000L",
"hwids": [
[
Expand Down
2 changes: 1 addition & 1 deletion boards/adafruit_itsybitsy_nrf52840.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_ITSYBITSY",
"extra_flags": "-DARDUINO_NRF52840_ITSYBITSY -DUSE_LFXO",
"f_cpu": "64000000L",
"hwids": [
[
Expand Down
2 changes: 1 addition & 1 deletion boards/bbcmicrobit.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m0",
"extra_flags": "-DARDUINO_BBC_MICROBIT -DDEVICE_RAM_SIZE=16",
"extra_flags": "-DARDUINO_BBC_MICROBIT -DDEVICE_RAM_SIZE=16 -DUSE_LFSYNT",
"f_cpu": "16000000L",
"mcu": "nrf51822",
"variant": "BBCmicrobit"
Expand Down
2 changes: 1 addition & 1 deletion boards/bbcmicrobitv2.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_BBC_MICROBIT_V2",
"extra_flags": "-DARDUINO_BBC_MICROBIT_V2 -DUSE_LFSYNT",
"f_cpu": "64000000L",
"mcu": "nrf52833_xxaa",
"variant": "BBCmicrobitV2"
Expand Down
2 changes: 1 addition & 1 deletion boards/bluz_dk.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m0",
"extra_flags": "-DARDUINO_BLUZ_DK -DDEVICE_RAM_SIZE=32",
"extra_flags": "-DARDUINO_BLUZ_DK -DDEVICE_RAM_SIZE=32 -DUSE_LFXO",
"f_cpu": "16000000L",
"mcu": "nrf51822",
"variant": "BluzDK"
Expand Down
2 changes: 1 addition & 1 deletion boards/calliope_mini.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m0",
"extra_flags": "-DARDUINO_CALLIOPE_MINI -DDEVICE_RAM_SIZE=16",
"extra_flags": "-DARDUINO_CALLIOPE_MINI -DDEVICE_RAM_SIZE=16 -DUSE_LFRC",
"f_cpu": "16000000L",
"mcu": "nrf51822",
"variant": "CalliopeMini"
Expand Down
2 changes: 1 addition & 1 deletion boards/ng_beacon.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m0",
"extra_flags": "-DARDUINO_NG_BEACON -DDEVICE_RAM_SIZE=16",
"extra_flags": "-DARDUINO_NG_BEACON -DDEVICE_RAM_SIZE=16 -DUSE_LFRC",
"f_cpu": "16000000L",
"mcu": "nrf51822",
"variant": "ng-beacon"
Expand Down
2 changes: 1 addition & 1 deletion boards/nrf51_beacon.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m0",
"extra_flags": "-DARDUINO_BEACON_PCA20006 -DDEVICE_RAM_SIZE=16",
"extra_flags": "-DARDUINO_BEACON_PCA20006 -DDEVICE_RAM_SIZE=16 -DUSE_LFXO",
"f_cpu": "16000000L",
"mcu": "nrf51822",
"variant": "PCA20006"
Expand Down
2 changes: 1 addition & 1 deletion boards/nrf51_dk.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m0",
"extra_flags": "-DNRF51_DK -DDEVICE_RAM_SIZE=16",
"extra_flags": "-DNRF51_DK -DDEVICE_RAM_SIZE=16 -DUSE_LFXO",
"f_cpu": "16000000L",
"mcu": "nrf51822",
"variant": "nRF51822_DK"
Expand Down
2 changes: 1 addition & 1 deletion boards/nrf51_dongle.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m0",
"extra_flags": "-DNRF51_DONGLE -DDEVICE_RAM_SIZE=32",
"extra_flags": "-DNRF51_DONGLE -DDEVICE_RAM_SIZE=32 -DUSE_LFXO",
"f_cpu": "16000000L",
"mcu": "nrf51822_xxac",
"variant": "nRF51_Dongle"
Expand Down
2 changes: 1 addition & 1 deletion boards/nrf52832_dk.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52_DK",
"extra_flags": "-DARDUINO_NRF52_DK -DUSE_LFXO",
"f_cpu": "64000000L",
"mcu": "nrf52832_xxaa",
"variant": "nRF52832_DK"
Expand Down
2 changes: 1 addition & 1 deletion boards/nrf52833_dk.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52833_DK",
"extra_flags": "-DARDUINO_NRF52833_DK -DUSE_LFXO",
"f_cpu": "64000000L",
"mcu": "nrf52833_xxaa",
"variant": "nRF52833_DK"
Expand Down
2 changes: 1 addition & 1 deletion boards/nrf52840_dk.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_DK",
"extra_flags": "-DARDUINO_NRF52840_DK -DUSE_LFXO",
"f_cpu": "64000000L",
"mcu": "nrf52840_xxaa",
"variant": "nRF52840_DK"
Expand Down
2 changes: 1 addition & 1 deletion boards/nrf52840_dongle.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_DONGLE -DUSE_NORDIC_BL",
"extra_flags": "-DARDUINO_NRF52840_DONGLE -DUSE_NORDIC_BL -DUSE_LFXO",
"f_cpu": "64000000L",
"mcu": "nrf52840_xxaa",
"variant": "nRF52840_Dongle",
Expand Down
2 changes: 1 addition & 1 deletion boards/oshchip.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m0",
"extra_flags": "-DARDUINO_OSHCHIP -DDEVICE_RAM_SIZE=32",
"extra_flags": "-DARDUINO_OSHCHIP -DDEVICE_RAM_SIZE=32 -DUSE_LFRC",
"f_cpu": "16000000L",
"mcu": "nrf51822",
"variant": "OSHChip"
Expand Down
2 changes: 1 addition & 1 deletion boards/redbear_blenano.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m0",
"extra_flags": "-DARDUINO_BLE_NANO -DDEVICE_RAM_SIZE=32",
"extra_flags": "-DARDUINO_BLE_NANO -DDEVICE_RAM_SIZE=32 -DUSE_LFXO",
"f_cpu": "16000000L",
"mcu": "nrf51822",
"variant": "BLENano"
Expand Down
2 changes: 1 addition & 1 deletion boards/redbear_blenano2.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_RB_BLE_NANO_2",
"extra_flags": "-DARDUINO_RB_BLE_NANO_2 -DUSE_LFXO",
"f_cpu": "64000000L",
"mcu": "nrf52832_xxaa",
"variant": "RedBear_BLENano2"
Expand Down
2 changes: 1 addition & 1 deletion boards/redbear_blend2.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_RB_BLEND_2",
"extra_flags": "-DARDUINO_RB_BLEND_2 -DUSE_LFXO",
"f_cpu": "64000000L",
"mcu": "nrf52832_xxaa",
"variant": "RedBear_Blend2"
Expand Down
2 changes: 1 addition & 1 deletion boards/redbear_nRF51822.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m0",
"extra_flags": "-DARDUINO_REDBEARLAB_NRF51822 -DDEVICE_RAM_SIZE=16",
"extra_flags": "-DARDUINO_REDBEARLAB_NRF51822 -DDEVICE_RAM_SIZE=16 -DUSE_LFXO",
"f_cpu": "16000000L",
"mcu": "nrf51822",
"variant": "RedBearLab_nRF51822"
Expand Down
2 changes: 1 addition & 1 deletion boards/seeedTinyBLE.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m0",
"extra_flags": "-DARDUINO_TINYBLE -DDEVICE_RAM_SIZE=16",
"extra_flags": "-DARDUINO_TINYBLE -DDEVICE_RAM_SIZE=16 -DUSE_LFXO",
"f_cpu": "16000000L",
"mcu": "nrf51822",
"variant": "TinyBLE"
Expand Down
2 changes: 1 addition & 1 deletion boards/waveshare_ble400.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"core": "nRF5",
"cpu": "cortex-m0",
"extra_flags": "-DARDUINO_WAVESHARE_BLE400 -DDEVICE_RAM_SIZE=16",
"extra_flags": "-DARDUINO_WAVESHARE_BLE400 -DDEVICE_RAM_SIZE=16 -DUSE_LFXO",
"f_cpu": "16000000L",
"mcu": "nrf51822",
"variant": "Waveshare_BLE400"
Expand Down
12 changes: 11 additions & 1 deletion builder/frameworks/arduino/nrf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@
if bootloader_sel == "adafruit":
# Create a modified bootloader hex file to set the first byte of the bootloader
# settings to 0x01 in order to disable CRC checking.
from intelhex import IntelHex
try:
from intelhex import IntelHex
except ImportError:
env.Execute('$PYTHONEXE -m pip install -U --force-reinstall intelhex')
from intelhex import IntelHex

no_crc_bl = join(env.subst("$BUILD_DIR"),"adabl_crc_disabled.hex")
settings_addr = int(board.get("build.bootloaders.adafruit", "0x7F000"),16)
original_bl = IntelHex(
Expand All @@ -202,6 +207,11 @@

cpp_defines = env.Flatten(env.get("CPPDEFINES", []))

# Select RC oscillator as the low frequency source by default
clock_options = ("USE_LFXO", "USE_LFRC", "USE_LFSYNT")
if not any(d in clock_options for d in cpp_defines):
env.Append(CPPDEFINES=["USE_LFRC"])

#
# Target: Build Core Library
#
Expand Down
2 changes: 1 addition & 1 deletion builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def AfterUpload(target, source, env): # pylint: disable=W0613,W0621
try:
import nordicsemi
except ImportError:
env.Execute('$PYTHONEXE -m pip install nrfutil==6.1.4')
env.Execute('$PYTHONEXE -m pip install -U --force-reinstall nrfutil==6.1.4')

env.Replace(
UPLOADER="nrfutil",
Expand Down

0 comments on commit 3f348a4

Please sign in to comment.