iOS BLE cannot correctly read the model number.

After updating from SDK V2.1.3 OTA to SDK V2.9.0, iOS cannot correctly read data such as the model number, but Android can read it normally.

Turn off Bluetooth in the system, turn it back on, and it can be read normally after connecting.

Parents
  • Hi Leo

    Thank you for your patience here. We don't have a specific theory of what is happening here I'm afraid. With the nRF Sniffer for BLE (https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-6-bluetooth-le-sniffer/topic/nrf-sniffer-for-bluetooth-le/) for example, you can select sniffing the address and operations of a specific device, so it should be possible to capture the communication of one specific device even in a busy environment. I think that would help us a lot.

    For the information you shared, I haven't found anything obviously wrong with it yet, but I'm not done reviewing it. I will get back to you later this week with more information.

    Best regards,

    Simon

  • Hi Simonr,

    I used this method to capture packets, but it's still difficult to capture all of them.

    ancs_client_sdk_v2.1.3_to_v2.9.0.pcapng

    Best regards,

    Leo Mo

  • Hi Leo,

    Can you try to sniff the bonding procedure as well initially so that we get the key, or alternative build the old v2.1.3 based firmware with CONFIG_BT_LOG_SNIFFER_INFO=y and insert the key into nRF Sniffer so that it can decode the encrypted packets? Without it, we do not see the content of the ATT packets, which we are interested in in the trace. See Sniffing a connection between bonded devices.

    How do you build the samples and do they run on a DK so that I can test on my end? Please share the full build commands for both. I would like to test this on my end.

    That said, I got the v2.9 version built, but there was failure on the v2.1.3. That said, I was first interested in verifying that CONFIG_BT_GATT_SERVICE_CHANGED=y was enabled in the .config in the build, and it was. So the service changed characteristic is there in the old, which is good and essential. So this looks good so far, and I do not have a clear idea of what the cause here is.

    Br,

    Einar

  • Hi Leo,

    Thank you. Can you share the exact way you build it (either with the command if you build from the command line, or a screenshot showing your build configuration if you build from VS Code)?

  • Hi Leo,

    I see. Have you done any other changes? When I build the 2.1.3 project it fails to build during linking where it cannot find mcuboot_status_change() This is while using your custom board in the project folder(called nrf52840dk_nrf52840):

    [201/211] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
    : && ccache /opt/nordic/ncs/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc   zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  -fuse-ld=bfd  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/Users/eith/Downloads/peripheral_ancs_client_2_1_3/build/mcuboot/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a  zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/posix/liblib__posix.a  zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a  zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.a  modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  modules/segger/libmodules__segger.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -L"/opt/nordic/ncs/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/thumb/v7e-m+fp/hard"  -L/Users/eith/Downloads/peripheral_ancs_client_2_1_3/build/mcuboot/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  -no-pie  -mcpu=cortex-m4  -mthumb  -mabi=aapcs  -mfpu=fpv4-sp-d16  -mfp16-format=ieee  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  /opt/nordic/ncs/v2.1.3/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.15.a  /opt/nordic/ncs/v2.1.3/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a && cd /Users/eith/Downloads/peripheral_ancs_client_2_1_3/build/mcuboot/zephyr && /opt/nordic/ncs/toolchains/v2.1.3/Cellar/cmake/3.20.5/bin/cmake -E echo
    /opt/nordic/ncs/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(main.c.obj): in function `main':
    /opt/nordic/ncs/v2.1.3/bootloader/mcuboot/boot/zephyr/main.c:545: undefined reference to `mcuboot_status_change'
    /opt/nordic/ncs/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /opt/nordic/ncs/v2.1.3/bootloader/mcuboot/boot/zephyr/main.c:622: undefined reference to `mcuboot_status_change'
    /opt/nordic/ncs/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /opt/nordic/ncs/v2.1.3/bootloader/mcuboot/boot/zephyr/main.c:636: undefined reference to `mcuboot_status_change'
    /opt/nordic/ncs/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /opt/nordic/ncs/v2.1.3/bootloader/mcuboot/boot/zephyr/main.c:667: undefined reference to `mcuboot_status_change'
    /opt/nordic/ncs/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(loader.c.obj): in function `context_boot_go':
    /opt/nordic/ncs/v2.1.3/bootloader/mcuboot/boot/bootutil/src/loader.c:2112: undefined reference to `mcuboot_status_change'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [235/298] Building C object zephyr/kernel/CMakeFiles/kernel.dir/fatal.c.obj
    FAILED: modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build mcuboot/zephyr/zephyr.hex mcuboot/zephyr/zephyr.elf 
    cd /Users/eith/Downloads/peripheral_ancs_client_2_1_3/build/mcuboot && /opt/nordic/ncs/toolchains/v2.1.3/Cellar/cmake/3.20.5/bin/cmake --build . --
    [251/298] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/opt/nordic/ncs/v2.1.3/modules/hal/nordic/nrfx/drivers/src/nrfx_ppi.c.obj
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/v2.1.3/bin/cmake --build /Users/eith/Downloads/peripheral_ancs_client_2_1_3/build

    Can you see if you have done any changes to the SDK? And perhaps download a fresh 2.1.3 and build with that? I would like to be able to build both your project without any changes so that I know I am testing the same as you.

Reply
  • Hi Leo,

    I see. Have you done any other changes? When I build the 2.1.3 project it fails to build during linking where it cannot find mcuboot_status_change() This is while using your custom board in the project folder(called nrf52840dk_nrf52840):

    [201/211] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
    : && ccache /opt/nordic/ncs/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc   zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  -fuse-ld=bfd  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/Users/eith/Downloads/peripheral_ancs_client_2_1_3/build/mcuboot/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a  zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/posix/liblib__posix.a  zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a  zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.a  modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  modules/segger/libmodules__segger.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -L"/opt/nordic/ncs/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/thumb/v7e-m+fp/hard"  -L/Users/eith/Downloads/peripheral_ancs_client_2_1_3/build/mcuboot/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  -no-pie  -mcpu=cortex-m4  -mthumb  -mabi=aapcs  -mfpu=fpv4-sp-d16  -mfp16-format=ieee  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  /opt/nordic/ncs/v2.1.3/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.15.a  /opt/nordic/ncs/v2.1.3/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a && cd /Users/eith/Downloads/peripheral_ancs_client_2_1_3/build/mcuboot/zephyr && /opt/nordic/ncs/toolchains/v2.1.3/Cellar/cmake/3.20.5/bin/cmake -E echo
    /opt/nordic/ncs/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(main.c.obj): in function `main':
    /opt/nordic/ncs/v2.1.3/bootloader/mcuboot/boot/zephyr/main.c:545: undefined reference to `mcuboot_status_change'
    /opt/nordic/ncs/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /opt/nordic/ncs/v2.1.3/bootloader/mcuboot/boot/zephyr/main.c:622: undefined reference to `mcuboot_status_change'
    /opt/nordic/ncs/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /opt/nordic/ncs/v2.1.3/bootloader/mcuboot/boot/zephyr/main.c:636: undefined reference to `mcuboot_status_change'
    /opt/nordic/ncs/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /opt/nordic/ncs/v2.1.3/bootloader/mcuboot/boot/zephyr/main.c:667: undefined reference to `mcuboot_status_change'
    /opt/nordic/ncs/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(loader.c.obj): in function `context_boot_go':
    /opt/nordic/ncs/v2.1.3/bootloader/mcuboot/boot/bootutil/src/loader.c:2112: undefined reference to `mcuboot_status_change'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [235/298] Building C object zephyr/kernel/CMakeFiles/kernel.dir/fatal.c.obj
    FAILED: modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build mcuboot/zephyr/zephyr.hex mcuboot/zephyr/zephyr.elf 
    cd /Users/eith/Downloads/peripheral_ancs_client_2_1_3/build/mcuboot && /opt/nordic/ncs/toolchains/v2.1.3/Cellar/cmake/3.20.5/bin/cmake --build . --
    [251/298] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/opt/nordic/ncs/v2.1.3/modules/hal/nordic/nrfx/drivers/src/nrfx_ppi.c.obj
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/v2.1.3/bin/cmake --build /Users/eith/Downloads/peripheral_ancs_client_2_1_3/build

    Can you see if you have done any changes to the SDK? And perhaps download a fresh 2.1.3 and build with that? I would like to be able to build both your project without any changes so that I know I am testing the same as you.

Children
  • Hi Einar,

    Can you see this file?

    boards\arm\nrf52840dk_nrf52840\mcuboot_hook.c

    Make sure you used custom nrf52840dk_nrf52840 board.

  • Hi,

    I am able to test and I reproduce the issue. I have not been able to find the root cause or resolve it, but will look into this again after the holidays. I apologize for the delay.

    PS: That "custom" radio button only affect the list in nRF Connect for VS Code, the build command refers to the board by name. So using the same name for two boards can cause problems. I did remove the dk files from the SDK but still had build problems, so that is why I wonder if there are other changes. I did make the 2.1.3 project build by setting CONFIG_MCUBOOT_ACTION_HOOKS=n, as it is anyway an empty implementation. As I reproduce the issue now I will ignore i, but as a side noe, I strongly recommend naming your custom board differently as having multiple boards with the same name is not supported (if you migrate to SDK 3.0 or higher later you will need to migrate to hardware model 2, where you anyway need to rename the board).

  • Hi Einar,

    I'm glad to hear this news.
    This 'CONFIG_MCUBOOT_ACTION_HOOKS' can indeed be set to 'n'.
    As for the board names, I just used NRF52840DK here; the others are the actual names of our boards.

    BR,

    Leo Mo

  • Hi Leo,

    It seems like adding CONFIG_BT_GATT_ENFORCE_CHANGE_UNAWARE=y resolves the issue. Note that you also need to add the prototype for sc_restore_rsp() in gatt.c like this:

    diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c
    index 70d6b289f41..02b5059bd08 100644
    --- a/subsys/bluetooth/host/gatt.c
    +++ b/subsys/bluetooth/host/gatt.c
    @@ -264,6 +264,9 @@ BT_GATT_SERVICE_DEFINE(_2_gap_svc,
    #endif
    );
     
    +static void sc_restore_rsp(struct bt_conn *conn,
    +                          struct bt_gatt_indicate_params *params, uint8_t err);
    + 

    We need to look a bit more into this, but the idea here is to prevent any notifications/indications from being sent before the service changed indication.

Related