MBED Ble Nano 2 blink test dont work


#1

Hi Dears

I buy a BLE Nano 2 for test it, First steps I follow your guide here
https://github.com/redbear/nRF5x/blob/master/docs/Mbed_IDE_User_Guide.md

Upload mbed-os-example-blinkyNRF52_DK.hex copiled file on DAPLINK drive
but the led dosen’t blink…

If I download the blink example here


it work, it’s 6kbytes, the one compiled in mbed is 350kbytes

So is there a way can I understand why it don’t work?
I there a way to debug the code?

thanks a lot
Fabio


#2

I don’t see how the mbed blinky example can work without modifying the PinNames.h file, as the LED and other pins are not matching the BLE Nano pins. This one works for me for everything but Serial transfer. I’m not sure if that’s an issue with my pin definitions or with mbed os code itself. But here’s the patch. You’ll see that the LED Pin number is definitely not matching the pin definitions for the NRF52DK

diff --git a/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52832/TARGET_NRF52_DK/PinNames.h b/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52832/TARGET_NRF52_DK/PinNames.h
index 2b86eca48..098ed026e 100644
--- a/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52832/TARGET_NRF52_DK/PinNames.h
+++ b/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52832/TARGET_NRF52_DK/PinNames.h
@@ -122,68 +122,57 @@ typedef enum {
     P0_30 = p30,
     P0_31 = p31,
 
-    LED1    = p17,
+    LED1    = p11,
+    // not in ble nano 2, but required by mbed-os
     LED2    = p18,
     LED3    = p19,
     LED4    = p20,
 
-    BUTTON1 = p13,
-    BUTTON2 = p14,
-    BUTTON3 = p15,
-    BUTTON4 = p16,
-
-    RX_PIN_NUMBER  = p8,
-    TX_PIN_NUMBER  = p6,
-    CTS_PIN_NUMBER = p7,
-    RTS_PIN_NUMBER = p5,
+    RX_PIN_NUMBER  = p30,
+    TX_PIN_NUMBER  = p29,
+    CTS_PIN_NUMBER = p28,
+    RTS_PIN_NUMBER = p2,
 
     // mBed interface Pins
     USBTX = TX_PIN_NUMBER,
     USBRX = RX_PIN_NUMBER,
 
-    SPI_PSELMOSI0 = p23,
-    SPI_PSELMISO0 = p24,
-    SPI_PSELSS0   = p22,
-    SPI_PSELSCK0  = p25,
-
-    SPI_PSELMOSI1 = p12,
-    SPI_PSELMISO1 = p13,
-    SPI_PSELSS1   = p11,
-    SPI_PSELSCK1  = p14,
-
-    SPIS_PSELMOSI = p12,
-    SPIS_PSELMISO = p13,
-    SPIS_PSELSS   = p11,
-    SPIS_PSELSCK  = p14,
-
-    I2C_SDA0 = p26,
-    I2C_SCL0 = p27,
-
-    D0 = p11,
-    D1 = p12,
-    D2 = p13,
-    D3 = p14,
-    D4 = p15,
-    D5 = p16,
-    D6 = p17,
-    D7 = p18,
-
-    D8 = p19,
-    D9 = p20,
-    D10 = p22,
-    D11 = p23,
-    D12 = p24,
-    D13 = p25,
-
-    D14 = p26,
-    D15 = p27,
-
-    A0 = p3,
-    A1 = p4,
+    SPI_PSELMOSI0 = p6,
+    SPI_PSELMISO0 = p7,
+    SPI_PSELSS0   = p3,
+    SPI_PSELSCK0  = p8,
+
+    SPI_PSELMOSI1 = p29,
+    SPI_PSELMISO1 = p30,
+    SPI_PSELSS1   = p28,
+    SPI_PSELSCK1  = p2,
+
+    SPIS_PSELMOSI = p29,
+    SPIS_PSELMISO = p30,
+    SPIS_PSELSS   = p28,
+    SPIS_PSELSCK  = p2,
+
+    I2C_SDA0 = p28,
+    I2C_SCL0 = p2,
+
+    D0 = p30,
+    D1 = p29,
+    D2 = p28,
+    D3 = p2,
+    D4 = p5,
+    D5 = p4,
+    D6 = p3,
+    D7 = p6,
+    D8 = p7,
+    D9 = p8,
+    D13 = p11,
+
+    A0 = p30,
+    A1 = p29,
     A2 = p28,
-    A3 = p29,
-    A4 = p30,
-    A5 = p31,
+    A3 = p2,
+    A4 = p5,
+    A5 = p4,
 
     // Not connected
     NC = (int)0xFFFFFFFF

#3

hi @jrobeson
I’m beginner in mbed , and my problem same with this discussion…
how to modify PinNames.h and where is the location of PinNames.h?

this is my workspace
image