Sample program for communicating between application and net core in NRF5340

Hi,

We are developing a software application for our healthcare project on NRF5340 development kit. It requires an array of data (600 bytes approx) to be shared from application core to net core and vice versa.

Please could someone tell us a sample program (which can be used to share bytes of data) that we can take to communicate between the application and net core?

Also we would use the multicore program which would create a single build hex file called as "merged_domains.hex". Can we directly take this hex file and flash onto the NRF5340 board using the programmer tool?

We also need to know where the separate hex files would be present for each core in the "build" folder?

Thanks and regards

Ajit S J

  • Hello,

    You can look into the IPC sample found in NCS\nrf\samples\ipc, which is also described here.

    What NCS version are you looking into? The reason I ask is that I believe there was an issue with this sample in v2.3.0 of NCS. I can look into it if that is the one you are using.

    To flash the samples you can either use VS Code, and hit flash. Otherwise you can use the command "west flash build" where build is the build folder. If you want to see what this command is doing, you can add a -v (verbose) to that command: "west -v flash build", and you can see that it splits up the merged .hex file into two. One for the app core and one for the net core. 

    Otherwise, the build\zephyr\merged_domains.hex is the file that you can upload in nRF Connect for Desktop -> Programmer, and it will flash both cores.

    On a sidenote: The 600 bytes that you need to transmit from the app core to the net core. Do you intend to send them via BLE? Because if so, I think you are taking one step too far. Building any sample that uses BLE will handle both of the cores for you, and upload whatever is needed to the respective cores.

    Best regards,

    Edvin

  • Hi  ,

    Thanks for your response.

    We have our proprietary protocol which is used to transmit/receive data packets with our patient monitor over radio 2.4GHz frequency. According to this protocol, we would get the data collected in the application core and we would need to send these data packets from application core to the network core to transmit over the radio. So we are not using the BLE tool. 

    We are using "v2.3.0" of NCS. 

    As part of this exercise we found that there are three ways to send the data between app and net cores.

    1) IPC

    2) Rpmsg service

    3) OpenAMP

    Could you please let us know the best way to among these and point to the correct samples which transmit the data between the cores?

    Regarding the merged hex file, we would like to know where would the different cores hex files be present in their respective build directories before getting merged. We do not want to split the hex files. 

    Thanks and regards,

    Ajit S J

  • Ajitsj said:
    We have our proprietary protocol which is used to transmit/receive data packets with our patient monitor over radio 2.4GHz frequency.

    I understand. Just wanted to check. 

    Ajitsj said:
    As part of this exercise we found that there are three ways to send the data between app and net cores.

    It is correct that there are several approaches here. IPC is a generic way of communicating between the two cores. It can generate events that the other core can react (wake up) on, containing data on what to do. The IPC itself is a hardware peripheral present on both cores. So using this directly would be considered a "bare metal" approach. 

    Then we have the OpenAMP, which is part of Zephyr. This uses IPC to implement an industry standard framework for IPC. 

    Then we have RPMsg, which is running on top of OpenAMP. It will facilitate the creation of endpoints that the application can use. This is what is used in our softdevice controller (Bluetooth Low Energy stack), as well as in our 802.15.4 drivers (used in OpenThread and Zigbee).

    There is no wrong or right choice. You can have a look at the different ones, and see what sort of layer you want to use. Close to bare metal, or some higher level drivers/libraries.

    Best regards,

    Edvin

  • Hi ,

    I used the "samples/subsys/ipc/rpmsg_service/" and the "samples/subsys/ipc/rpmsg_service/remote/" samples and flashed them onto the NRF5340 board.

    The "rpmsg_service" got flashed onto the APP core and the "rpmsg_service/remote" got flashed onto the NET core.

    But the sample did not run as expected and it waited for ever in the below mentioned while loop in the rpmsg program.

        /* Since we are using name service, we need to wait for a response
         * from NS setup and than we need to process it
         */
        while (!rpmsg_service_endpoint_is_bound(ep_id)) {
            k_sleep(K_MSEC(1));
        }
    Looks like the "bound" variable is not getting set to true. 
    We are using the "2.3.0" NCS toolchain version.
    We have not done any modifications in the sample code and it should have worked straight away. But it is not.
    Could you please help us in resolving this issue.
    Thanks and regards,
    Ajit S J
  • Hello,

    Ajitsj said:

    The "rpmsg_service" got flashed onto the APP core and the "rpmsg_service/remote" got flashed onto the NET core.

    Can you please explain what you mean by this, or how you did that? Screenshot or snippets of commands or something.

    Did you check what the log from the net core says?

    Best regards,

    Edvin

Related