a bt_gatt_dm error

based on SDK v2.9.0

1 Central, 4 Peripherals, Repeat the following:

Power off  3 Peripherals, wait a while, power on 3 Peripherals.  

The following error usually occurs on central when reconnecting.

[02:04:16.465,545] <err> bt_gatt_dm: Discover failed, error: -12.
[02:04:16.465,606] <wrn> blea: Discovery start failed: 89:59:78:89:55:78 (public) index 4 uindex 0 err -12
ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:430
  Controller unresponsive, command opcode 0x0406 timeout with err -11
[02:04:26.465,820] <err> os: r0/a1:  0x00000003  r1/a2:  0x00000002  r2/a3:  0x00000001
[02:04:26.465,850] <err> os: r3/a4:  0x00000003 r12/ip:  0x00000004 r14/lr:  0x0003ef23
[02:04:26.465,850] <err> os:  xpsr:  0x01000000
[02:04:26.465,850] <err> os: Faulting instruction address (r15/pc): 0x0003ef32
[02:04:26.465,911] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
[02:04:26.465,942] <err> os: Current thread: 0x2001b680 (sysworkq)
[02:04:26.696,350] <err> os: Halting system

Where can I find an explanation of the error code(-12).

Parents Reply Children
  • Hi,

    Yes, I've increased my CONFIG_HEAP_MEM_POOL_SIZE and CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE by more than 50% and still have this issue.

    00> [00:11:48.919,128] <err> bt_gatt_dm: Discover failed, error: -12.
    00> [00:11:48.919,158] <err> bt_gatt_dm: alloced_bytes 8912, free_bytes 6136, max_allocated_bytes 9256
    00> [00:11:48.919,219] <wrn> blea: Discovery start failed: 89:59:78:89:55:7A (public) index 4 uindex 0 err -12
    00> ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:430
    00> Controller unresponsive, command opcode 0x0406 timeout with err -11
    00> [00:11:58.919,433] <err> os: r0/a1: 0x00000003 r1/a2: 0x00000002 r2/a3: 0x00000001
    00> [00:11:58.919,433] <err> os: r3/a4: 0x00000003 r12/ip: 0x00000004 r14/lr: 0x0003f083
    00> [00:11:58.919,433] <err> os: xpsr: 0x01000000
    00> [00:11:58.919,464] <err> os: Faulting instruction address (r15/pc): 0x0003f092
    00> [00:11:58.919,494] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
    00> [00:11:58.919,525] <err> os: Current thread: 0x2001b680 (sysworkq)
    00> [00:11:59.150,421] <err> os: Halting system

    Regards,
    Leo Mo

  • Hi, 

    Leo Mo said:
    00> [00:11:48.919,128] <err> bt_gatt_dm: Discover failed, error: -12.

    I think the error message is from this line https://github.com/nrfconnect/sdk-nrf/blob/v2.9.1/subsys/bluetooth/gatt_dm.c#L682-L684  

    You could try to adjust CONFIG_BT_ATT_TX_COUNT.

    See description of bt_gatt_discover():

    GATT Discover function.

    This procedure is used by a client to discover attributes on a server.

    Primary Service Discovery: Procedure allows to discover primary services either by Discover All Primary Services or Discover Primary Services by Service UUID. Include Service Discovery: Procedure allows to discover all Include Services within specified range. Characteristic Discovery: Procedure allows to discover all characteristics within specified handle range as well as discover characteristics with specified UUID. Descriptors Discovery: Procedure allows to discover all characteristic descriptors within specified range.

    For each attribute found the callback is called which can then decide whether to continue discovering or stop.

    The Response comes in callback params->func. The callback is run from the BT RX thread. params must remain valid until start of callback where iter attr is NULL or callback will return BT_GATT_ITER_STOP.

    This function will block while the ATT request queue is full, except when called from the BT RX thread, as this would cause a deadlock.

    Parameters
    conn Connection object.
    params Discover parameters.

    Return values
    0 Successfully queued request. Will call params->func on resolution.
    -ENOMEM ATT request queue is full and blocking would cause deadlock. Allow a pending request to resolve before retrying, or call this function outside the BT RX thread to get blocking behavior. Queue size is controlled by
    CONFIG_BT_ATT_TX_COUNT 
    .

    -Amanda H.

  • Hi,

    It worked fine. Thank you!

    Regards,

    Leo Mo.

Related