/
11111
1
Fork of nRF51822 by
Revision 402:448a564f5c9e, committed 2015-08-07
- Comitter:
- rgrover1
- Date:
- Fri Aug 07 15:57:07 2015 +0100
- Parent:
- 401:bd0f4eaad9f0
- Child:
- 403:92d6b4c7bf14
- Commit message:
- Synchronized with git rev b22c2e82
Author: Jean-Philippe Brucker
Select the clock source dynamically on SoftDevice initialisation
Instead of relying on build macros to know which oscillator we're
supposedly using, check the value of LFCLKSRC register. This way, we can
trust mbed's init code to fallback on the internal clock if the user
specified a wrong target.
This change, along with the mbed patch that selects clock source
dynamically, will allow lots of application to still run and provide
FOTA, when the wrong Nordic platform is specified.
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Changed in this revision
source/btle/btle.cpp | Show annotated file Show diff for this revision Revisions of this file |
source/nRF5xn.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/source/btle/btle.cpp Fri Aug 07 15:57:07 2015 +0100 +++ b/source/btle/btle.cpp Fri Aug 07 15:57:07 2015 +0100 @@ -52,11 +52,10 @@ error_t btle_init(void) { -#if defined(TARGET_DELTA_DFCM_NNN40) || defined(TARGET_HRM1017) - SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, NULL); -#else - SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL); -#endif + if (NRF_CLOCK->LFCLKSRC & (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos)) + SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL); + else + SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, NULL); // Enable BLE stack /**
--- a/source/nRF5xn.cpp Fri Aug 07 15:57:07 2015 +0100 +++ b/source/nRF5xn.cpp Fri Aug 07 15:57:07 2015 +0100 @@ -56,11 +56,10 @@ if ((sd_ble_version_get(&version) == NRF_SUCCESS) && (version.company_id == 0x0059)) { switch (version.version_number) { case 0x07: - case 0x08: - snprintf(versionString, sizeof(versionString), "Nordic BLE4.1 ver:%u fw:%04x", version.version_number, version.subversion_number); + snprintf(versionString, sizeof(versionString), "Nordic BLE4.1 fw:%04x", version.subversion_number); break; default: - snprintf(versionString, sizeof(versionString), "Nordic (spec unknown) ver:%u fw:%04x", version.version_number, version.subversion_number); + snprintf(versionString, sizeof(versionString), "Nordic (spec unknown) fw:%04x", version.subversion_number); break; } versionFetched = true;