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

SDK14 NUS Multilink issue

Dear lovely people!

Setup: sdk14 / s132 v5 / nrf52832

Just like with the previous SDKs, I tried to make a multilink nus central fw. The periph device runs my code based on the ble_app_uart example, the central device runs my code based on the ble_app_uart_c example modified according to the multilink example.

What I'm experiencing is that "ble_nus_c_tx_notif_enable" is called more than once from the evt handler and returns NRF_ERROR_BUSY after the 2nd time. Code snippet:

image description

Log:

image description

I found that BLE_NUS_C_EVT_DISCOVERY_COMPLETE event occurrences has some correlation with the number of db_disc instances: BLE_DB_DISCOVERY_ARRAY_DEF(m_db_disc, 3);

What I did:

  • Added BLE_NUS_C_ARRAY_DEF just like it is done in the LBS header.
  • nus init is done in a loop: err_code = ble_nus_c_init(&m_ble_nus_c[i], &nus_c_init_t);
  • nus event handling: ble_nus_c_on_db_disc_evt(&m_ble_nus_c[p_evt->conn_handle], p_evt);

So the question is, is it an issue that ble_nus_c_tx_notifc is called many times or can I just comment out the APP_ERROR_CHECK macro since the first call succeeded? As I remember in previous SDKs this nus handler has been called only once.

Any help and comment is much appreciated! (An example code for multilink nus central would be absolutely fantastic (just like the ones you can find for previous SDKs here on the forum)).

I think this forum post refers to the same problem as I'm having: link

Adam

Parents
  • I tried your project. I believe you get into trouble because of

    BLE_DB_DISCOVERY_ARRAY_DEF(m_db_disc, NRF_SDH_BLE_CENTRAL_LINK_COUNT);
    

    I would try with just

    BLE_DB_DISCOVERY_DEF(m_db_disc);
    

    I don't think you need so many ble_db_discovery_t instances, at least not if you are connecting and doing service discovery with one peripheral at the time, which I recommend you do first. I see that it is done that way in the multilink example, but I'm not convinced it is necessary.

    I will try to look into this a bit further, but this is what I got for now.

Reply
  • I tried your project. I believe you get into trouble because of

    BLE_DB_DISCOVERY_ARRAY_DEF(m_db_disc, NRF_SDH_BLE_CENTRAL_LINK_COUNT);
    

    I would try with just

    BLE_DB_DISCOVERY_DEF(m_db_disc);
    

    I don't think you need so many ble_db_discovery_t instances, at least not if you are connecting and doing service discovery with one peripheral at the time, which I recommend you do first. I see that it is done that way in the multilink example, but I'm not convinced it is necessary.

    I will try to look into this a bit further, but this is what I got for now.

Children
Related