How to use the Pro Mini nRF52 (nRF52832) with PlatformIO

by | Sep 22, 2020 | 0 comments

Adding a New Board Library

Following the steps below will enable the PlatformIO extension in Visual Studio Code to compile and upload code to an nRF52832 chip or Pro Mini nRF52 board.

Note: If you already have the Nordic nRF52 platform installed in PlatformIO, you can skip ahead to step 8

Step 1:  Launch Visual Studio Code.

I’m using version 1.49 in the screenshots that follow.

Visual Studio Code with PlatformIO Extension Installed

Step 2:  Click on the PlatformIO extension button.

Note:  If you don’t see the button highlighted below, the PlatformIO extension may not have been installed correctly.  See this link for help.

Visual Studio Code: PlatformIO Extension Button

The follow quick access menu should appear…

PlatformIO Quick Access Menu

Step 3:  Select the Platforms option from the PlatformIO Quick Access menu.

PlatformIO Quick Access Menu: Platforms Option

The following new window should appear next to the quick access menu…

PlatformIO Platforms Window

Note:  Any existing platforms you have already installed will be listed here.

Step 4:  Click on the blue Install Embedded Platform button.

PlatformIO: Install Embedded Platform

The Embedded tab should now be displayed in the existing window.

PlatformIO Embedded Platforms Window

Step 6:  Type the following in the “Filter platforms by name…” dialog box:


And select the Nordic nRF52 platform when it is displayed.

Filtering for the Nordic nRF52 Platform

Information about the Nordic nRF52 platform should now be displayed in the existing Embedded tab.

Note: Nordic nRF52 platform version 4.4.1 is being shown in the screenshot below.

Nordic nRF52 Platform Information

Step 7:  Click the blue Install button to download and install the Nordic nRF52 platform.

Installing the Nordic nRF52 Platform

The Nordic nRF52 platform will now be installed and the following message will be displayed if the installation completes successfully:

Note: Click the blue OK button to close the message window.

Nordic nRF52 Platform Successfully Installed

Step 8:  Click on the Installed tab to display information about the newly installed Nordic nRF52 platform.

Note: If you have more than one platform installed, you need to specifically select the Nordic nRF52 platform by clicking on it in the listing after the tab is clicked.

Nordic nRF52 Platform: Select Installed Platforms

You should see something like the following displayed about the Nordic nRF52 platform under the Installed tab:

Nordic nRF52 Platform: Installed Information

Step 9:  Click on the blue Reveal button to open the directory where the Nordic nRF52 platform has been installed.

Nordic nRF52 Platform: Reveal Button

Your operating system should now open a directory listing that looks something like the following:

Note:  If you have any additional platforms already installed, they will be listed here.

Nordic nRF52 Platform: platforms Directory Listing

Step 10:  Navigate up one level to the .platformio directory – it should look something like the following:

Nordic nRF52 Platform: platformio Directory Listing

Step 11:  Download and extract the ZIP archive from this Github repository into the above directory.

The ZIP archive contains the following files and internal structure:

Nordic nRF52 Platform: ZIP Archive Listing

Step 12:  Select the Open option from the PlatformIO Quick Access menu.

PlatformIO Quick Access Menu: Open Option

The PlatformIO home page should now be displayed:

PlatformIO Home

Step 13:  Click the New Project button under the Quick Access options.

PlatformIO Home: New Project Button

The PlatformIO Project Wizard should now be displayed:

PlatformIO Project Wizard

Step 14:  Select the following options in the Project Wizard window dialog boxes and then click the blue Finish button:

     Name: (Choose Your Own Project Name)
    Board:  Pro Mini nRF52 (Pro Mini Micros)
Framework:  Arduino
 Location: (Use Your Default Location or Specify a Path)
PlatformIO Project Wizard: Example Project

PlatformIO will now create a new project using the Nordic nRF52 platform default templates for the selected board (Pro Mini nRF52) and framework (Arduino).

PlatformIO Project Wizard: Creating A New Project

After PlatformIO has finished, the Explorer window will show the project structure and the right hand window will return to the PlatformIO home page.

PlatformIO Project Wizard: New Project Created

Step 15:  Click on the platformio.ini file in the Explorer window to open the file for editing.

Explorer: Select platform.ini File

The platformio.ini file should be opened and shown in a new tab in the right hand window.

Project platform.ini File

Step 16:  [Optional] Update the platformio.ini file with the COM port configuration of your FTDI programmer and UART (Serial Monitor) port, if necessary:

; Upload serial port is automatically detected by default, but you may need to update it manually.
upload_port = COM5
upload_speed = 115200
monitor_port = COM5
monitor_speed = 115200
Project platformio.ini File After Editing

Step 17:  Open the project “src” (Source) listing in the Explorer window.

Select Project src Listing

You should see the listing expand with a main.cpp file in the Explorer window.

Project src Listing

Step 18:  Select the main.cpp file from the “src” listing in the Explorer window to view the source code.

Select main.cpp File

You should see the main.cpp source code displayed in a tab on the right hand window.

Blank main.cpp Code

Step 19:  Copy-and-paste the contents of this example main.cpp file into the main.cpp source code of the new project:

Note: The example main.cpp file simply blinks the Pro Mini nRF52’s LEDs and displays UART messages whilst doing so.  Using this example code will test whether the platform has been configured correctly.

Example main.cpp Code

Step 20:  Click on the PlatformIO extension button.

Select PlatformIO Extension Button

You should now see a list of PlatformIO Project Tasks together with the previous list of Quick Access options:

PlatformIO Project Tasks

Click on the Upload and Monitor option in the Project Tasks list:

PlatformIO Project Tasks: Upload and Monitor

PlatformIO should now compile the project source code and attempt to upload it to the Pro Mini nRF52 via the configured FTDI programmer:

Upload In Progress

Assuming the upload was successful, PlatformIO will then start the monitor to display the UART messages:

Upload and Monitor Successful

You should now be able to use your Pro Mini nRF52 with PlatformIO.


Any feedback on the above instructions would be much appreciated!


Submit a Comment

Your email address will not be published. Required fields are marked *