Read nRF5340 Network Core "FW_INFO" from the App Core

Hello Devzone,

How can the nRF5340 App core read the "version number" of the image flashed to the Network Core, e.g. the FW_INFO fields, or something similar?

I am using NCS 1.9.1.

I am able to manually dump and examine the Network core's binary file and see that I can indeed change the FW_INFO version number by adding CONFIG_FW_INFO_FIRMWARE_VERSION=1234 to my child_image/hci_rpmsg.conf file, but I am unsure as to how the App core can obtain that value at runtime.

When CONFIG_BT_DEBUG is set, the calls to  bt_hci_cmd_send_sync(BT_HCI_OP_VS_READ_VERSION_INFO, NULL, &rsp) seem to return junk data, see below.

[00:00:00.642,761] <inf> bt_hci_core : HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.655,426] <inf> bt_hci_core : HW Variant: nRF53x (0x0003)
[00:00:00.666,503] <inf> bt_hci_core : Firmware: Standard Bluetooth controller (0x00) Version 14.50663 Build 1008232294
[00:00:00.684,448] <inf> bt_hci_core : Identity: FC:DB:21:36:D2:52 (random)
[00:00:00.696,563] <inf> bt_hci_core : HCI: version 5.2 (0x0b) revision 0x22fe, manufacturer 0x0059
[00:00:00.711,212] <inf> bt_hci_core : LMP: version 5.2 (0x0b) subver 0x22fe

I don't believe that these are valid values for: Version 14.50663 Build 1008232294.

I tried hacking where those values seem to be set here in vs_read_version_info() at https://github.com/nrfconnect/sdk-zephyr/blob/d6cd4fc1ceec4bb41c217709c373e5b9ffd05e51/subsys/bluetooth/controller/hci/hci.c#L4555 but the values did not change when I rebuilt and reflashed the network core. Are they controlled/set somewhere else?

I also saw this defined BT_VS_CMD_BIT_READ_BUILD_INFO, but didn't see anywhere that this command type/enum is handled. I attempted to make the HCI call with this command but it failed with: 
[00:00:00.665,740] <wrn> bt_hci_core : opcode 0xfc08 status 0x01
Is this command implemented?

How can I set some kind of version information in the Network Core image and then read that back at runtime from the Application Core?

Thank you for any guidance Slight smile

  • Hi Dejan,

    I had already tried what you suggested. I added 

    CONFIG_BT_HCI_VS_EXT=y
    CONFIG_BT_CTLR_HCI_VS_BUILD_INFO="TESTFOO"

    to our child_image/hci_rpmsg.conf, and nothing improved.

    Maybe I'm invoking the command incorrectly, can you provide some example code that invokes the BT_HCI_OP_VS_READ_VERSION_INFO command on the host and prints out its contents?

    Alternatively, I'm not certain the function to populate that data would get compiled into our BLE controller on our build. We are using the "softcore" in NCS 1.9.1. I do see where the data is populated in the hci.c file, but I can completely DELETE the file and rebuild the project from scratch and things still build successfully - so I don't think the project is using the hci.c file at all - therefore the kconfig would have no effect.

    Is there some kconfig or setting that will cause the Network Core Application to use some nrfx pre-compiled library that I can't change?

    Should I expect to find the functions that populate this data in the .map file of the build output for the network core?
    For example, I would expect to find vs_read_version_info as you mentioned above, but I don't see it in the map file; it might be obscured behind a randomly generated name. However I did find sdc_hci_cmd_vs_zephyr_read_version_info which is part of the nrfx pre-compiled library that I don't think I change either with code or kconfigs, see below.

    build/hci_rpmsg/zephyr/zephyr_pre1.map:

     .text          0x0000000001025d72       0x34 ~/co/firmware-nrf-zephyr/workspace/nrfxlib/softdevice_controller/lib/cortex-m33+nodsp/soft-float/libsoftdevice_controller_multirole.a(libsoftdevice_controller_s140_debug_soft__obfuscated.elf)
                    0x0000000001025d72                sdc_hci_cmd_vs_zephyr_read_version_info

     

    Is there a sample project that I can reference (possibly for the 5340dk board) that has this command enabled and working? 

     

    Thanks,
    Blake

  • Hi Blake,

    I have requested more information internally. I'll get back to you when I get some additional information, hopefully tomorrow or the day after tomorrow.

    Best regards,
    Dejan

  • Hi Blake,

    What you asked is currently not supported in SoftDevice Controller. List of supported HCI VS commands can be found here.
    BT_VS_CMD_BIT_READ_BUILD_INFO is supported in Zephyr and can be selected by enabling CONFIG_BT_LL_SW_SPLIT=y. Apart from this, we recommend the use of SoftDevice Controller.

    Best regards,
    Dejan

  • Hi Dejan,

    Simply put, is there any way I can set a 16-bit value anywhere in the Network Core App image at build time that can be read back by the Application Core App image at runtime?

    This is desired to be to differentiate between two App Core App images that have been built with different kconfigs set in our child_image/hci_rpmsg.conf file.

    Thanks,
    Blake

  • I've worked out my own solution to have the NetCore App write its FW_INFO version number to a shared memory location at boot.

    So that will suffice; though I'm disappointed there isn't an out of the box solution via simple kconfigs and existing HCI commands.

    -Blake

Related