I agree with the suggested improvements.

  

It is indeed not trivial to configure all this settings. Based on the value
set for NIMBLE_OPT_MAX_CONNECTIONS, the default config should be set
accordingly.

  

Back to my issue, I'm still getting the same error.

Here's the complete config in my code:

  

    /* Configure the host. */  
   cfg = ble_hs_cfg_dflt;  
   cfg.max_hci_bufs = 16;  
   // cfg.max_connections = MAX_CONNECTIONS*3;  
   // cfg.max_gattc_procs = 5;  
   cfg.max_l2cap_chans = cfg.max_connections * 3;  
   // cfg.max_l2cap_sig_procs = 1;  
   // cfg.sm_bonding = 1;  
   // cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC;  
   // cfg.sm_their_key_dist = BLE_SM_PAIR_KEY_DIST_ENC;  
   // cfg.store_read_cb = ble_store_ram_read;  
   // cfg.store_write_cb = ble_store_ram_write;  
  
   /* Populate config with the required GATT server settings. */  
   // cfg.max_attrs = 0;  
   // cfg.max_services = 0;  
   // cfg.max_client_configs = 0;  

  

  

I commented most of them after reading your email. I've tried with and without
all of them set (from blecent).

  

  

\--

**Marco Ferreira**

Founder / CTO

[email protected]

  

[www.altitude.co](https://link.nylas.com/link/d8alirm8yqo9t58fef8uienha/local-
ea12fa39-96b7/0?redirect=http%3A%2F%2Fwww.altitude.co%2F&r=ZGV2QG15bmV3dC5pbmN1YmF0b3IuYXBhY2hlLm9yZw==)
  

  

DISCLAIMER: The information contained in this e-mail is confidential and may
be legally privileged. If the reader of this message is not the intended
recipient you are hereby notified that any use, dissemination, distribution,
or reproduction of this message is prohibited. If you have received this
message in error please forward this message to
[[email protected]](mailto:[email protected]) and delete all copies of this
message.

  

![](https://link.nylas.com/open/d8alirm8yqo9t58fef8uienha/local-
ea12fa39-96b7?r=ZGV2QG15bmV3dC5pbmN1YmF0b3IuYXBhY2hlLm9yZw==)

On Jul 23 2016, at 2:26 pm, Christopher Collins <[email protected]>
wrote:  

> On Sat, Jul 23, 2016 at 09:11:43AM +0000, Marco Ferreira wrote:  
> > Hi all,  
> >  
> > While my Central is trying to connect to the second peripheral, it
fails with  
> > reason BLE_HS_ENOMEM (6).

>

> Is this error code returned by ble_gap_connect()? If so, one of the  
> following settings is too low:

>

>     * cfg.max_connections  
>     * cfg.max_l2cap_chans  
>     * cfg.max_client_configs

>

> Just a wild guess, but I would bet the problem is too few l2cap  
> channels. I think pretty much everyone agrees that getting the host  
> configuration right is too difficult, so this is something that will  
> need to be improved (more about this below). In the meantime, the  
> following code should ensure sufficient resources:

>

>     cfg = ble_hs_cfg_dflt;  
>     cfg.max_l2cap_chans = cfg.max_connections * 3;

>

> cfg.max_connections gets properly assigned NIMBLE_OPT_MAX_CONNECTIONS by  
> by the first line (cfg = ble_hs_cfg_dflt).

>

> cfg.max_l2cap_chans must always be greater than or equal to three times  
> the number of connections.

>

> cfg.max_client_configs gets populated automatically when the various  
> GATT services are initialized (e.g., ble_svc_gap_init()), so you  
> probably don't need to do anything different there.

>

> Regarding future improvements to the host- I can think of a few easy  
> ones, listed below. If anyone has any other ideas, please feel free to post
them to  
> the list.

>

> 1\. ble_hs_cfg_dflt should contain the correct value for max_l2cap_chans.  
> Currently it is initialized with the arbitrary value of 16.

>

> 2\. When something fails due to resource shortage, a specific diagnostic  
> should get printed to the debug log.

>

> Thanks,  
> Chris

Reply via email to