Supervision timeout does not expire during 120hz data streaming

Hi,

I am using an two nrf5340 with hci_ipc enabled one acting as central and one as peripheral built on v2.9.0

The issue I am having is that the supervision timeout doesn't expire when I hard reset the peripheral whilst sending data (len 91) via notifications at 120hz .

My current fix is to set CONFIG_BT_ATT_LOG_LEVEL_DBG=y which then doesn't miss a supervision timeout event. This doesn't feel like a good long term solution to fixing whatever timing issue this is. Please could you help me.  

Problem Flow from Central perspective:

  1. Scan and connect
  2. Characteristic and CCC descriptor discovery
  3. Enable Notifications
  4. Central MTU Updated TX: 247 RX: 247 bytes
  5. PHY updated: TX PHY 2M, RX PHY 2M
  6. Connection Params:interval 7.50 ms, latency 1, timeout 100 ms
  7. start stream data over notifications at 120hz
  8. wait 3 seconds
  9. Hit reset on peripheral 
  10. Central Hangs indefinitely with no supervision timeout 
Parents
  • If I use CONFIG_LOG_MODE_MINIMAL it all works fine however if I use CONFIG_LOG_MODE_DEFERRED I can see that messages are being dropped:

    [00:00:43.546,661] <dbg> bt_att: bt_att_recv: Received ATT chan 0x2000f1d8 code 0x1b len 91
    --- 2 messages dropped ---
    [00:00:43.554,168] <dbg> bt_att: bt_att_recv: Received ATT chan 0x2000f1d8 code 0x1b len 91
    --- 3 messages dropped ---
    [00:00:43.569,213] <dbg> bt_att: att_notify: chan 0x2000f1d8 handle 0x0012
    --- 2 messages dropped ---
    [00:00:43.586,059] <dbg> bt_att: att_notify: chan 0x2000f1d8 handle 0x0012
    --- 3 messages dropped ---
    [00:00:43.599,151] <dbg> bt_att: att_notify: chan 0x2000f1d8 handle 0x0012
    --- 3 messages dropped ---
    [00:00:43.666,656] <dbg> bt_att: bt_att_recv: Received ATT chan 0x2000f1d8 code 0x1b len 91
    --- 1 messages dropped ---
    [00:00:43.689,178] <dbg> bt_att: bt_att_recv: Received ATT chan 0x2000f1d8 code 0x1b len 91
    --- 5 messages dropped ---



    Why exactly does using the minimal log stop messages from being dropped? 

  • Hi,

    The issue I am having is that the supervision timeout doesn't expire when I hard reset the peripheral whilst sending data (len 91) via notifications at 120hz .

    If the peripheral disconnects after a reset, you should always get a supervision timeout. If yo don't see it, perhaps it is related to the logging issue you asked about? Or that your code does not handle it or something else happens that masks it? Have you done any debugging to learn the state of your application after the supervision timeout shoudl have occured?

    chris.c said:
    Why exactly does using the minimal log stop messages from being dropped? 

    With deferred logging, logging is not procesed in place, but deferred to a low priority thread. If you log a lot (as with BT debug loggign enabled), you will quickly fill the buffer before the logs are processed when using deferred logging. Does it help to set CONFIG_LOG_BUFFER_SIZE=8192 (or another high value) in your prj.conf?

  • Hi,

    I only tested once before, but tested a few times more now wihtout seeing any issue. Does it only happen sometimes when you test? Do you have any changes in the SDK files that could explain differences we are seeing (you can check with "west status")?

  • West status returns nothing:

    PS C:\ncs\v2.9.0\applications\Bluetooth_peripheral> west status
    PS C:\ncs\v2.9.0\applications\Bluetooth_peripheral> west list
    manifest     nrf                          HEAD                                     N/A
    zephyr       zephyr                       v3.7.99-ncs2                             https://github.com/nrfconnect/sdk-zephyr
    wfa-qt-control-app modules/lib/wfa-qt-control-app af011c8a8d338ba529f17aed2cc2ef4c1c591a58 https://github.com/nrfconnect/sdk-wi-fiquicktrack-controlappc
    mcuboot      bootloader/mcuboot           v2.1.0-ncs3                              https://github.com/nrfconnect/sdk-mcuboot
    qcbor        modules/tee/tf-m/qcbor       751d36583a9ce1a640900c57e13c9b6b8f3a2ba2 https://github.com/laurencelundblade/QCBOR
    mbedtls      modules/crypto/mbedtls       v3.6.2-ncs2                              https://github.com/nrfconnect/sdk-mbedtls
    oberon-psa-crypto modules/crypto/oberon-psa-crypto 21728cf8402ac567326d0d69eec891a2bfdb8ea3 https://github.com/nrfconnect/sdk-oberon-psa-crypto
    nrfxlib      nrfxlib                      v2.9.0                                   https://github.com/nrfconnect/sdk-nrfxlib
    trusted-firmware-m modules/tee/tf-m/trusted-firmware-m v2.1.1-ncs2                              https://github.com/nrfconnect/sdk-trusted-firmware-m
    psa-arch-tests modules/tee/tf-m/psa-arch-tests 3da9313e64806d352c519e3205e81cf959067588 https://github.com/nrfconnect/sdk-psa-arch-tests
    matter       modules/lib/matter           v2.9.0                                   https://github.com/nrfconnect/sdk-connectedhomeip
    soc-hwmv1    modules/soc-hwmv1            be0500992bd8c222118b651b88d1f3714855a3aa https://github.com/nrfconnect/sdk-soc-hwmv1
    cjson        modules/lib/cjson            c6af068b7f05207b28d68880740e4b9ec1e4b50a https://github.com/nrfconnect/sdk-cjson
    azure-sdk-for-c modules/lib/azure-sdk-for-c  308c171cb4b5eed266649012a68406487ec81fb2 https://github.com/nrfconnect/azure-sdk-for-c
    cirrus       modules/hal/cirrus-logic     3873a08377d93a479105a75ac390d3bbcd31d690 https://github.com/nrfconnect/sdk-mcu-drivers
    openthread   modules/lib/openthread       ncs-thread-reference-20241002            https://github.com/nrfconnect/sdk-openthread
    suit-generator modules/lib/suit-generator   v2.9.0                                   https://github.com/nrfconnect/suit-generator
    suit-processor modules/lib/suit-processor   v2.9.0                                   https://github.com/nrfconnect/suit-processor
    cmock        test/cmock                   f65066f15d8248e6dcb778efb8739904a4512087 https://github.com/ThrowTheSwitch/cmock
    memfault-firmware-sdk modules/lib/memfault-firmware-sdk 1.12.0                                   https://github.com/memfault/memfault-firmware-sdk
    bsim         tools/bsim                   1f242f4ed7fc141fdfcfeca8d21c6d9e801179d7 https://github.com/BabbleSim/bsim_west
    coremark     modules/benchmark/coremark   d5fad6bd094899101a4e5fd53af7298160ced6ab https://github.com/eembc/coremark
    canopennode  modules/lib/canopennode      dec12fa3f0d790cafa8414a4c2930ea71ab72ffd https://github.com/zephyrproject-rtos/canopennode
    chre         modules/lib/chre             3b32c76efee705af146124fb4190f71be5a4e36e https://github.com/zephyrproject-rtos/chre
    lz4          modules/lib/lz4              11b8a1e22fa651b524494e55d22b69d3d9cebcfd https://github.com/zephyrproject-rtos/lz4
    nanopb       modules/lib/nanopb           4474bd35bd39de067f0532a1b19ce3aed9ed9807 https://github.com/zephyrproject-rtos/nanopb
    bsim         tools/bsim                   1f242f4ed7fc141fdfcfeca8d21c6d9e801179d7 https://github.com/BabbleSim/bsim_west
    coremark     modules/benchmark/coremark   d5fad6bd094899101a4e5fd53af7298160ced6ab https://github.com/eembc/coremark
    canopennode  modules/lib/canopennode      dec12fa3f0d790cafa8414a4c2930ea71ab72ffd https://github.com/zephyrproject-rtos/canopennode
    chre         modules/lib/chre             3b32c76efee705af146124fb4190f71be5a4e36e https://github.com/zephyrproject-rtos/chre
    lz4          modules/lib/lz4              11b8a1e22fa651b524494e55d22b69d3d9cebcfd https://github.com/zephyrproject-rtos/lz4
    nanopb       modules/lib/nanopb           4474bd35bd39de067f0532a1b19ce3aed9ed9807 https://github.com/zephyrproject-rtos/nanopb
    chre         modules/lib/chre             3b32c76efee705af146124fb4190f71be5a4e36e https://github.com/zephyrproject-rtos/chre
    lz4          modules/lib/lz4              11b8a1e22fa651b524494e55d22b69d3d9cebcfd https://github.com/zephyrproject-rtos/lz4
    nanopb       modules/lib/nanopb           4474bd35bd39de067f0532a1b19ce3aed9ed9807 https://github.com/zephyrproject-rtos/nanopb
    tf-m-tests   modules/tee/tf-m/tf-m-tests  d552e4f18b92032bd335d5e3aa312f6acd82a83b https://github.com/zephyrproject-rtos/tf-m-tests
    zscilib      modules/lib/zscilib          ee1b287d9dd07208d2cc52284240ac25bb66eae3 https://github.com/zephyrproject-rtos/zscilib
    cmsis        modules/hal/cmsis            4b96cbb174678dcd3ca86e11e1f24bc5f8726da0 https://github.com/zephyrproject-rtos/cmsis
    zscilib      modules/lib/zscilib          ee1b287d9dd07208d2cc52284240ac25bb66eae3 https://github.com/zephyrproject-rtos/zscilib
    cmsis        modules/hal/cmsis            4b96cbb174678dcd3ca86e11e1f24bc5f8726da0 https://github.com/zephyrproject-rtos/cmsis
    cmsis-dsp    modules/lib/cmsis-dsp        6489e771e9c405f1763b52d64a3f17a1ec488ace https://github.com/zephyrproject-rtos/cmsis-dsp
    cmsis-nn     modules/lib/cmsis-nn         ea987c1ca661be723de83bd159aed815d6cbd430 https://github.com/zephyrproject-rtos/cmsis-nn
    edtt         tools/edtt                   b9ca3c7030518f07b7937dacf970d37a47865a76 https://github.com/zephyrproject-rtos/edtt
    edtt         tools/edtt                   b9ca3c7030518f07b7937dacf970d37a47865a76 https://github.com/zephyrproject-rtos/edtt
    fatfs        modules/fs/fatfs             427159bf95ea49b7680facffaa29ad506b42709b https://github.com/zephyrproject-rtos/fatfs
    hal_nordic   modules/hal/nordic           54bde38c6f6ffb3780b26ae728cf79426184384e https://github.com/zephyrproject-rtos/hal_nordic
    hal_st       modules/hal/st               b2f548fe672f24122c7f92027b2c9eeea8a0483a https://github.com/zephyrproject-rtos/hal_st
    hal_nordic   modules/hal/nordic           54bde38c6f6ffb3780b26ae728cf79426184384e https://github.com/zephyrproject-rtos/hal_nordic
    hal_st       modules/hal/st               b2f548fe672f24122c7f92027b2c9eeea8a0483a https://github.com/zephyrproject-rtos/hal_st
    ://github.com/zephyrproject-rtos/mipi-sys-t
    net-tools    tools/net-tools              93acc8bac4661e74e695eb1aea94c7c5262db2e2 https://github.com/zephyrproject-rtos/net-tools
    nrf_hw_models modules/bsim_hw_models/nrf_hw_models 3cfca0192ff84da919e9bc7978bcc2239cd6a395 https://github.com/zephyrproject-rtos/nrf_hw_models
    nrf_wifi     modules/lib/nrf_wifi         f6b950a3b5c0187fe499b0e518426d5bf88b7e68 https://github.com/zephyrproject-rtos/nrf_wifi
    open-amp     modules/lib/open-amp         b735edbc739ad59156eb55bb8ce2583d74537719 https://github.com/zephyrproject-rtos/open-amp
    picolibc     modules/lib/picolibc         27746bbc246841852912fc3bb5b45094cd8a505a https://github.com/zephyrproject-rtos/picolibc
    segger       modules/debug/segger         b011c45b585e097d95d9cf93edf4f2e01588d3cd https://github.com/zephyrproject-rtos/segger
    tinycrypt    modules/crypto/tinycrypt     1012a3ebee18c15ede5efc8332ee2fc37817670f https://github.com/zephyrproject-rtos/tinycrypt
    uoscore-uedhoc modules/lib/uoscore-uedhoc   84ef879a46d7bfd9a423fbfb502b04289861f9ea https://github.com/zephyrproject-rtos/uoscore-uedhoc   
    zcbor        modules/lib/zcbor            47f34dd7f5284e8750b5a715dee7f77c6c5bdc3f https://github.com/zephyrproject-rtos/zcbor
    PS C:\ncs\v2.9.0\applications\Bluetooth_peripheral> west status
    PS C:\ncs\v2.9.0\applications\Bluetooth_peripheral> west list
    manifest     nrf                          HEAD                                     N/A
    zephyr       zephyr                       v3.7.99-ncs2                             https://github.com/nrfconnect/sdk-zephyr
    wfa-qt-control-app modules/lib/wfa-qt-control-app af011c8a8d338ba529f17aed2cc2ef4c1c591a58 https://github.com/nrfconnect/sdk-wi-fiquicktrack-controlappc
    mcuboot      bootloader/mcuboot           v2.1.0-ncs3                              https://github.com/nrfconnect/sdk-mcuboot
    qcbor        modules/tee/tf-m/qcbor       751d36583a9ce1a640900c57e13c9b6b8f3a2ba2 https://github.com/laurencelundblade/QCBOR
    mbedtls      modules/crypto/mbedtls       v3.6.2-ncs2                              https://github.com/nrfconnect/sdk-mbedtls
    oberon-psa-crypto modules/crypto/oberon-psa-crypto 21728cf8402ac567326d0d69eec891a2bfdb8ea3 https://github.com/nrfconnect/sdk-oberon-psa-crypto
    nrfxlib      nrfxlib                      v2.9.0                                   https://github.com/nrfconnect/sdk-nrfxlib
    trusted-firmware-m modules/tee/tf-m/trusted-firmware-m v2.1.1-ncs2                              https://github.com/nrfconnect/sdk-trusted-firmware-m
    psa-arch-tests modules/tee/tf-m/psa-arch-tests 3da9313e64806d352c519e3205e81cf959067588 https://github.com/nrfconnect/sdk-psa-arch-tests
    matter       modules/lib/matter           v2.9.0                                   https://github.com/nrfconnect/sdk-connectedhomeip
    soc-hwmv1    modules/soc-hwmv1            be0500992bd8c222118b651b88d1f3714855a3aa https://github.com/nrfconnect/sdk-soc-hwmv1
    cjson        modules/lib/cjson            c6af068b7f05207b28d68880740e4b9ec1e4b50a https://github.com/nrfconnect/sdk-cjson
    azure-sdk-for-c modules/lib/azure-sdk-for-c  308c171cb4b5eed266649012a68406487ec81fb2 https://github.com/nrfconnect/azure-sdk-for-c
    cirrus       modules/hal/cirrus-logic     3873a08377d93a479105a75ac390d3bbcd31d690 https://github.com/nrfconnect/sdk-mcu-drivers
    openthread   modules/lib/openthread       ncs-thread-reference-20241002            https://github.com/nrfconnect/sdk-openthread
    suit-generator modules/lib/suit-generator   v2.9.0                                   https://github.com/nrfconnect/suit-generator
    suit-processor modules/lib/suit-processor   v2.9.0                                   https://github.com/nrfconnect/suit-processor
    cmock        test/cmock                   f65066f15d8248e6dcb778efb8739904a4512087 https://github.com/ThrowTheSwitch/cmock
    memfault-firmware-sdk modules/lib/memfault-firmware-sdk 1.12.0                                   https://github.com/memfault/memfault-firmware-sdk
    bsim         tools/bsim                   1f242f4ed7fc141fdfcfeca8d21c6d9e801179d7 https://github.com/BabbleSim/bsim_west
    coremark     modules/benchmark/coremark   d5fad6bd094899101a4e5fd53af7298160ced6ab https://github.com/eembc/coremark
    canopennode  modules/lib/canopennode      dec12fa3f0d790cafa8414a4c2930ea71ab72ffd https://github.com/zephyrproject-rtos/canopennode
    chre         modules/lib/chre             3b32c76efee705af146124fb4190f71be5a4e36e https://github.com/zephyrproject-rtos/chre
    lz4          modules/lib/lz4              11b8a1e22fa651b524494e55d22b69d3d9cebcfd https://github.com/zephyrproject-rtos/lz4
    nanopb       modules/lib/nanopb           4474bd35bd39de067f0532a1b19ce3aed9ed9807 https://github.com/zephyrproject-rtos/nanopb
    tf-m-tests   modules/tee/tf-m/tf-m-tests  d552e4f18b92032bd335d5e3aa312f6acd82a83b https://github.com/zephyrproject-rtos/tf-m-tests
    zscilib      modules/lib/zscilib          ee1b287d9dd07208d2cc52284240ac25bb66eae3 https://github.com/zephyrproject-rtos/zscilib
    cmsis        modules/hal/cmsis            4b96cbb174678dcd3ca86e11e1f24bc5f8726da0 https://github.com/zephyrproject-rtos/cmsis
    cmsis-dsp    modules/lib/cmsis-dsp        6489e771e9c405f1763b52d64a3f17a1ec488ace https://github.com/zephyrproject-rtos/cmsis-dsp
    cmsis-nn     modules/lib/cmsis-nn         ea987c1ca661be723de83bd159aed815d6cbd430 https://github.com/zephyrproject-rtos/cmsis-nn
    edtt         tools/edtt                   b9ca3c7030518f07b7937dacf970d37a47865a76 https://github.com/zephyrproject-rtos/edtt
    fatfs        modules/fs/fatfs             427159bf95ea49b7680facffaa29ad506b42709b https://github.com/zephyrproject-rtos/fatfs
    hal_nordic   modules/hal/nordic           54bde38c6f6ffb3780b26ae728cf79426184384e https://github.com/zephyrproject-rtos/hal_nordic
    hal_st       modules/hal/st               b2f548fe672f24122c7f92027b2c9eeea8a0483a https://github.com/zephyrproject-rtos/hal_st
    hal_wurthelektronik modules/hal/wurthelektronik  e5bcb2eac1bb9639ce13b4dafc78eb254e014342 https://github.com/zephyrproject-rtos/hal_wurthelektronik
    hostap       modules/lib/hostap           44285310338f423021cc7df2c1056256882a00cc https://github.com/zephyrproject-rtos/hostap
    libmetal     modules/hal/libmetal         a6851ba6dba8c9e87d00c42f171a822f7a29639b https://github.com/zephyrproject-rtos/libmetal
    liblc3       modules/lib/liblc3           1a5938ebaca4f13fe79ce074f5dee079783aa29f https://github.com/zephyrproject-rtos/liblc3
    littlefs     modules/fs/littlefs          009bcff0ed4853a53df8256039fa815bda6854dd https://github.com/zephyrproject-rtos/littlefs
    loramac-node modules/lib/loramac-node     fb00b383072518c918e2258b0916c996f2d4eebe https://github.com/zephyrproject-rtos/loramac-node
    lvgl         modules/lib/gui/lvgl         2b498e6f36d6b82ae1da12c8b7742e318624ecf5 https://github.com/zephyrproject-rtos/lvgl
    mipi-sys-t   modules/debug/mipi-sys-t     71ace1f5caa03e56c8740a09863e685efb4b2360 https://github.com/zephyrproject-rtos/mipi-sys-t
    net-tools    tools/net-tools              93acc8bac4661e74e695eb1aea94c7c5262db2e2 https://github.com/zephyrproject-rtos/net-tools
    nrf_hw_models modules/bsim_hw_models/nrf_hw_models 3cfca0192ff84da919e9bc7978bcc2239cd6a395 https://github.com/zephyrproject-rtos/nrf_hw_models
    nrf_wifi     modules/lib/nrf_wifi         f6b950a3b5c0187fe499b0e518426d5bf88b7e68 https://github.com/zephyrproject-rtos/nrf_wifi
    open-amp     modules/lib/open-amp         b735edbc739ad59156eb55bb8ce2583d74537719 https://github.com/zephyrproject-rtos/open-amp
    picolibc     modules/lib/picolibc         27746bbc246841852912fc3bb5b45094cd8a505a https://github.com/zephyrproject-rtos/picolibc
    segger       modules/debug/segger         b011c45b585e097d95d9cf93edf4f2e01588d3cd https://github.com/zephyrproject-rtos/segger
    tinycrypt    modules/crypto/tinycrypt     1012a3ebee18c15ede5efc8332ee2fc37817670f https://github.com/zephyrproject-rtos/tinycrypt
    uoscore-uedhoc modules/lib/uoscore-uedhoc   84ef879a46d7bfd9a423fbfb502b04289861f9ea https://github.com/zephyrproject-rtos/uoscore-uedhoc   
    zcbor        modules/lib/zcbor            47f34dd7f5284e8750b5a715dee7f77c6c5bdc3f https://github.com/zephyrproject-rtos/zcbor
    PS C:\ncs\v2.9.0\applications\Bluetooth_peripheral> 

    I have just uninstalled a reinstalled everything fresh:


    Visual Studio Code v1.97.2

    nRF Connect SDK 2.9.0

    nRF Connect SDK Toolchain v2.9.0

    Segger jlink 8.10f

    West version v1.3.0

    I've tried flashing the code on to a brand new nrf5340dk and I still get the same problem:

    [00:00:07.039,978] <inf> Main: Starting scan...
    [00:00:07.040,191] <inf> Bluetooth_Central: Starting active scan... (interval: 0x0060, window: 0x0030)
    [00:00:07.588,470] <inf> Main: 
    Scanning stopped. Final device list:
    [00:00:07.588,500] <inf> Bluetooth_Central: Found devices (7):
    [00:00:07.588,623] <inf> Bluetooth_Central: 1: [(unknown)] Address: 7C:9E:24:B3:F1:68 (random), Manufacturer: [Apple], RSSI: -47
    [00:00:07.588,745] <inf> Bluetooth_Central: 2: [(unknown)] Address: 03:A9:FB:25:13:1B (random), Manufacturer: [Microsoft], RSSI: -50
    [00:00:07.588,867] <inf> Bluetooth_Central: 3: [(unknown)] Address: 61:A9:90:B8:03:C7 (random), Manufacturer: [Apple], RSSI: -56
    [00:00:07.588,989] <inf> Bluetooth_Central: 4: [BT_i2cHub] Address: CA:08:57:92:2B:89 (random), Manufacturer: [Nordic Semiconductor], RSSI: -52
    [00:00:07.589,111] <inf> Bluetooth_Central: 5: [S18 BA2C LE] Address: F3:33:F9:9E:F3:67 (random), Manufacturer: [Sonos], RSSI: -68
    [00:00:07.589,233] <inf> Bluetooth_Central: 6: [(unknown)] Address: F8:3F:51:19:D0:67 (public), Manufacturer: [Samsung], RSSI: -85
    [00:00:07.589,385] <inf> Bluetooth_Central: 7: [S14 38E6 LE] Address: E7:E7:FB:88:F5:73 (random), Manufacturer: [Sonos], RSSI: -104
    [00:00:07.589,385] <inf> Main: 
    Press button again to connect to device 1, or wait for timeout to scan again
    ble_central:~$ 
    ---- Sent utf8 encoded message: "bt connect 4\n" ----
    bt connect 4
    Connecting to device 4...
    [00:00:21.224,212] <inf> Bluetooth_Central: Attempting to connect to device 4: [BT_i2cHub] at address CA:08:57:92:2B:89 (random)
    [00:00:21.225,158] <inf> Bluetooth_Central: Connecting to device 4: [BT_i2cHub]...
    [00:00:21.422,454] <inf> Bluetooth_Central: Central MTU Updated for CA:08:57:92:2B:89 (random): TX: 23 RX: 23 bytes
    [00:00:21.422,546] <inf> Bluetooth_Central: Connected with supervision timeout: 500 ms
    [00:00:21.422,546] <inf> Bluetooth_Central: Connected
    [00:00:21.422,546] <inf> Main: Connected to peripheral device
    [00:00:21.469,573] <inf> Bluetooth_Central: Central MTU Updated for CA:08:57:92:2B:89 (random): TX: 247 RX: 247 bytes
    [00:00:21.703,735] <inf> Bluetooth_Central: Security changed: level 2
    [00:00:21.735,321] <inf> Bluetooth_Central: Saved name 'BT_i2cHub' for bonded device CA:08:57:92:2B:89 (random)
    [00:00:21.761,322] <inf> Bluetooth_Central: Connection parameters updated: interval 7.50 ms, latency 1, timeout 500 ms
    [00:00:21.858,551] <inf> Bluetooth_Central: PHY updated: TX PHY 2M, RX PHY 2M
    [00:00:21.896,331] <inf> Bluetooth_Central: Discovery phase complete
    [00:00:21.926,422] <inf> Bluetooth_Central: Found target characteristic - handle: 17, value handle: 18
    [00:00:21.926,452] <inf> Bluetooth_Central: Starting CCC discovery from handle 19 to 28 (looking for UUID 0x2902)
    [00:00:21.941,406] <inf> Bluetooth_Central: Found descriptor at handle 19 with UUID 2902
    [00:00:21.941,406] <inf> Bluetooth_Central: Found CCC descriptor
    [00:00:21.956,329] <inf> Bluetooth_Central: CCC Discovery completed successfully
    [00:00:21.956,359] <inf> Bluetooth_Central: Enabling notifications (value handle: 18, ccc handle: 19)
    [00:00:21.956,420] <inf> Bluetooth_Central: Successfully subscribed to notifications
    [00:00:21.956,512] <inf> Bluetooth_Central: Sent sensor info request to 'BT_i2cHub', timestamp: 21956
    [00:00:21.956,542] <inf> Bluetooth_Central: Automatically sent sensor info request
    [00:00:21.956,542] <inf> Bluetooth_Central: Notifications enabled successfully
    [00:00:22.176,025] <inf> Bluetooth_Central: Last second - Stream packets: 0, Other packets: 1
    [00:00:22.176,086] <inf> Bluetooth_Central: Received device information:
    [00:00:22.176,116] <inf> Bluetooth_Central:   Controller: BT_i2cHub
    [00:00:22.176,147] <inf> Bluetooth_Central:   Address: CA:08:57:92:2B:8
    [00:00:22.176,147] <inf> Bluetooth_Central:   Type: 0x1010
    [00:00:22.176,147] <inf> Bluetooth_Central:   Firmware: 1.00
    [00:00:22.176,177] <inf> Bluetooth_Central:   Battery: 100.0%
    [00:00:22.176,177] <inf> Bluetooth_Central:   Status: 0x01
    [00:00:22.176,177] <inf> Bluetooth_Central:   Number of sensors: 3
    [00:00:22.176,177] <inf> Bluetooth_Central: 
    Sensor Instance 1:
    [00:00:22.176,208] <inf> Bluetooth_Central:   Peripheral Instance ID: 1
    [00:00:22.176,239] <inf> Bluetooth_Central:   Connected: Yes
    [00:00:22.176,239] <inf> Bluetooth_Central:   Sensor Type: 0x0001
    [00:00:22.176,239] <inf> Bluetooth_Central:   Reading Size: 2
    [00:00:22.176,239] <inf> Bluetooth_Central:   Data Rate: 100 Hz
    [00:00:22.176,269] <inf> Bluetooth_Central:   Last Reading: 0.00
    [00:00:22.176,269] <inf> Bluetooth_Central:   Last Update: 22
    [00:00:22.176,269] <inf> Bluetooth_Central: 
    Sensor Instance 2:
    [00:00:22.176,300] <inf> Bluetooth_Central:   Peripheral Instance ID: 2
    [00:00:22.176,300] <inf> Bluetooth_Central:   Connected: Yes
    [00:00:22.176,300] <inf> Bluetooth_Central:   Sensor Type: 0x0002
    [00:00:22.176,330] <inf> Bluetooth_Central:   Reading Size: 1
    [00:00:22.176,330] <inf> Bluetooth_Central:   Data Rate: 50 Hz
    [00:00:22.176,330] <inf> Bluetooth_Central:   Last Reading: 0.00
    [00:00:22.176,361] <inf> Bluetooth_Central:   Last Update: 22
    [00:00:22.176,361] <inf> Bluetooth_Central: 
    Sensor Instance 3:
    [00:00:22.176,361] <inf> Bluetooth_Central:   Peripheral Instance ID: 3
    [00:00:22.176,391] <inf> Bluetooth_Central:   Connected: Yes
    [00:00:22.176,391] <inf> Bluetooth_Central:   Sensor Type: 0x0003
    [00:00:22.176,391] <inf> Bluetooth_Central:   Reading Size: 2
    [00:00:22.176,422] <inf> Bluetooth_Central:   Data Rate: 25 Hz
    [00:00:22.176,422] <inf> Bluetooth_Central:   Last Reading: 0.00
    [00:00:22.176,422] <inf> Bluetooth_Central:   Last Update: 22
    ble_central:~$ 
    ---- Sent utf8 encoded message: "bt stream BT_i2cHub on\n" ----
    bt stream BT_i2cHub on
    Data stream request sent successfully
    [00:00:43.991,973] <inf> Bluetooth_Central: Sent data stream request to 'BT_i2cHub' for 3 sensors
    [00:00:43.992,004] <inf> Bluetooth_Central: Sensor 0: ID=1, Type=0x0001, Rate=100Hz
    [00:00:43.992,004] <inf> Bluetooth_Central: Sensor 1: ID=2, Type=0x0002, Rate=50Hz
    [00:00:43.992,034] <inf> Bluetooth_Central: Sensor 2: ID=3, Type=0x0003, Rate=25Hz
    [00:00:44.143,127] <inf> Bluetooth_Central: Last second - Stream packets: 1, Other packets: 0
    [00:00:44.143,157] <inf> Bluetooth_Central: Sensor 1 reading: 102.00, time: 90
    [00:00:44.143,157] <inf> Bluetooth_Central: Sensor 2 reading: 51.00, time: 90
    [00:00:44.143,157] <inf> Bluetooth_Central: Sensor 3 reading: -102.00, time: 90
    [00:00:45.148,132] <inf> Bluetooth_Central: Last second - Stream packets: 114, Other packets: 0
    [00:00:46.153,167] <inf> Bluetooth_Central: Last second - Stream packets: 119, Other packets: 0
    [00:00:47.158,111] <inf> Bluetooth_Central: Last second - Stream packets: 119, Other packets: 0
    [00:00:48.178,131] <inf> Bluetooth_Central: Last second - Stream packets: 120, Other packets: 0
    [00:00:49.003,143] <inf> Bluetooth_Central: Sensor 1 reading: 51.00, time: 94
    [00:00:49.003,143] <inf> Bluetooth_Central: Sensor 2 reading: 0.00, time: 94
    [00:00:49.003,173] <inf> Bluetooth_Central: Sensor 3 reading: 51.00, time: 94
    [00:00:49.198,120] <inf> Bluetooth_Central: Last second - Stream packets: 117, Other packets: 0
    [00:00:50.218,139] <inf> Bluetooth_Central: Last second - Stream packets: 120, Other packets: 0
    ble_central:~$ 


    my build Config:



  • It's started intermittently working on my end now too 

    any chance you could run it few more time to make sure 

  • Hi,

    I tested some more times now, but still don't see the issue with missing disconnected event (I do hovere sometimes see a fault in BT RX WQ thread after connection which I also saw yesterday.

    [00:01:57.255,279] <err> os: ***** BUS FAULT *****
    [00:01:57.255,279] <err> os:   Precise data bus error
    [00:01:57.255,279] <err> os:   BFAR Address: 0x0
    [00:01:57.255,310] <err> os: r0/a1:  0x00000000  r1/a2:  0x00000014  r2/a3:  0x00000013
    [00:01:57.255,310] <err> os: r3/a4:  0x01010002 r12/ip:  0x0000000e r14/lr:  0x00036bd9
    [00:01:57.255,340] <err> os:  xpsr:  0x21000000
    [00:01:57.255,340] <err> os: s[ 0]:  0x00000020  s[ 1]:  0x00041471  s[ 2]:  0x20009420  s[ 3]:  0x0004159d
    [00:01:57.255,371] <err> os: s[ 4]:  0x00000001  s[ 5]:  0x00036993  s[ 6]:  0x00000000  s[ 7]:  0x0002dbcd
    [00:01:57.255,371] <err> os: s[ 8]:  0x0002db75  s[ 9]:  0x00000000  s[10]:  0x000410f7  s[11]:  0x2000e1f0
    [00:01:57.255,371] <err> os: s[12]:  0x00000000  s[13]:  0x0002fcad  s[14]:  0x200120e8  s[15]:  0x0003f683
    [00:01:57.255,401] <err> os: fpscr:  0x0000002a
    [00:01:57.255,401] <err> os: Faulting instruction address (r15/pc): 0x000127e6
    [00:01:57.255,432] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0
    [00:01:57.255,462] <err> os: Current thread: 0x2000bb68 (BT RX WQ)
    [00:01:57.639,190] <err> os: Halting system

    With addr2line I see it is in Bluetooth_Central/src/bluetooth.c:674, your notify_func().

    This is a separate issue from what you are describing though, but maybe it could be related to some of the many log related warnings you get when building the project, so I suggest cleaning up the logging and making sure the project builds without warnings.

Reply
  • Hi,

    I tested some more times now, but still don't see the issue with missing disconnected event (I do hovere sometimes see a fault in BT RX WQ thread after connection which I also saw yesterday.

    [00:01:57.255,279] <err> os: ***** BUS FAULT *****
    [00:01:57.255,279] <err> os:   Precise data bus error
    [00:01:57.255,279] <err> os:   BFAR Address: 0x0
    [00:01:57.255,310] <err> os: r0/a1:  0x00000000  r1/a2:  0x00000014  r2/a3:  0x00000013
    [00:01:57.255,310] <err> os: r3/a4:  0x01010002 r12/ip:  0x0000000e r14/lr:  0x00036bd9
    [00:01:57.255,340] <err> os:  xpsr:  0x21000000
    [00:01:57.255,340] <err> os: s[ 0]:  0x00000020  s[ 1]:  0x00041471  s[ 2]:  0x20009420  s[ 3]:  0x0004159d
    [00:01:57.255,371] <err> os: s[ 4]:  0x00000001  s[ 5]:  0x00036993  s[ 6]:  0x00000000  s[ 7]:  0x0002dbcd
    [00:01:57.255,371] <err> os: s[ 8]:  0x0002db75  s[ 9]:  0x00000000  s[10]:  0x000410f7  s[11]:  0x2000e1f0
    [00:01:57.255,371] <err> os: s[12]:  0x00000000  s[13]:  0x0002fcad  s[14]:  0x200120e8  s[15]:  0x0003f683
    [00:01:57.255,401] <err> os: fpscr:  0x0000002a
    [00:01:57.255,401] <err> os: Faulting instruction address (r15/pc): 0x000127e6
    [00:01:57.255,432] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0
    [00:01:57.255,462] <err> os: Current thread: 0x2000bb68 (BT RX WQ)
    [00:01:57.639,190] <err> os: Halting system

    With addr2line I see it is in Bluetooth_Central/src/bluetooth.c:674, your notify_func().

    This is a separate issue from what you are describing though, but maybe it could be related to some of the many log related warnings you get when building the project, so I suggest cleaning up the logging and making sure the project builds without warnings.

Children
  • Hi Einar,

    I have removed all the build errors and pushed to the git repo.

    I now don't even get it to intermittently work!

    I have also never seen that fault occurs after connection which is strange

    I do get these 3 problems:

  • Hi,

    I see the same behaviour as before when I check out your updated code. Typically I am able to connect, start streaming and reset the peripheral and re-connect 3 times. After that I get a fault. Interestingly, if I do changes the fault moves around (as seen with addr2line on the faulting address). This erratic behaviour indicate a memory corruption issue to me (perhaps writing to invalid memory by corrupt pointers, writing out of bound to arrays, or similar), but I have not found the root cause of it.

  • Would this explain why I’m not seeing supervision timeout though? 
    Or why slowing down the process down by enabling log minimal + att debug would enable it to work correctly? 

    I’m also still confused why I don’t see supervision timeout but you do! 

  • Yese, it is odd that I never reproduce the same behaviour on my end. But if there are memory corruption issues (which is just a hunch for now, but I have no better suggestion at the moment), it can manifest itself in many different ways. And even if buildign teh same project but with different toolchain or platform, you will typically see different behaviours (if for instance there is an array or buffer being written out of bonds, and whatever is next to it in RAM chagne, the behaviour will change).

Related