modify system_nrf51822.c for fix HRM1017 and mbed_overrides.c for 32MHz setting

pull/887/head
Marcomissyou 2015-02-06 10:42:28 +08:00
parent 9f80c90477
commit 2ffec3246f
2 changed files with 10 additions and 7 deletions

View File

@ -21,12 +21,7 @@
#include "nrf51822.h" #include "nrf51822.h"
#include "system_nrf51822.h" #include "system_nrf51822.h"
#ifdef TARGET_DELTA_DFCM_NNN40 #define __SYSTEM_CLOCK (16000000UL) /*!< nRF51 devices use a fixed System Clock Frequency of 16MHz */
#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
static bool is_manual_peripheral_setup_needed(void); static bool is_manual_peripheral_setup_needed(void);
static bool is_disabled_in_debug_needed(void); static bool is_disabled_in_debug_needed(void);
@ -71,7 +66,7 @@ void SystemInit(void)
// Start the external 32khz crystal oscillator. // Start the external 32khz crystal oscillator.
#ifdef TARGET_DELTA_DFCM_NNN40 || TARGET_HRM1017 #if defined(TARGET_HRM1017) | defined(TARGET_DELTA_DFCM_NNN40)
NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_RC << CLOCK_LFCLKSRC_SRC_Pos); NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_RC << CLOCK_LFCLKSRC_SRC_Pos);
#else #else
NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos); NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);

View File

@ -15,6 +15,14 @@ void mbed_sdk_init()
| (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
NRF_GPIO->OUTCLR = (GPIO_OUTCLR_PIN19_Clear << GPIO_OUTCLR_PIN19_Pos); NRF_GPIO->OUTCLR = (GPIO_OUTCLR_PIN19_Clear << GPIO_OUTCLR_PIN19_Pos);
// 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.
}
#endif #endif
} }