aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/NRF5
diff options
context:
space:
mode:
authorStephane D'Alu <sdalu@sdalu.com>2016-07-10 10:47:45 +0200
committerStephane D'Alu <sdalu@sdalu.com>2016-07-10 10:47:45 +0200
commitba393d3ae1c78c881ff3bf67c68c1f7c7642bcb0 (patch)
treede345a5f419422e5337c747ae764531eda0d7095 /os/hal/ports/NRF5
parent1908537785516004f2014ccb2d6db31a2fe56173 (diff)
downloadChibiOS-Contrib-ba393d3ae1c78c881ff3bf67c68c1f7c7642bcb0.tar.gz
ChibiOS-Contrib-ba393d3ae1c78c881ff3bf67c68c1f7c7642bcb0.tar.bz2
ChibiOS-Contrib-ba393d3ae1c78c881ff3bf67c68c1f7c7642bcb0.zip
correct clock speed
Diffstat (limited to 'os/hal/ports/NRF5')
-rw-r--r--os/hal/ports/NRF5/NRF52832/hal_lld.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/os/hal/ports/NRF5/NRF52832/hal_lld.c b/os/hal/ports/NRF5/NRF52832/hal_lld.c
index 0fc8c27..500de13 100644
--- a/os/hal/ports/NRF5/NRF52832/hal_lld.c
+++ b/os/hal/ports/NRF5/NRF52832/hal_lld.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2015 Fabio Utzig
+ Copyright (C) 2016 Stephane D'Alu
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -56,15 +56,10 @@
void hal_lld_init(void)
{
/* High frequency clock initialisation
- * (If NRF51_XTAL_VALUE is not defined assume its an RC oscillator)
*/
NRF_CLOCK->TASKS_HFCLKSTOP = 1;
-#if defined(NRF51_XTAL_VALUE)
-#if NRF51_XTAL_VALUE == 16000000
- NRF_CLOCK->XTALFREQ = 0xFF;
-#elif NRF51_XTAL_VALUE == 32000000
- NRF_CLOCK->XTALFREQ = 0x00;
-#endif
+#if !defined(NRF5_XTAL_VALUE) && (NRF5_XTAL_VALUE != 32000000)
+#error "A 32Mhz crystal is mandatory on nRF52 boards."
#endif
@@ -72,10 +67,10 @@ void hal_lld_init(void)
* Clock is only started if st driver requires it
*/
NRF_CLOCK->TASKS_LFCLKSTOP = 1;
- NRF_CLOCK->LFCLKSRC = NRF51_LFCLK_SOURCE;
+ NRF_CLOCK->LFCLKSRC = NRF5_LFCLK_SOURCE;
#if (OSAL_ST_MODE != OSAL_ST_MODE_NONE) && \
- (NRF51_SYSTEM_TICKS == NRF51_SYSTEM_TICKS_AS_RTC)
+ (NRF5_SYSTEM_TICKS == NRF5_SYSTEM_TICKS_AS_RTC)
NRF_CLOCK->TASKS_LFCLKSTART = 1;
#endif
}