nRF5340 IPC & OpenAMP

My first dual-core project:

- custom board with nRF5340 + nRF7002 + nRF21540

- nRF Connect SDK 3.0.1

1) I successfully ported nrf/samples/wifi/radio_test/multi_domain sample to cpuapp to test WiFi radio HW, choosing nrf7002dk/nrf5340/cpuapp board for build configuration.

2) Independently of 1), I successfully ported nrf/samples/peripheral/radio_test (cpunet, nrf7002dk/nrf5340/cpunet board) + nrf/samples/nrf5340/remote_shell (cpuapp, nrf5340dk/nrf5340/cpuapp board, i.e. the only one supported) to test BLE radio HW.

Now I am trying to merge 1) and 2) because we need to test both WiFi and BLE radios with the same FW, with separate console commands. The cpunet FW remains the same as in 2). The cpuapp FW is based on 1), with added shell_ipc_host.h,c from 2) cpuapp project. I am struggling to add IPC functionality to cpuapp to be able to send BLE radio test commands to cpunet as I did in 2).

I added these lines to cpuapp prj.conf:

CONFIG_IPC_SERVICE=y
CONFIG_IPC_SERVICE_BACKEND_RPMSG=y
CONFIG_MBOX=y
CONFIG_MBOX_NRFX_IPC=y

After a pristine build, CONFIG_IPC_SERVICE_BACKEND_RPMSG is highlighted and the tip says:

CONFIG_IPC_SERVICE_BACKEND_RPMSG was assigned the value y, but got the value n. Missing dependencies: DT_HAS_ZEPHYR_IPC_OPENAMP_STATIC_VRINGS_ENABLED

If I flash both FWs to respective cores, I get error -12 from 

shell_ipc_host_init() -> ipc_init() -> ipc_service_open_instance() -> backend->open_instance()
call chain.
Can you help me find out what is missing in the new merged cpuapp project to make the IPC work?
Parents Reply Children
  • Hi,

    I added the configuration from your link to my overlay file (I only kept the ipc0 and deleted the ipc1 part). The build was successful but both issues remain:

    Missing dependencies: DT_HAS_ZEPHYR_IPC_OPENAMP_STATIC_VRINGS_ENABLED

    - ENOMEM error

    There was an additional one: when I hover over reserved-memory part in the overlay, I get this tip:

    You are using Partition Manager to define the partitions. Devicetree definitions are ignored for this build.

    So I followed this link:  How to configure flash and RAM partitions and copied build/partitions.yml to <project folder>/pm_static.yml, and replaced its contents with

    sram_ipc0: 
      address: 0x20070000
      end_address: 0x20080000
      region: sram_primary
      size: 0x10000

    I also removed the reserved-memory part from the overlay. The build now fails with

    devicetree error: /ipc/ipc0: undefined node label 'sram_ipc0'

    So to wrap up: I still have the missing DT_HAS_ZEPHYR_IPC_OPENAMP_STATIC_VRINGS_ENABLED dependency and I don't know how to correctly reserve a SRAM partition for IPC.

  • Could you try to add the following content to boards/nrf5340dk_nrf5340_cpuapp.overlay and sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.overlay and let me know the result?

    /*
     * Copyright (c) 2021 Carlo Caione <[email protected]>
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    
    #include <zephyr/dt-bindings/ipc_service/static_vrings.h>
    
    / {
    	chosen {
    		/delete-property/ zephyr,ipc_shm;
    	};
    
    	reserved-memory {
    		/delete-node/ memory@20070000;
    
    		sram_ipc0: memory@20070000 {
    			reg = <0x20070000 0x8000>;
    		};
    
    		sram_ipc1: memory@20078000 {
    			reg = <0x20078000 0x8000>;
    		};
    	};
    
    	ipc {
    		/delete-node/ ipc0;
    
    		ipc0: ipc0 {
    			compatible = "zephyr,ipc-openamp-static-vrings";
    			memory-region = <&sram_ipc0>;
    			mboxes = <&mbox 0>, <&mbox 1>;
    			mbox-names = "tx", "rx";
    			role = "host";
    			status = "okay";
    
    			bt_hci_ipc0: bt_hci_ipc0 {
    				compatible = "zephyr,bt-hci-ipc";
    				status = "okay";
    			};
    		};
    
    		ipc1: ipc1 {
    			compatible = "zephyr,ipc-openamp-static-vrings";
    			memory-region = <&sram_ipc1>;
    			mboxes = <&mbox 2>, <&mbox 3>;
    			mbox-names = "tx", "rx";
    			role = "host";
    			zephyr,priority = <1 PRIO_COOP>;
    			zephyr,buffer-size = <128>;
    			status = "okay";
    		};
    	};
    };

  • When merging 1) and 2), I have the cpuapp FW based on 1) and the cpunet based on 2) so I have both projects based on nrf7002dk/nrf5340 board, as stated above. So there is no nrf5340dk_nrf5340_cpuapp.overlay. I also don't have the sysbuild folder.

    In the meantime, I managed to join the BLE and WiFi radio test by going the other way around: I took both the cpunet and cpuapp from 2) as starting point and added WiFi functionality to cpuapp.

Related