This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Setting the BLE Public Address on nRF5340

I am trying to set the public ble mac address from the application core of a nRF5340, I understand that I need to use bt_ctlr_set_public_addr() but I can't seem to get my project to compile when I include bluetooth/controller.h, due to the source file that defines bt_ctlr_set_public_addr() not being added to the project. I am using the SoftDevice currently that is CONFIG_BT_LL_SOFTDEVICE. So my question is what configurations do I need to set to make this work? I have also been thinking that it might be that it is only possible to use the function from the network core, if this is the case then where do I find the source so that I can make the changes that I need or should I instead of change the source use rpc?

If I forgot to mention something important then I apologise in advance.

Parents Reply Children
  • Hi,

    I have asked our developers for a clarification about this. Since the function bt_ctlr_set_public_addr() is part of the controller API, it should be called in the application running on the network core, HCI RPMsg, and not the application core. So unfortunately you cannot use this from the application core. They are going to check if there are other ways to change the public address on nRF5340. I will let you know when I hear back from them.

    Best regards,

    Marte

  • Hello again, I was wondering if you had heard back from the developers? Maybe they would like some additional details about my problem?

  • Hi,

    They have not come back to me regarding other ways to change this yet, but I have asked them for an update.

    I do not believe we have a function to change the address directly from the application core. However, the network core has access to the memory of the application core, and the two cores communicate, using OpenAMP. It might be possible to create something where you send a message from the application core to the network core to make it change the address, but you would then have to change the HCI RPMsg sample as well. The HCI RPMsg sample use RPMsg, which is a part of OpenAMP. If you want to look at a sample specifically for how to use the RPMsg Service, you can look at Zephyr's RPMsg Service sample Application. You can also find the repository for OpenAMP on github here: OpenAMP.

    I am sorry for the delayed answer, and for not having more to help you with right now. If you want to, you can provide additional details about your problem and I can forward it to our developers.

    Best regards,

    Marte

  • Hi,

    The developers got back to me now.

    They confirmed that what I suggested in my previous reply is possible, and that you just need to add an implementation of this in the hci_rpmsg driver. You can also use the vendor specific HCI command "Zephyr Write BD ADDR, sdc_hci_cmd_vs_zephyr_write_bd_addr, to set the public address, which is supported by the SoftDevice Controller. To use this you must enable CONFIG_BT_HCI_VS and CONFIG_BT_HCI_VS_EXT. See API documentation — nrfxlib 1.6.99 documentation (nordicsemi.com) for more information.

    Best regards,

    Marte

Related