nRF51802 MUST use SDK11 or LATER.
STEP 1. open "pca10028.h"
about line.150 , there are code like this:
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \ .rc_ctiv = 0, \ .rc_temp_ctiv = 0, \ .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
change like this :
/*power by AgathaKuan*/ #ifndef NRF51802 #define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \ .rc_ctiv = 0, \ .rc_temp_ctiv = 0, \ .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM} #else #define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_SYNTH, \ .rc_ctiv = 0, \ .rc_temp_ctiv = 0, \ .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM} #endif
STEP 2. check your UART pins
at about line 65
#define RX_PIN_NUMBER 11 #define TX_PIN_NUMBER 9
but nRF51802 DEFAULT UART pins are P0_1 &P0_4
(as nRF51822 TWI pins)
so, change as
#ifndef NRF51802 #define RX_PIN_NUMBER 11 #define TX_PIN_NUMBER 9 #else #define RX_PIN_NUMBER 1 #define TX_PIN_NUMBER 4 #endif
(The UART pin should be refered to your circuit diagram, please check it or ask your circuit engineer)
STEP 3. add nrf51802 definition
add this at about line 60 in "pca10028"
#define NRF51802
STEP 4. press to "re-built all"
press the button to re-build all , than load it into nRF51802
Addition:
1. if you also need to use TWI pins, open "twi_master_config.h" and change the following definition
as your specified pins.
#ifndef TWI_MASTER_CONFIG #define TWI_MASTER_CONFIG /*agatha: change the following definition to pin numbers you want*/ #define TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER (YOUR_SCL_PIN) #define TWI_MASTER_CONFIG_DATA_PIN_NUMBER (YOUR_SDA_PIN) #endif
沒有留言:
張貼留言