How get nrf52840_dk active in code

Hi,

I know it is a stupid question, but here I go.
I have VScode with platformio installed on current OpenSuse Linux.

I want to test blinky with mbed on my nRF-52840-DK board.

When I go to Platforms → Embedded → Install
I don’t know where to click to get nrf52840_dk installed.
I click on “mbed”:

grafik

and always end up installing nrf52_dk 3.8.0, which seems to be an older board (other LED pin numbers).

Another strange thing is that I can’t enter any text into the search fields, it gets a blue focus border, but no typing appears.

thanks
Marcel

Ok, I think the problem was that the blink example is based on an older board.

Here I can choose the correct board, but I can’t enter any text into the “Project name” field:

grafik

strange
Marcel

After rebooting the laptop I can enter text and the first blinky runs fine.

No stupid questions… except for the ones you don’t ask :wink:

For your “can’t enter text into the project name field issue”:

Re: installing your board - you don’t need to install the board, just the platform. Installing the platform (Nordic nRF52 v3.8.0) installs support for all the boards listed. You can then pick Nordic nRF52-DK from the new projects wizard as you’ve found, or use board = nrf52_dk in the platformio.ini as shown in the PIO documentation for that board.

As I think platformio is for guys like me wanting to get a quick entry into embedded programming, this hint:

It would have been nice to install one of the examples and it runs out of the box.

But, as with installing it “raw” without platformio, I ended up Googling.

The examples provided seems to be for an older board which I didn’t recognize easily so I had to

  1. Extend platformio.ini (after wondering why the examples do not compile)

  2. Exchange LED1 to BUTTON1 (after wondering why the LED did not blink)

I was always thinking it is my fault (my Linux, wrong installation, wrong setup of VCode, mbed, wrong bootloader on Dev kit, broken cable, wrong switch position of Dev Board, or what ever)
as I trusted the examples (thats what they are for) …

So it would probably be nice to have running examples provided, or to have a comment in main.cpp to not trust it (only tested for chip xxxx on dev board xyz on os yyyy with mbed version zzzz),

thank you for all
Marcel

2 Likes

Regarding exchanging LED1 to BUTTON1 to make LED1 blink: thank you
so much for the hint! This did the trick!
Is this a bug of the nRF52840 devkit description or is it a platformio related bug in the Arduino Framework?
Did you already report the bug?

This is very bad for anyone just starting out. Choosing nrf52840-DK results in the NRF52-DK pin layout.

I see the definitions in C:\Users\Jason.platformio\packages\framework-arduinonordicnrf5\variants\nRF52DK\variant.h

I think there needs to be a \variants\nRF52840-DK folder with the correct pin mappings.

I don’t have time to do this right now but the connector interfaces are listed here

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nrf52832_dk%2FUG%2Fnrf52_DK%2Fhw_conn_interf.html&cp=4_2_4_5_3

and here
https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nrf52840_dk%2FUG%2Fnrf52840_DK%2Fhw_buttons_leds.html

FYI, that would be an issue for the source of the framework-arduinonordicnrf5 package - GitHub - sandeepmistry/arduino-nRF5: Arduino Core for Nordic Semiconductor nRF5 based boards. :wink:

It’s not in the list of variants

Exactly. And if it’s not there, it won’t be in PlatformIO’s package for that framework. And when you look at that repo, there are 7 open issues issues going back as far as 2016 over adding support for the nrf52840, with the most recent commened on in December 2019, so I don’t know if it will actually happen. There was some mention of cobbled together works though.

There is also the Adafruit BSP, which appears to actually have support specifically… is that any better?

Nice find! I’m considering another chip instead of the NRF52 (because they’re expensive) but I notice that the adafruit page says

Following boards are also included but are not officially supported:

I notice that the adafruit 10056 variant only lists and initialises 2 LEDs but the pca10056 has 4 leds

1 Like

I solved it by patching the wrong definitions for the 4 LEDs and the 4 Buttons:

// patch for missing nRF52840DK pinmap
// LEDs
#undef PIN_LED1
#undef PIN_LED2
#undef PIN_LED3
#undef PIN_LED4
#undef LED_BUILTIN
#define PIN_LED1             (2) 
#define PIN_LED2             (3) 
#define PIN_LED3             (4) 
#define PIN_LED4             (5) 
#define LED_BUILTIN          PIN_LED1
// BUTTONs
#undef PIN_BUTTON1
#undef PIN_BUTTON2
#undef PIN_BUTTON3
#undef PIN_BUTTON4
#define PIN_BUTTON1          (0)  
#define PIN_BUTTON2          (1)  
#define PIN_BUTTON3          (12) 
#define PIN_BUTTON4          (13)