mbed library sources

Dependents:   Nucleo_blink_led

Fork of mbed-src by mbed official

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Thu Feb 12 13:00:07 2015 +0000
Parent:
471:36e91e24cc94
Child:
473:44b5a0bc6da6
Commit message:
Synchronized with git revision 4a7b7d067deeff485150756fa782d3952e160017

Full URL: https://github.com/mbedmicro/mbed/commit/4a7b7d067deeff485150756fa782d3952e160017/

Modify 32MHz crystal setting for NRF51822, overrides file for DFCM-NNN40 target

Changed in this revision

targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/system_nrf51822.c Show annotated file Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC82X/TARGET_SSCI824/system_LPC8xx.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/TARGET_DELTA_DFCM_NNN40/mbed_overrides.c Show annotated file Show diff for this revision Revisions of this file
--- a/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/system_nrf51822.c	Wed Feb 11 15:45:07 2015 +0000
+++ b/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/system_nrf51822.c	Thu Feb 12 13:00:07 2015 +0000
@@ -21,12 +21,7 @@
 #include "nrf51822.h"
 #include "system_nrf51822.h"
 
-#ifdef TARGET_DELTA_DFCM_NNN40
-
-	#define __SYSTEM_CLOCK      (32000000UL)     /*!< nRF51 devices use a fixed System Clock Frequency of 32MHz */
-#else
-	#define __SYSTEM_CLOCK      (16000000UL)     /*!< nRF51 devices use a fixed System Clock Frequency of 16MHz */
-#endif
+#define __SYSTEM_CLOCK      (16000000UL)     /*!< nRF51 devices use a fixed System Clock Frequency of 16MHz */
 
 static bool is_manual_peripheral_setup_needed(void);
 static bool is_disabled_in_debug_needed(void);
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC82X/TARGET_SSCI824/system_LPC8xx.c	Wed Feb 11 15:45:07 2015 +0000
+++ b/targets/cmsis/TARGET_NXP/TARGET_LPC82X/TARGET_SSCI824/system_LPC8xx.c	Thu Feb 12 13:00:07 2015 +0000
@@ -86,7 +86,7 @@
 //                   <2=> Reserved
 //                   <3=> CLKIN. External clock input.
 //   </h>
-#define SYSPLLCLKSEL_Val      0x00000000              // Reset: 0x000
+#define SYSPLLCLKSEL_Val      0x00000001              // Reset: 0x000
 //
 //   <h> Main Clock Source Select Register (MAINCLKSEL)
 //     <o.0..1>   SEL: Clock Source for Main Clock
--- a/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/TARGET_DELTA_DFCM_NNN40/mbed_overrides.c	Wed Feb 11 15:45:07 2015 +0000
+++ b/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/TARGET_DELTA_DFCM_NNN40/mbed_overrides.c	Thu Feb 12 13:00:07 2015 +0000
@@ -1,13 +1,24 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2015, Cyntec
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
+ 
 #include "cmsis.h"
 
-// This function is called after RAM initialization and before main.
 void mbed_sdk_init()
 {
-	// Default SWIO setting, pull SWIO(p19) to low for turning antenna switch to BLE radiated path.
-#ifdef TARGET_DELTA_DFCM_NNN40
+	// Default SWIO setting, pull SWIO(p19) to low for turning antenna switch to BLE radiated path
 	NRF_GPIO->PIN_CNF[19] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos)
                                         | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos)
                                         | (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos)
@@ -15,6 +26,12 @@
                                         | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
 
 	NRF_GPIO->OUTCLR 		= 	(GPIO_OUTCLR_PIN19_Clear << GPIO_OUTCLR_PIN19_Pos);
-
-#endif
+	
+	// Config External Crystal to 32MHz
+	NRF_CLOCK->XTALFREQ = 0x00;
+	NRF_CLOCK->EVENTS_HFCLKSTARTED  = 0;
+    NRF_CLOCK->TASKS_HFCLKSTART     = 1;
+    while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0) 
+    {// Do nothing.
+    }
 }