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

Parents Reply Children
  • Hi,

    I have asked internally. I'll get back to you when I get new information.

    Best regards,
    Dejan

  • Hi,

    It should not be possible to read information written in the network core from the application core at runtime.

    For the second question, it is not expected for values that you mentioned to change. BT_HCI_OP_VS_READ_VERSION_INFO calls vs_read_version_info here. BT_HCI_VS_HW_PLAT and BT_HCI_HW_VAR relate to the board. Kernel variables are defined here.

    You could try command BT_HCI_OP_VS_READ_BUILD_INFO? This should return "Zephyr OS v" \ KERNEL_VERSION_STRING CONFIG_BT_CTLR_HCI_VS_BUILD_INFO if  CONFIG_BT_CTLR_HCI_VS_BUILD_INFO has been set in your configuration file.

    Best regards,
    Dejan

  • Hello,

    Correct, I am aware the two Cores cannot read each other's flash data, thus a HCI command will have to be used.

    Ok, the BT_HCI_OP_VS_READ_VERSION_INFO command seems to be fixed from the nrfx pre-compiled library and cannot be changed.

    I did try the command you suggested as I noted in my original question, but re-trying today I still get a failed response as I saw before:

    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?

    Can you tell me how to configure the BLE controller to be able to respond to this command? Or where the code in the controller is that populates the data to respond to this command - I could not find it?

    Thanks.

  • Hi,

    You should include CONFIG_BT_HCI_VS_EXT=y configuration option.

    The code for populating the data is located in hci.c file.

    Best regards,
    Dejan

  • 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

Related