Error in bt_enable() running BLE host on cpuapp and BLE controller on cpunet on nrf5340dk

Hi

I've configured Zephyr to run BLE host on cpuapp and BLE controller on cpunet, and using RPMsg to communicate between them.

When I call bt_enable() from the app core, it get stuck in function 

bt_rpmsg_open()
,

which is calling

 

rpmsg_service_endpoint_is_bound()

and it get stuck in a while loop inside bt_rpmsg_open(). Need some help to know what functions to call to register and initialize the BLE and RPMsg framwork on BOTH cores please.

I've been looking at the HCI_RPMsg example, but that is for cpunet, the problem here is at the cpuapp core.

When I set CONFIG_RPMSG_SERVICE_MODE_REMOTE=y for the cpunet, the network core doesn't start up.

Not sure how to configure everything.

I'm building the two cores separately and not using child image.

This is how the conf file of cpuapp looks like regarding BLE and RPMsg:

# BLE
CONFIG_BT=y
CONFIG_BT_HCI=y
CONFIG_BT_CTLR=n
CONFIG_BT_HCI_RAW=n

CONFIG_BT_BUF_CMD_TX_COUNT=64
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_SMP=y

# RPMsg/openAMP
CONFIG_RPMSG_SERVICE=y
CONFIG_RPMSG_SERVICE_MODE_MASTER=y
CONFIG_OPENAMP_SLAVE=n
CONFIG_PRINTK=y

And this is for cpunet:

# BLE
CONFIG_BT=y
CONFIG_BT_HCI=y
CONFIG_BT_HCI_RAW=y
CONFIG_BT_CTLR=y
CONFIG_BT_LL_SW_SPLIT=y

# RPMsg/openAMP
CONFIG_RPMSG_SERVICE=y
CONFIG_RPMSG_SERVICE_MODE_REMOTE=y   #### If this is included it makes the network core to not start up
CONFIG_OPENAMP_MASTER=n

I've also tried using the pure RPMsg example without BLE, in zephyr/samples/subsys/ipc/rpmsg_service

But that doesn't work either, get stuck in the same function, and the network core doesn't even start up when CONFIG_RPMSG_SERVICE_MODE_REMOTE=y is enabled

Thanks

Parents
  • Hello, I will take a look at this today.

    Best regards,

    Simon

  • Thank you.

    An update on the issue:

    I had CONFIG_TRUSTED_EXECUTION_SECURE=n set to 'n' to get the nrf5340_cpunet_reset.c file to start up network core, and that worked when CONFIG_RPMSG_SERVICE_MODE_REMOTE was set to 'n'. 

    But when CONFIG_RPMSG_SERVICE_MODE_REMOTE was set to 'y' the network core didn't startup. 

    I then tried with CONFIG_TRUSTED_EXECUTION_SECURE=y and CONFIG_RPMSG_SERVICE_MODE_REMOTE=y but then line 27 in nrf5340_cpunet_reset.c wouldn't get executed: 

    static int remoteproc_mgr_boot(const struct device *dev)
    {
    	ARG_UNUSED(dev);
    
    #if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
    	/* Secure domain may configure permissions for the Network MCU. */
    	remoteproc_mgr_config();
    #endif /* !CONFIG_TRUSTED_EXECUTION_NONSECURE */
    
    #if !defined(CONFIG_TRUSTED_EXECUTION_SECURE)
    	/*
    	 * Building Zephyr with CONFIG_TRUSTED_EXECUTION_SECURE=y implies
    	 * building also a Non-Secure image. The Non-Secure image will, in
    	 * this case do the remainder of actions to properly configure and
    	 * boot the Network MCU.
    	 */
    #if defined(SHM_BASE_ADDRESS) && (SHM_BASE_ADDRESS != 0)
    
    	/* Initialize inter-processor shared memory block to zero. It is
    	 * assumed that the application image has access to the shared
    	 * memory at this point (see #24147).
    	 */
    	memset((void *) SHM_BASE_ADDRESS, 0, SHM_SIZE);
    #endif
    
    	/* Release the Network MCU, 'Release force off signal' */
    	NRF_RESET->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Release;
    
    	LOG_ERR("Network core released");
    
    #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */
    
    	return 0;
    }

    So I copied line 27 to my main.c file and now at least network core starts up, and my configuration is as follows:

    CONFIG_TRUSTED_EXECUTION_SECURE=y
    CONFIG_RPMSG_SERVICE_MODE_REMOTE=y
    and line 27 in nrf5340_cpunet_reset.c is executed in my main.c file instead.

    But application core get stuck in a while loop calling:

    rpmsg_service_endpoint_is_bound(ep_id)

    Thanks

Reply
  • Thank you.

    An update on the issue:

    I had CONFIG_TRUSTED_EXECUTION_SECURE=n set to 'n' to get the nrf5340_cpunet_reset.c file to start up network core, and that worked when CONFIG_RPMSG_SERVICE_MODE_REMOTE was set to 'n'. 

    But when CONFIG_RPMSG_SERVICE_MODE_REMOTE was set to 'y' the network core didn't startup. 

    I then tried with CONFIG_TRUSTED_EXECUTION_SECURE=y and CONFIG_RPMSG_SERVICE_MODE_REMOTE=y but then line 27 in nrf5340_cpunet_reset.c wouldn't get executed: 

    static int remoteproc_mgr_boot(const struct device *dev)
    {
    	ARG_UNUSED(dev);
    
    #if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
    	/* Secure domain may configure permissions for the Network MCU. */
    	remoteproc_mgr_config();
    #endif /* !CONFIG_TRUSTED_EXECUTION_NONSECURE */
    
    #if !defined(CONFIG_TRUSTED_EXECUTION_SECURE)
    	/*
    	 * Building Zephyr with CONFIG_TRUSTED_EXECUTION_SECURE=y implies
    	 * building also a Non-Secure image. The Non-Secure image will, in
    	 * this case do the remainder of actions to properly configure and
    	 * boot the Network MCU.
    	 */
    #if defined(SHM_BASE_ADDRESS) && (SHM_BASE_ADDRESS != 0)
    
    	/* Initialize inter-processor shared memory block to zero. It is
    	 * assumed that the application image has access to the shared
    	 * memory at this point (see #24147).
    	 */
    	memset((void *) SHM_BASE_ADDRESS, 0, SHM_SIZE);
    #endif
    
    	/* Release the Network MCU, 'Release force off signal' */
    	NRF_RESET->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Release;
    
    	LOG_ERR("Network core released");
    
    #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */
    
    	return 0;
    }

    So I copied line 27 to my main.c file and now at least network core starts up, and my configuration is as follows:

    CONFIG_TRUSTED_EXECUTION_SECURE=y
    CONFIG_RPMSG_SERVICE_MODE_REMOTE=y
    and line 27 in nrf5340_cpunet_reset.c is executed in my main.c file instead.

    But application core get stuck in a while loop calling:

    rpmsg_service_endpoint_is_bound(ep_id)

    Thanks

Children
No Data
Related