Firmware for Nordic SDK (NRF52832, NRF52840) - microsoft/ExpressivePixels GitHub Wiki
The Expressive Pixels firmware that will run on a Nordic NRF52 based microprocessor offers a full connectivity and animation experience based on the power and connectivity capabilities of the processor.
The project structure is as follows:
- ExpressivePixelsCore - The main Expressive Pixels application
- Platform_NordicSDK - The hardware abstraction layer for the Nordic SDK (based on version 15.2.0)
- LittleFS - File system for devices with storage capability
- Segger - To leverage advanced firmware tracing abilities
Download latest Segger Embedded Studio for ARM
Download the latest version of Segger Embedded Studio Install using default settings. When you first launch Segger Embedded Studio a ‘No Commercial-use license detected’ message will be displayed. As you will be compiling for a Nordic Semiconductor Device simply click the ‘Activate Your Free License’ link. Enter your details in the License Activation prompt, click the ‘Request License’ button, followed by clicking on the ‘Enter Activation Key’ button. You will receive the key in your email, simply copy paste it into the ‘Activate Key’ field and click ‘Install License’.
Download version 15.2.0 of the Nordic NRF SDK
Download version 15.2.0 of the Nordic SDK. Open the downloaded Zip file (DeviceDownload.Zip) and copy the contained zip file (nRF5SDK15209412b96.Zip) to a local folder. Open that ZIP file and copy its contents of the "nRF5SDK15209412b96" folder into a known location on your drive, such as C:\NordicSDK15.2.0.
Set a Segger Embedded Studio Global Macro to reference your Nordic SDK location.
• Open the Tools..Options dialog window • Under the Build section, double click on Global Macros value field and enter SDK= followed by the full path such as SDK=C:\NordicSDK15.2.0
Clone the ExpressivePixels Repo to a location on your computer
Open the Expressive Pixels Nordic SDK project by going to File..Open Solution, and opening the EMPROJECT under {ExpressivePixels GitHub Clone}\Firmware\Device_Nordic52840DK_SeggerEmbeddedStudio\pca10056\s140\ses
Setting up a Variant configuration for your specific hardware
Your unique configuration of microprocessor board, its features, and display configuration will require a specific Variant configuration. This is set in EPXVariant.cpp and EPXVariant.h located in the project root folder.
EPXVariant.h
Create a new #define for you device type such as MYUNIQUEDEVICE, and set your specific pin assignments and capabilities relevant to your configuration. The device type you created (MYUNIQUEDEVICE) is specified by right clicking your project root in the Project Explorer Window, Options, selecting Preprocessor, and specifying the device type define under 'Preprocessor Definitions'.
EPXVariant.cpp
EPXVariant.cpp defines global variables for your specific variant:
- g_szDEFAULT_BLE_NAME specifies the default bluetooth device name.
- g_displayDesignGUID specifies the unique display ID for your device, so it can be identified by type by the apps that connect to it.
- g_displayArrayPixelTopology specifies the logical pixel to physical LED mapping unique to your hardware design.
Build
Build the project by selecting Build..Build ExpressivePixels_pca10056_s140
Connecting your device for debugging
Segger Embedded Studio supports a rich environment for deployment and debugging. Microprocessor systems typically support SWD connection to the host computer using an intermediate hardware interface such as JLink. The following illustration uses the cheaply available Segger J-Link EDU mini SWD Debugger connected to an AdaFruit Feather nRF52840 Express which conveniently has a 10 pin SWD socket.
Deploy
With the SWD hardware in-place, and device powered on, you can flash and start debugging the compiled firmware by selection Debug..Go in Segged Embedded Studio.
Tips and Tricks
Debugging
When setting breakpoints and stepping through code it is necessary to turn off the Bluetooth advertising and connection logic and connect using USB. The Nordic SoftDevice (firmware for Bluetooth stack on the microprocessor itself) has built-in watchdog timers that pausing in the debugger obviously triggers. To disable the ExpressivePixels firmware from starting the Bluetooth advertising and connection path, un-comment DISABLE_BLE_ADVERTISING in \ExpressivePixelsPlatform\EPXPlatform_BLE.h.