PlatformIO Community

Can't make Nordic nRF52840-DK (Adafruit BSP) work at all

Ok I’m at my wit’s end with this which means it’s time to ask for help :sweat_smile:

I’m trying to program a Nordic nrf52840 bluetooth MCU which I have on my own custom board. The actual chip is on a Rigado BMD-340 module and my PCB is a custom mechanical keyboard.

I’d like to use the work Adafruit has done on the nRF52840 so I don’t have to re-write a ton of bluetooth BS myself.

It seemsPlatformIO has integrated Adafruit’s board support package (BSP) for this chip and it should work with a standard nRF52840-DK! Great!

Unfortunately, I have completely failed to get ANY code (including a blinking LED) to run properly on my nrf52840 using this configuration. I can’t figure out where the problem is either. Is it platformIO? Is it AdafruitBSP? Is it because I’m using a custom board?

I SUCCESSFULLY have my custom board blinking an LED using nearly the same PlatformIO setup but switching the Adafruit/Arduino stuff for MBED. So the hardware is fine. How is MBED successful with this but the Arduino/AdafruitBSP failing? I don’t want to develop with MBED for this because they only support certain peripherals (no USB support yet) and their Bluetooth API is a nightmare of complexity.

Here’s the NON-WORKING Arduino INI file, Arduino Program, and Arduino Upload Output:


And here’s the WORKING MBED INI file, program, and programming output:


Any help is appreciated! It would be great to be able to use Adafruit’s work on this chip within PlatformIO. If this can’t be fixed, maybe a generic nrf52840 board target could be added for people making their own custom PCB’s?

@jeremypoulter could you help here?

Sorry only just seen this, have you installed the bootloader?

pio run -r bootloader

Hah. Ok. I had no clue this was possible to do with PlatformIO.

Yeah I actually have an update and forgot to post about it here.

Basically, I figured out that I needed the Adafruit boot-loader shortly after I made this original post. I did not however see ANY mention of this being needed anywhere from PlatformIO. I had to dig through Adafruit’s forums and docs to make sense of it.

To make my chip work, I downloaded and installed Adafruit’s board support package for the nrf52840 in the Arduino IDE and used their “Burn Bootloader” feature with J-Link through Arduino IDE. This is what worked for me. Only then was I able to use a J-Link to upload code with platformio.

Not trying to sound too salty - i love this system, but It would be extremely helpful (and save people a lot of time) to add some notes about what must be done to make a board function properly in the paltofrmIO docs at the time the board is added to the system.

On a last note, can you confirm if uploading using the Adafruit boot-loader over it’s native USB is possible? I’ve only used a J-link so far, but it would be nice to use Adafruit boot-loader as it’s intended as well.

Not to sound to pushy, but …

Jokes aside, if you feel there’s a gap (or possibly a gaping black hole in this case) in the documentation for a board, or even the whole board family/platform… please, make an issue on the relevant github (i.e. platformio-docs since this is a documentation issue), or even better, submit a PR with the suggested edits. That is the beauty of this being an open source project… everyone can contribute and make it even better! :slight_smile:

It is possible (technically) to burn the bootloader via USB, however it is not recommended as it can brick the board, so you have to recover using a J-Link. There is an open ticket to add this however.