ble_nus_central sample does not discover

Hello, we want to evaluate the BLE ISP2454-LX chip.

To do this we bought from RUTRONIK FRANCE an ISP2454-LX-EB evaluation board with the ISP2454-LX-TB test board.

SDK : nRF Connect SDK Bare Metal v2.0.0

Tool Chain : nRF Connect SDK Toolchain v3.3.0

Softdevice : bm_nrf54l15dk/nrf54l15/cpuapp/s145_softdevice

We want to evaluate the nus central capability.

Application ble_nus central. starts :

We want to detect a hardware device with nRF52832 stack. But the device is not discovered.

This hardware device is correcty detected in a nRF52832 environnement.

Project configuration :

CONFIG_LOG=y
CONFIG_LOG_BACKEND_BM_UARTE=y

CONFIG_SOFTDEVICE=y
CONFIG_NRF_SDH_BLE_TOTAL_LINK_COUNT=2
CONFIG_NRF_SDH_BLE_CENTRAL_LINK_COUNT=1

CONFIG_BM_BUTTONS=y
CONFIG_BM_GPIOTE=y
CONFIG_BM_TIMER=y

# Enable RNG
CONFIG_NRF_SECURITY=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
CONFIG_PSA_WANT_GENERATE_RANDOM=y

# BLE NUS client
CONFIG_BLE_NUS_CLIENT=y

# BLE connection parameter
CONFIG_BLE_CONN_PARAMS=y

# BLE database discovery
CONFIG_BLE_DB_DISCOVERY=y
CONFIG_BLE_GATT_QUEUE=y

# BLE scan
CONFIG_BLE_SCAN=y
CONFIG_BLE_SCAN_UUID_COUNT=2
CONFIG_BLE_SCAN_ADDRESS_COUNT=1
CONFIG_BLE_SCAN_NAME_COUNT=2
CONFIG_NRF_SDH_BLE_VS_UUID_COUNT=2
CONFIG_BLE_ADV=y
In Kconfig I made this changes :
config SAMPLE_USE_TARGET_PERIPHERAL_NAME
    bool "Use target peripheral name"
    default n
config SAMPLE_USE_TARGET_PERIPHERAL_ADDR
    bool "Use target peripheral address"
    default n

The device is still not discovered.

So, what can be the problem ? Why the nRF54L15 stack does discover nothing ?

Thanks.
Best Regards.
Andre MULLER
Parents
  • Hi, 

    The sample seems to a bug in its UUID scan filter that is exactly what you are hitting. In ble_nus_central/src/main.c, the filter is registered as:

    .uuid = {.uuid = BLE_UUID_NUS_SERVICE, .type = BLE_UUID_TYPE_BLE}
    

    BLE_UUID_TYPE_BLE is the 16-bit SIG UUID type, but the Nordic UART Service is a 128-bit vendor-specific UUID (6E400001-B5A3-F393-E0A9-E50E24DCCA9E). With this type, the scanner looks for a 16-bit UUID 0x0001 in AD types, which no NUS peripheral ever advertises. So the UUID filter never matches. 

    It seem to appear to work out of the box only because the sample also enables a name filter for "nRF_BM_NUS" with OR logic, and the matching nrf-bm peripheral happens to advertise that exact name. As soon as you set SAMPLE_USE_TARGET_PERIPHERAL_NAME=n (as you did, to target your own device), the only remaining filter is the broken UUID one, and nothing is ever discovered.

    Try the fix in ble_nus_central/src/main.c to use the vendor UUID type registered by the NUS client:

    const struct ble_scan_filter_data uuid_filter = {
        .uuid_filter = {.uuid = {.uuid = BLE_UUID_NUS_SERVICE,
                                 .type = ble_nus_client.uuid_type}}};   // <<- use the client uuid type instead of hardcoding it.
    

    ble_nus_client.uuid_type is populated by ble_nus_client_init() (which calls sd_ble_uuid_vs_add()), and scan_init() already runs after it in main(), so no ordering change is needed.

    Let me know if that works and then I can create an internal ticket to get that fixed in our sample.

Reply
  • Hi, 

    The sample seems to a bug in its UUID scan filter that is exactly what you are hitting. In ble_nus_central/src/main.c, the filter is registered as:

    .uuid = {.uuid = BLE_UUID_NUS_SERVICE, .type = BLE_UUID_TYPE_BLE}
    

    BLE_UUID_TYPE_BLE is the 16-bit SIG UUID type, but the Nordic UART Service is a 128-bit vendor-specific UUID (6E400001-B5A3-F393-E0A9-E50E24DCCA9E). With this type, the scanner looks for a 16-bit UUID 0x0001 in AD types, which no NUS peripheral ever advertises. So the UUID filter never matches. 

    It seem to appear to work out of the box only because the sample also enables a name filter for "nRF_BM_NUS" with OR logic, and the matching nrf-bm peripheral happens to advertise that exact name. As soon as you set SAMPLE_USE_TARGET_PERIPHERAL_NAME=n (as you did, to target your own device), the only remaining filter is the broken UUID one, and nothing is ever discovered.

    Try the fix in ble_nus_central/src/main.c to use the vendor UUID type registered by the NUS client:

    const struct ble_scan_filter_data uuid_filter = {
        .uuid_filter = {.uuid = {.uuid = BLE_UUID_NUS_SERVICE,
                                 .type = ble_nus_client.uuid_type}}};   // <<- use the client uuid type instead of hardcoding it.
    

    ble_nus_client.uuid_type is populated by ble_nus_client_init() (which calls sd_ble_uuid_vs_add()), and scan_init() already runs after it in main(), so no ordering change is needed.

    Let me know if that works and then I can create an internal ticket to get that fixed in our sample.

Children
No Data
Related