This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Implementing multilinks on multiroll programs

Hello.
I am now implementing communication to multiple peripheral devices based on the multi-roll project “ble_app_multirole_lesc”. (image1)

Central link after setting memory in previous article (https://devzone.nordicsemi.com/f/nordic-q-a/51784/about-memory-error-of-multiple-communication-in-ble) Changed the value of the count variable.
The next thing to do is
First, commented out "filter_settings_change ()" because it uses the same service.
Second, I came up with the idea of ​​increasing the number of connection handle variables by the number of connections, referring to the sample projects “ble_app_hrs_rscs” and “ble_app_multilink_central”.

Changed the connection handle variable to the following element specification when using it as an array type.

1.
BLE_DB_DISCOVERY_DEF (m_db_disc);
⇒BLE_DB_DISCOVERY_ARRAY_DEF (m_db_discovery, NRF_SDH_BLE_CENTRAL_LINK_COUNT)

2.
static uint16_t m_conn_handle_hrs_c = BLE_CONN_HANDLE_INVALID;
⇒static uint16_t m_conn_handle_hrs_c [NRF_SDH_BLE_CENTRAL_LINK_COUNT] = BLE_CONN_HANDLE_INVALID;

3.
if (m_conn_handle_hrs_c == "XXXXX")
⇒ if (m_conn_handle_hrs_c [current_handle] == "XXXXX")

4.
m_conn_handle_hrs_c = "XXXXX"
⇒m_conn_handle_hrs_c [current_handle] = "XXXXX"

When the build was executed with the above changes, the following error occurred. (image2)


-------------------------------------------------- -----------------------------------------
invalid initializer
in expansion of macro 'BLE_CONN_HANDLE_INVALID'
-------------------------------------------------- ----------------------------------------

The environment is as follows.
SoftDevice: S132
IDE: SES
BLE Device: NRF52832
SDK version: 15.30
peripheral project: ble_peripheral⇒ble_app_hrs
multirole project: experimental⇒ble_app_multirole_lesc


Please tell me what to do. Thank you.

Image1Image2

Parents
  • Hi 

    I assume the problem occurs because you are trying to assign BLE_CONN_HANDLE_INVALID to m_conn_handle_hrs_c after changing it to an array type. 

    Could you try to define m_conn_handle_hrs_c  like this instead?

    static uint16_t m_conn_handle_hrs_c [NRF_SDH_BLE_CENTRAL_LINK_COUNT] = {BLE_CONN_HANDLE_INVALID, BLE_CONN_HANDLE_INVALID};

    Best regards
    Torbjørn

  • Hello ovrebekk.
    Sorry for the late reply.
    Changed according to the advice, no build errors. Thank you!
    However, when trying to execute on the first peripheral device, the following execution error occurred.
    peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Bonding, error: 4352
    Disconnected, reason 8
    Also, at this time, it turned out that the multi-roll project stopped working when transitioning to the “on_ble_central_evt” function.
    What are the possible causes? Thank you.

  • Hi 

    I am sorry for the late reply too. I am currently travelling, so response will be a bit slow...

    I assume you tested this before making the changes to support more links?

    If so it's a bit odd that just adding multilink support should make the application fail.
    You can confirm that this fails even when you try to connect only to a single device?

    Have you double checked the code to make sure that any part of the code that accesses the variables you modified has been updated accordingly?

    Best regards
    Torbjørn

  • Hi ovrebekk.
    Sorry for the late reply.
    Before change (connection of only a single peripheral device in default state) worked correctly.
    Also, I think that the code that refers to the changed code is also supported.
    The evt_id when the operation was stopped on the multi-roll side was in one of the following two states.

    evt_id: 48⇒BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP
    evt_id: 24⇒BLE_GAP_EVT_LESC_DHKEY_REQUEST

    Also, when I checked the situation on the debug screen, I found that it stopped with the following exception.

    Exception name: BusFault
    Assembly code when an exception occurs: ldr r3, [pc, # 4]

    As a result of examining "BusFault", I want to see the fault related to address and memory. What can be considered is an error when referring to the memory of an array that is specified more than once. Please let me know if you have any advice.

Reply
  • Hi ovrebekk.
    Sorry for the late reply.
    Before change (connection of only a single peripheral device in default state) worked correctly.
    Also, I think that the code that refers to the changed code is also supported.
    The evt_id when the operation was stopped on the multi-roll side was in one of the following two states.

    evt_id: 48⇒BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP
    evt_id: 24⇒BLE_GAP_EVT_LESC_DHKEY_REQUEST

    Also, when I checked the situation on the debug screen, I found that it stopped with the following exception.

    Exception name: BusFault
    Assembly code when an exception occurs: ldr r3, [pc, # 4]

    As a result of examining "BusFault", I want to see the fault related to address and memory. What can be considered is an error when referring to the memory of an array that is specified more than once. Please let me know if you have any advice.

Children
Related