How to Prepare and Run Example Code in the nRF5 SDK Under the nRF Connect Desktop Power Profiler App

I’m trying to use the Power Profiler app v3.2.0 under nRFConnect for Desktop v3.9.1 with a PPK 1 attached to an nRF52 DK board (containing the 52832 processor), but am having trouble trying to get the ble app beacon example code in the nRF5 SDK v17.0.2 to flash the DK board via the Programmer app v2.0.1 such that the Power Profiler app will run.  I’ve followed the User Guide for PPK1 v1.1.1.0, cutting the SB9 bridge, plugging the USB cable into the DK board, and setting the Power, DUT, and COM switches on the PPK board to the DK position, then switched the DK Power switch to ON.  I’ve also installed JLink during the installation of NRF Connect v3.9.1.  It does successfully connect to my Windows 10 Pro PC.

 I can run Power Profiler with whatever firmware is installed when I bring that app up.  A green LED is solid on the PPK board while a green LED flashes on the DK board.  I’m seeing around 400 uA being drawn on average with the graph showing periodic spikes to 7 mA. 

I then switch to the Programmer app and drag and drop the hex file for the ble app beacon example after I’ve built it for the project in the pca10040/s132 directory.  It shows up at 0x00026000 – 0x0002A3C1, 0x0002A3C4 - 0x0002B08D, and 0x0002B090 – 0x0002B0F3 in the File Memory Layout.  When I select and read the nRF52 DK device, the existing application shows up at 0x00010000 - 0x0001000F while the MBR or application appears at 0x00000000 to 0x00007323.  Under Device, I click on “Erase & write”.   The log indicates the "Device is loaded and ready for further operation". 

When I exit the Programmer app, and switch to Power Profiler, then select device nRF52 DK, a message pops up: “Device must be programmed, do you want to proceed?"  I thought I had just programmed the device.  If I click on Yes, it evidently loads the original default app.  If I click on No, eventually a “Failed to start PPK” appears in the log.

If I rebuild the ble app beacon with ble_stack_init(), advertising_init(), and advertising_start() commented out, then flash the hex file to the nRF52 device with the Programmer app, I still get the same popup message about the device needing to be programmed when I run the Power Profiler app, and when I click on Yes, the LED on the DK is still blinking as before with the same plot appearing.  It’s as if there is some PPK code missing in the ble app beacon as I’ve built it.

Is there something I must do to the source code under the nRF5 SDK to initialize/configure profiling to get it to run under the Power Profiler app?  I realize there is a Profiler library (https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/others/profiler.html#profiler), but it is apparently integrated into the Zephyr shell.  We are not using that, just the nRF5 SDK.

Thanks in advance for your help.

  • Hi,

    It seems like you are making a mistake which is unfortunately very easy to make with PPK1, where you program the nRF on the PPK and not the nRF on the DK, which is what you wanted to do. The reason is that when you insert the PPK, the onboard debugger on the DK is connected to the nRF on the PPK, and this is also what gets programmed.

    What you need to do is to either remove the PPK when you want to program the nRF on the DK, or flip the COM switch to EXT before you program the DK, and then switch it back to DK when you want to use the power profiler. This will effectively select if the debugger is connected to the nRF on the DK (when you want to program it) or the power profiler kit (when you are going to use the power profiler).

    Einar

  • Thank you, Einar, that is indeed the case.  I am now able to program the DK board.  However, I found that dragging and dropping the hex file of the ble app beacon example to File Memory layout in the Programmer app and then clicking on Erase & write was not successful in getting the program to run properly, even with the COM switch set to EXT on the PPK 1 board.  I had to connect to JLINK on the DK board via SEGGER Embedded Studio, selecting Build and Run under the Build menu and then Start Execution to flash a firmware image on to the DK board which would run successfully.  When I compared the hex file drag-and-drop method with the SEGGER Embedded Studio transfer method from within the Programmer app by reading the nRF52 DK device for each, it appears there is additional code from 0x00000000 - 0x00000AFF (MBR or application) and 0x00001000 - 0x0002596B (SoftDevice).  So I guess I cannot use that app to load the firmware I want to to test unless I know what hex files I need and where to load them in the address space for the device.

    By the way, when I tried to remove the PPK 1 board and just connect the DK board via USB to flash it, the log shows the following error in the Programmer app, even before I attempt to select a device:  "Error while probing devices, more details in the debug log: JLINKARM_DLL_ERROR (Origin: "Error when running nrfdl_enumerate")".   I also couldn't connect via SEGGER Embedded Studio.

  • Hi,

    DataMate said:
    So I guess I cannot use that app to load the firmware I want to to test unless I know what hex files I need and where to load them in the address space for the device.

    Yes, if you have a hex file that depends on other hex files that must also be programmed. The Segger Embedded Studio project files in the SDK includes dependencies like MBR or SoftDevice as additional load files, so they are also programmed when you program from SES. Also, most pre-built hex files that ship with the SDK are merged with hex files they depend on, but if you for instance build the app yourself or for some other reason has hex files that are not merged with dependencies, you need to explicitly flash those as well.

    DataMate said:
    By the way, when I tried to remove the PPK 1 board and just connect the DK board via USB to flash it, the log shows the following error in the Programmer app, even before I attempt to select a device:  "Error while probing devices, more details in the debug log: JLINKARM_DLL_ERROR (Origin: "Error when running nrfdl_enumerate")".   I also couldn't connect via SEGGER Embedded Studio.

    I see. In this case you are using the DK "as normal", without a PPK, and that should work out of the box. It could be that the onboard debugger is in a bad state and that there is a need to power-cycle the board.

Related