Bluetooth API access from the net core in the hci_rpmsg project for NRF5340

Hi,

I am trying to use radio notifications (mpsl_radio_notification.h) to call notify with data just before central connects. I do this with no problem with NRF52840.

With the NRF5340 it seems the radio notification api is only available from the net core.

So I have modified the hci_rpmsg project to hook into the radio call back and this is working fine using ncs sdk 1.6.1.

However, I now want to call bt_gatt_notify_cb, in order to actually execute the notify, which requires #include <bluetooth/gatt.h> in the main.c of hci_rpmsg project.

When I do this I get a compile error in /1.6.1/zephyr/include/bluetooth/gatt.h:628:27: error: 'CONFIG_BT_MAX_PAIRED' undeclared here (not in a function)  ;

I tried adding CONFIG_BT_MAX_PAIRED=1 in the prj.conf it made no difference.


Do you know why this compile error is happening and how to fix it?

A more general question: is it possible to access the high-level Bluetooth APIs in the net core when it is configured for running in the HCI_RPMSG as in the hci_rpmsg project. I was expecting that the APIs would be the same but just directly call the local net core app instead of rpmsg. 

Thanks

Parents
  • For the nRF5340 the network core only have the controller, while the application core have the host. So that is why you cannot include a host API in the network core. This will work on the nRF52840 since the host and controller is in the same core. So what options do you have for the nRF4340?

    - compile both host + controller on the network core, and the application core could then just be a simple "empty_app_core" or equivalent sample flashed on it
    (
    https://github.com/nrfconnect/sdk-nrf/tree/master/samples/nrf5340/empty_app_core)

    An alternative is to implement the radio notification callback on the network core, and signal the application core that it has been triggered. You could possible implement a vendor-specific HCI event and pass it to the host through bt_recv() 
    (
    https://github.com/nrfconnect/sdk-nrf/blob/master/subsys/bluetooth/controller/hci_driver.c#L328Or trigger an interrupt on the application core somehow, perhaps? Not sure how though.

    - Another alternative could be just to use the connected() callback on the host, this callback will be triggered as soon as the link is established (and before first radio event due to link is established)

    Hope that helps,
    Kenneth

  • Hi,

    Thanks for the detailed reply. 

    That all makes sense. I did try signaling the radio notification from the net core to the app core but latency is critical so I don't think this is a good solution. 

    Instead, I have now gone with your suggestion of running the whole BT stack on the net core and setting up whatever IPC between net core and app core as needed. This does mean that there is in effect some application logic now on the net core so the knock-on effect of this is that DFU will need to include net core updates and not just app core updates.

    However, this solution is working very well. 

    Thank you,

    Justin

Reply
  • Hi,

    Thanks for the detailed reply. 

    That all makes sense. I did try signaling the radio notification from the net core to the app core but latency is critical so I don't think this is a good solution. 

    Instead, I have now gone with your suggestion of running the whole BT stack on the net core and setting up whatever IPC between net core and app core as needed. This does mean that there is in effect some application logic now on the net core so the knock-on effect of this is that DFU will need to include net core updates and not just app core updates.

    However, this solution is working very well. 

    Thank you,

    Justin

Children
Related