This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Getting started Zephyr BLE examples will not run on nRF5340 DK with nRF Connect SDK 6.1

This is a new install of NCS 6.1. Installed using nRF Connect Desktop v3.7.0 Toolchain Manager and connected to a new nRF5340 DK.

I followed the Getting Started, Running a First Test instructions here: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_gsg_ncs%2FUG%2Fgsg%2Ffirst_test.html

I was able to get the HRM demo application loaded and running using the nRF Connect Desktop Programmer using the download HEX files. It did ask me if I wanted to erase the two processors in the DK before programming the HRM files, which I did. The HRM loaded and ran on the DK.

I then used the File->Open nRF Connect SDK Project and loaded the Getting Started Zephyr-> Blinky application and compiled, downloaded to target and ran. It ran fine.

I repeated this process for Bluetooth example projects but I am unable to get any of the Short Range Bluetooth applications to run.

I tried beacon, peripheral_lbs and peripheral_hr for targets nrf534dk_nrf5340_cpuapp and nrf534dk_nrf5340_cpuappns these projects compiled with no problem but none of these projects will run on my nRF5340 DK when built and loaded from SES.

The serial terminal shows zephyr booting and then it hangs
*** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***

I am getting a warning message each time I run Target->Download Zephyr/merged.hex that says the build is out of date and has to be rebuilt, although I just built it! Not sure if this is causing the issue?

Can you please help me fix this problem?

  • Hi,

    If you haven't already, please download and install the nRF Command Line Tools.

    Then open Toolchain Manager, click the "..." button next to v1.6.1, and click "bash". Then run these two commands:

    nrfjprog --recover --coprocessor CP_NETWORK
    nrfjprog --recover

    Afterwards, try flashing one of the bluetooth examples again.

  • Hi Thanks for your reply.

    I installed the nRF Command Line Tools v10.13.0 and ran the commands. Both commands executed with no errors. I downloaded the peripheral_hr project from SES again, but it still does not run. I get the same Booting Zephyr OS on the serial terminal output but the sample is not running.

    I've been building products with the nRF5 SDK for many years and never had any issues. This is my first experience with nRF Connect SDK, I don't know what I'm doing wrong. What should I do next?

    After further investigation it looks like merged.hex is missing the network core hex file!

    Detailed description of my troubleshooting:

    In case this was a problem with my Windows Dev environment, I decided to try and get it to run on a Mac computer with a 2nd brand new 5340 DK. The peripheral samples would not run. Here are the steps followed on the Mac

    1) Installed NCS 1.6.1 using nRF Connect Desktop toolchain Manager. This worked fine.

    2) Followed the Getting started with nRF5340-DK guide which says to verify all connectivity by loading the pre-built HRM application using nRF Connect Programmer. I connected Programmer and it showed a message in both the Network Core and the Application core: Device Is Protected. Press Erase All button to recover protected memory.

    3) I exited Programmer, opened a terminal and ran nrfjprog --recover --coprocessor CP_NETWORK and then nrfjprog --recover. Both commands executed with no error.

    4) I launched Programmer again and it showed the same message that both the cores are protected. The nrfjprog recover commands did not work? I Clicked the Erase All button in nRF Connect Programmer and it successfully erased both cores and removed the Protection.

    5) I loaded the two prebuilt HEX files for the HRM sample with Programmer and wrote them to the DK, Reset the DK and Found the Zephyr Heartrate Sensor device advertising in the nRF Connect IOS app, so the pre-built app works fine.

    6) I launched SES and opened the peripheral_lbs sample project. I selected the nrf5340_dk_cpuappns target board with builtthe sample. No compile errors. I tried to download merged.hex to the target but got the error that the solution was out of date and had to be rebuilt. I rebuilt and downloaded the merged.hex file. It would not run.

    7) I launched nRF Connect Programmer again and clicked Add Hex file and selected the merged.hex file built above. It loaded an application file and MBR into the Application core area but Nothing in the Network core.

    8) I wrote the files to the Target with Programmer. After the write, there was a file and MBR in the App Core and an MBR only in the Network core.

    Is there something missing in the SES config that does not produce a binary file for the network core?

  • I think I have figured this out. The Getting Started Guide is not clear. I followed the instructions for Building and Programming an Application in the GSG, but this does not work for the Dual core nRF5340. You have to go to the section Building and Running a Sample in the nRF5340 documentation, which takes some searching to find. Follow the instructions on adding a multi-image build project to the solution.

    Another important detail is the Zephyr Bluetooth samples don't work on the nRF5340 so you have to load a Nordic Sample. In SES run the File->Open nRF SDK Project tool. Don't select the project from the list, instead Click the ... at the right and browse to the Nordic samples. E.g. for the peripheral_lbs sample, browse to: \v1.6.1\nrf\samples\bluetooth\peripheral_lbs

    Once I followed the above steps, I could build the peripheral_lbs sample, add a project to download the network core hex file for the peripheral_lbs sample to the target and then download the application hex file to the application core on the target.

  • The Zephyr bluetooth samples work fine on the nRF5340, but you flash the cores separately. So build and flash zephyr/samples/bluetooth/hci_rpmsg for nrf5340dk_nrf5340_cpunet, then build and flash the bluetooth application for cpuapp/cpuappns.

Related