What is the maximum values for Central and Pehripheral link counts in Dual Mode

Hi, 

I've been trying to figure out how to configure a nRF52832 device using SDK 15.2 and S132 to act as both a central and peripheral device for a relay device. In looking at the sdk_config.h, it looks like it has the ability to set the maximum link counts for peripheral and central links to more than one for both (up to 20). Can we have multiple peripherals connected to a relay board i.e. device in central mode and multiple central mode devices i.e. phones/tablets connected to this relay acting as a peripheral mode? In other words the relay device connected to many peripherals and many central devices simultaneously. 

// <o> NRF_SDH_BLE_PERIPHERAL_LINK_COUNT - Maximum number of peripheral links. 
#ifndef NRF_SDH_BLE_PERIPHERAL_LINK_COUNT
#define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 0
#endif

// <o> NRF_SDH_BLE_CENTRAL_LINK_COUNT - Maximum number of central links. 
#ifndef NRF_SDH_BLE_CENTRAL_LINK_COUNT
#define NRF_SDH_BLE_CENTRAL_LINK_COUNT 1
#endif

// <o> NRF_SDH_BLE_TOTAL_LINK_COUNT - Total link count. 
// <i> Maximum number of total concurrent connections using the default configuration.

#ifndef NRF_SDH_BLE_TOTAL_LINK_COUNT
#define NRF_SDH_BLE_TOTAL_LINK_COUNT 1
#endif

Thanks!

  • Yes, this is possible. The S132 SoftDevice supports up to 20 concurrent connections, and the connections can be any combination of centrals and peripherals. Take a look at the BLE Relay Example, which shows how to combine a central and a peripheral into one application.

    Best regards,

    Simon

  • If this is the case, why would I get an error (hitting NRF_BREAKPOINT_COND) when I modify the sdk_config.h to support this (versus previously I had the central link count at 1, peripheral at 2 and my program based on hrs_rscs_relay example worked fine)?  Is there some other settings that I need to utilize/change? I.e. see below for failed code.

    // <o> NRF_SDH_BLE_PERIPHERAL_LINK_COUNT - Maximum number of peripheral links.
    #ifndef NRF_SDH_BLE_PERIPHERAL_LINK_COUNT
    #define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 2
    #endif
    
    // <o> NRF_SDH_BLE_CENTRAL_LINK_COUNT - Maximum number of central links.
    #ifndef NRF_SDH_BLE_CENTRAL_LINK_COUNT
    #define NRF_SDH_BLE_CENTRAL_LINK_COUNT 2
    #endif
    
    // <o> NRF_SDH_BLE_TOTAL_LINK_COUNT - Total link count.
    // <i> Maximum number of total concurrent connections using the default configuration.
    
    #ifndef NRF_SDH_BLE_TOTAL_LINK_COUNT
    #define NRF_SDH_BLE_TOTAL_LINK_COUNT 4

    This is the only thing I changed from (this setting worked): 

    // <o> NRF_SDH_BLE_PERIPHERAL_LINK_COUNT - Maximum number of peripheral links.
    #ifndef NRF_SDH_BLE_PERIPHERAL_LINK_COUNT
    #define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 2
    #endif
    
    // <o> NRF_SDH_BLE_CENTRAL_LINK_COUNT - Maximum number of central links.
    #ifndef NRF_SDH_BLE_CENTRAL_LINK_COUNT
    #define NRF_SDH_BLE_CENTRAL_LINK_COUNT 1
    #endif
    
    // <o> NRF_SDH_BLE_TOTAL_LINK_COUNT - Total link count.
    // <i> Maximum number of total concurrent connections using the default configuration.
    
    #ifndef NRF_SDH_BLE_TOTAL_LINK_COUNT
    #define NRF_SDH_BLE_TOTAL_LINK_COUNT 3

  • Have you allocated enough memory for the extra link you have added? If you enable logging you will get more information about why the error happens, and what the start RAM location should be. E.g. when I increased the peripheral link and the total link count by 1 in the ble_app_rcsc_relay example, I got the following error message:

    <warning> nrf_sdh_ble: Insufficient RAM allocated for the SoftDevice.
    <warning> nrf_sdh_ble: Change the RAM start location from 0x20002D58 to 0x20003470.
    <warning> nrf_sdh_ble: Maximum RAM size for application is 0xCB90.
    <error> nrf_sdh_ble: sd_ble_enable() returned NRF_ERROR_NO_MEM.
    <error> app: Fatal error
    

    Take a look at this tutorial of how to adjust the RAM start address.

    Best regards,

    Simon

  • Sorry for the delay. I'm going back and closing old threads of mine. If I remember right this was the problem. Reallocation fixed it, but if I remember right I needed to enable some of the NRF_DEBUG_LOG settings to see these printouts. 

    Thanks again!

Related