Application and code example for using two cores in nRF5340

Is there an example of how to develop an application using the nRF5340 demonstrating how to use the two cores when developing an application? I am using the nRF Connect for VSCode add-in.

I have read Developing with nRF5340 DK where it introduces the network core and application core and it briefly covers inter-core communication and I see there is a Synchronized RTC sample which shows "how RTC clocks used for system clock on application and network core are synchronized".

I have looked through the overview of the nRF5340 DK support in Zephyr and the nRF5340 Product Specification but didn't get a clear understanding of what I need to do to take advantage of the two cores. I have also read Working with nRF5340.

I read this post which leads to a blog showing how to flash two sample applications to different cores: the HCI RPMsg on the network core and the Peripheral LBS on the application core.

What I do not understand is how the code needs to change in the peripheral_lbs and HCI RPMsg? Does the HCI RPMsg receive the bluetooth communication and pass it off to peripheral_lbs? How does it work? I don't see any Service or Characteristic derinitions in the RPMsg code.

I've been building my application using the cpuapp and don't know if there is anything I need to do on the net side.

Parents
  • Hello,

    I have picked up this case and will answer some of it today. Tomorrow I will elaborate and address the rest.

    What I do not understand is how the code needs to change in the peripheral_lbs and HCI RPMsg?

    The general answer: When CONFIG_BT=y in your project configuration (prj.conf) and the build target is the nRF5340 application core, HCI RPMsg will automatically be built for the network core.

    The specific answer: Peripheral LBS has CONFIG_BT=y in prj.conf which means the HCI RPMsg sample will automatically be built for the nRF5340 network core when Peripheral LBS is built for the nRF5340 application core. So there is no need to change anything in either sample.

    Best regards,

    Maria

  • Hi again,

    Does the HCI RPMsg receive the bluetooth communication and pass it off to peripheral_lbs? How does it work?

    In this documentation you can read about the Bluetooth Stack Architecture. It contains an overview of the dual-chip configuration which is the configuration normally used with the nRF5340 (controller on the network core and host on the application core).

    HCI RPMsg is based on OpenAMP which has its documentation and source code here.

    Is there an example of how to develop an application using the nRF5340 demonstrating how to use the two cores when developing an application?

    I recommend that you use the product specification and the .dtsi for the nRF5340 (nrf5340_cpuapp* and nrf5340_cpunet*) to get familiar with which peripherals are available for each core. For example: the application core does not have access to the radio peripheral which is why the dual-chip configuration is used for the Bluetooth stack.

    Best regards,

    Maria

  • I built an app using the nRF connect for VSC addin and based it on the cpuapp board. I have built ble connectivity into it but I don't think I did it any differently than if I were on a single core board. It's working but I'm not really sure why and if there are memory constraints when I am doing work on a ble thread.

  • Do you see any reference to rpmsg in the build log?

    If you want insight on the memory usage per thread, you can use Zephyr's Thread Analyzer.

Reply Children
No Data
Related