Page 1 of 1

Multiple advertisements out of memory (BLE_ERR_MEM_CAPACITY)

Posted: Tue Sep 17, 2024 8:50 am
by br10101
I am trying to set up multiple advertisements using NimBLE on ESP32-C3 but I receive error 0x207 (BLE_ERR_MEM_CAPACITY) when I set up the third advertising. I have set the following configuration:

CONFIG_BT_NIMBLE_EXT_ADV=y
CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES=4

Using ESP-IDF v5.1.5. The example ble_multi_adv runs fine, but I am using many more resources (GATT server, BLE scanning, wifi, etc..).

Do I need to increase memory somewhere? Any hints?

Re: Multiple advertisements out of memory (BLE_ERR_MEM_CAPACITY)

Posted: Tue Sep 17, 2024 12:31 pm
by br10101
It seems to have to do with the advertising parameters (ble_gap_ext_adv_params).

Is there a limit to the combinations of connectable, scannable, and legacy_pdu combinations?

Re: Multiple advertisements out of memory (BLE_ERR_MEM_CAPACITY)

Posted: Tue Sep 17, 2024 12:36 pm
by irahul
Can you share your sample application or console log to narrow down which function is returning this error. Also, can you share your complete sdkconfig ?

Re: Multiple advertisements out of memory (BLE_ERR_MEM_CAPACITY)

Posted: Tue Sep 17, 2024 1:37 pm
by MicroController
You can try and change the "Memory Settings" for NimBLE via menuconfig, e.g. adding more "blocks" to one or more of the memory pools.

Re: Multiple advertisements out of memory (BLE_ERR_MEM_CAPACITY)

Posted: Wed Sep 18, 2024 8:36 am
by br10101
The function returning the error is ble_gap_ext_adv_start(). I attached the sdkconfig.

Re: Multiple advertisements out of memory (BLE_ERR_MEM_CAPACITY)

Posted: Wed Sep 18, 2024 8:42 am
by br10101
I doubled MSYS_1 Block count from 24 to 48 and MSYS_2 Block count from 32 to 64 without any success

Re: Multiple advertisements out of memory (BLE_ERR_MEM_CAPACITY)

Posted: Wed Sep 18, 2024 12:31 pm
by br10101
I could solve this by setting CONFIG_BT_CTRL_BLE_MAX_ACT=9

I wonder why 9? I would assume I need 7: 4x adv + 1x scan + 1x central + 1x periph