This is a modified "BLE_Default_App". It doesn't use retargetStdout() which allows it to work with online Libs available on 20150123 (nRF51822, BLE_API)
Dependencies: BLE_API mbed nRF51822
App for FOTA testing:
- IO:
- Blinks a LED on platform to show App alive
- LEDs also follow buttons to show immediate response.
- BLE UART has ping message, and also echos back any received bytes (Use with Android App: nRF UART 2.0).
- It compiles and runs as FOTA and non-FOTA platform which may assist debugging
- platform "Nordic nRF51822 FOTA" for FOTA Loading
- platform "Nordic nRF51822" for mbed drive loading
- Supports mbed and non-mbed PCBs (all compiled using platform "Nordic nRF51822 FOTA")
- Compile options available for:
- nRF51822-mkit (Includes USB Serial Debug)
- nRF51822-EK
- nRF51822-Beacon (nRFBeacon)
- Atomwear (Button and LED on main PCB only)
- *If anyone gets this working with other publicly available PCBs let me know and we can add it in
Revision 6:85f68f27170c, committed 2015-02-20
- Comitter:
- prussell
- Date:
- Fri Feb 20 00:41:18 2015 +0000
- Parent:
- 5:ac98ff227ad7
- Commit message:
- Added option to generate up to 3 PWM signals at a time on Atomwear debug header to confirm pinout (Schematic vs user guide)
; Atomwear Debug Header has: p13,p14,p15 p0,p2,p3, p12,p11,Batt, SWIO,SWCK,Gnd.
; All pX work with PwmOut (Max 3 at a time)
Changed in this revision
diff -r ac98ff227ad7 -r 85f68f27170c BLE_API.lib --- a/BLE_API.lib Fri Jan 30 10:45:47 2015 +0000 +++ b/BLE_API.lib Fri Feb 20 00:41:18 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#1407d2f1ce3c +http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#1956023d42fb
diff -r ac98ff227ad7 -r 85f68f27170c main.cpp --- a/main.cpp Fri Jan 30 10:45:47 2015 +0000 +++ b/main.cpp Fri Feb 20 00:41:18 2015 +0000 @@ -23,15 +23,18 @@ #define D_EK 2 // nRF51822-EK #define D_BEACON 3 // nRF51822-Beacon #define D_ATOMWEAR 4 // Atomwear + //============================== // Compile Options: -#define D_BLE_UART 1 // Include BLE UART functionality? -#define D_PING_SEC 1 // Ping Rate in Seconds +#define D_BLE_UART 1 // Include BLE UART functionality? +#define D_PING_SEC 1 // Ping Rate in Seconds #define D_PCB D_MKIT // Select target PCB +//#define D_MkitPROBING 1 // Option: Drive pwm on select header signals to aid probing with scope, comment out this line to disable //#define D_PCB D_EK // Select target PCB //#define D_PCB D_BEACON // Select target PCB //#define D_PCB D_ATOMWEAR // Select target PCB +//#define D_AtomPROBING 1 // Option: Drive pwm on select Debug Header signals to support probing with scope (PWM 10%~80%), comment out this line to disable **Disconnect all modules except Main/Debug/Battery** //============================== #include "mbed.h" @@ -39,9 +42,9 @@ //============================== Process PCB Options: #if D_PCB==D_MKIT - const char *pcDeviceName = "FOTA4r5m"; - const char *pcPingBLE = "m4\n"; // May need "\n" to push BLE Tx - const char *pcPingUART = "u4\n"; + const char *pcDeviceName = "FOTA4r6m"; + const char *pcPingBLE = "m4\n"; // May need "\n" to push BLE Tx + const char *pcPingUART = "u4\n"; #define DEBUG(...) { printf(__VA_ARGS__); } //UART: p0.08~p0.11, Debug OK over USB Serial DigitalIn bB1in(BUTTON1); //p0.16 =Button1 @@ -61,7 +64,7 @@ #define D_OPERATION_LED "mkit: LED1=Ticker+Button1, LED2=Button2" #elif D_PCB==D_EK - const char *pcDeviceName = "FOTA4r5e"; + const char *pcDeviceName = "FOTA4r6e"; const char *pcPingBLE = "e4\n"; // May need "\n" to push BLE Tx #define DEBUG(...) {} //Serial Debug not connected @@ -82,7 +85,7 @@ #define D_OPERATION_LED "EK: LED0=Ticker+Button0, LED1=Button1" #elif D_PCB==D_BEACON - const char *pcDeviceName = "FOTA4r5b"; + const char *pcDeviceName = "FOTA4r6b"; const char *pcPingBLE = "b4\n"; // May need "\n" to push BLE Tx #define DEBUG(...) {} //Serial Debug not connected @@ -105,7 +108,7 @@ #define D_OPERATION_LED "Beacon: Red=Ticker, Green=SW1, Blue=SW2" #elif D_PCB==D_ATOMWEAR // USBSerial=None, ButtonLED=atomwear, LEDx=Buttonx, LEDw=Buttony|Ticker - const char *pcDeviceName = "FOTA4r5a"; + const char *pcDeviceName = "FOTA4r6a"; const char *pcPingBLE = "a\n"; // May need "\n" to push BLE Tx #define DEBUG(...) {} //Serial Debug not connected @@ -117,7 +120,7 @@ //PwmOut fLWpwm(p18); float fLWlevel = 0.1; //p0.18 =LEDW, BrightnessFloat(0.0~1.0) //AnalogIn adcA(p1); //p0.01 =AIN2 //AnalogIn adcB(p2); //p0.02 =AIN3 - + #define D_0_LED_TICKER { bLBout=((uTicker1++)&0x01);} // LED Follows Ticker (May also follow a button) #define D_1_LED_BUTTON { bLWout = bB1in;} // LED Follows Button #define D_OPERATION_LED "Atomwear: Blue=Ticker, White=S1" @@ -230,7 +233,47 @@ #ifdef D_2_LED_BUTTON B2int.fall(&onButton); B2int.rise(&onButton); // Button2 #endif - for (;;) { + +#if D_PCB==D_MKIT + #ifdef D_MkitPROBING + //**Warning:As of 20150219 nRF appears to have max 3 PwmOut channels, others don't output but compile OK. (Maybe see SoftPWM or FastPWM for more channels) + + //For IO Pinout check: PWM 10%~80% on Debug Header pins to allow probing verification: + // Signals by schematic (User guide has typos), arranged by header rows from PCB edge + // nRF51 PWM //mkit + PwmOut pwm_p30(p30); pwm_p30=0.1; //P6.7 + #endif +#endif + +#if D_PCB==D_ATOMWEAR + #ifdef D_AtomPROBING + //**Disconnect all modules except Main/Debug/Battery** + + //**Warning:As of 20150219 nRF appears to have max 3 PwmOut channels, others don't output but compile OK. (Maybe see SoftPWM or FastPWM for more channels) + + //For IO Pinout check: PWM 10%~80% on Debug Header pins to allow probing verification: + // Signals by schematic (User guide has typos), arranged by header rows from PCB edge + // nRF51 PWM // Schematic //Header Bus //Silkscreen + PwmOut pwm_p13(p13); pwm_p13=0.1;// SPI_SCK1 //P17.2 22 //8 + PwmOut pwm_p14(p14); pwm_p14=0.2;// SPI_MOSI1 //P17.4 23 //10 + PwmOut pwm_p15(p15); pwm_p15=0.3;// SPI_MISO1 //P17.6 24 //12 + +// PwmOut pwm_p0(p0); pwm_p0=0.4;// GPIO1 //P17.1 11 //7 +// PwmOut pwm_p2(p2); pwm_p2=0.5;// GPIO2 //P17.3 10 //9 +// PwmOut pwm_p3(p3); pwm_p3=0.6;// GPIO3 //P17.5 9 //11 + +// PwmOut pwm_p12(p12); pwm_p12=0.7;// UART_RX //P15.2 21 //2 +// PwmOut pwm_p11(p11); pwm_p11=0.8;// UART_TX //P15.4 20 //4 + // ---- // VCC Unreg //P15.6 13 //6 ==Unregulated Power from Battery (Regulator on nRF PCB) + + // SWDIO // SWDIO //P15.1 19 //1 + // SWCLK // SWDCLK //P15.3 18 //3 + // GND // GND //P15.5 15 //5 + #endif +#endif + + + for (;;) { ble.waitForEvent(); } }
diff -r ac98ff227ad7 -r 85f68f27170c mbed.bld --- a/mbed.bld Fri Jan 30 10:45:47 2015 +0000 +++ b/mbed.bld Fri Feb 20 00:41:18 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/9ad691361fac \ No newline at end of file