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

multilink [ble_app_uart] - [ble_app_multilink_central]

nRF5_SDK_15.0.0_a53641a,ble_app_uart

When linking [ble_app_uart] and [ble_app_multilink_central], please tell me which settings and functions are missing in the sample program.
Also, when linking [ble_app_uart] and [ble_app_multilink_central], please tell me the method of [ble_app_uart] device discrimination.
Thanking you in advance.
Parents
  • Hi there, not the clearest description of the problem you are having. Please be more specific on your problem so that we may try to help you.

  • [Creating system]
    The AD conversion is performed by four peripheral devices, and AD data of 400 bytes are transmitted to each of the central machines every 100 ms.
    [Current creation status]
    With reference to [ble_app_uart] + [saadc] and [ble_app_uart_c], AD conversion is performed by one peripheral device, and AD data of 400 bytes is transmitted every 100 ms to one central device. It is done up to.
    [Doubt]
    I am trying to make it possible to communicate with four peripherals by comparing [ble_app_uart_c] and [ble_app_multilink_central], but since I can not understand the difference, I can not refer to it.

  • I think you are trying to figure out how to differentiate data that came from different peripherals. For this you have a connection handle that you get when the device gets connected. You can always use this connection handle to map to different connections with your device.

    in our examples you can see this in the below format

    static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
    {
    
        switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
                NRF_LOG_INFO("Connected.");
                conn_handle[i] = p_ble_evt->evt.gap_evt.conn_handle;

  • 1) In [ble_app_uart_c], if you change the setting of sdk_config.h, can you connect with 4 [ble_app_uart] at the same time?
    2) When 4 units of [ble_app_uart] and 1 unit of [ble_app_uart_c] are connected at the same time, will BLE_GAP_EVT_CONNECTED occur on [ble_app_uart_c] side every time communication occurs?
    3) Is it possible to distinguish the equipment by DEVICE_NAME?

  • 1) You need to do some more changes in the main file before enabling the softdevice. The most obvious one is to change your app RAM start as the number of connections affect the softdevice usage of RAM.

    2) yes, you will get BLE_GAP_EVT_CONNECTED four times if you get connected with four different devices. Each will have a different connection handle.

    3) You can do that as this info can be broadcasted in the advertisement/scan response data. After connection you only know peer device address which is another thing you can use to distinguish different peers.

  • An error occurred in the start setting of the application RAM.
    Error "0x04" is occurring at the following location Please tell me how to improve.

    static void ble_stack_init(void)
    {
    ret_code_t err_code;

    /*-< requesting to enable the SoftDevice. >-*/
    err_code = nrf_sdh_enable_request();
    APP_ERROR_CHECK(err_code);

    /*-< Configure the BLE stack using the default settings. >-*/
    uint32_t ram_start = 0;
    err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);
    APP_ERROR_CHECK(err_code);

    /*-< Retrieving the address of the start of application's RAM. >-*/
    err_code = nrf_sdh_ble_app_ram_start_get(&ram_start);
    APP_ERROR_CHECK(err_code);

    /*-< Enable BLE stack.>-*/
    err_code = nrf_sdh_ble_enable(&ram_start);
    APP_ERROR_CHECK(err_code); <--------------------------(err_code = 0x04 error)

    /* Register a handler for BLE events. */
    NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);
    }

    That's all, thank you.
    [Add a question]
    Please tell me how to determine the setting value of IRAM 1.
     
Reply
  • An error occurred in the start setting of the application RAM.
    Error "0x04" is occurring at the following location Please tell me how to improve.

    static void ble_stack_init(void)
    {
    ret_code_t err_code;

    /*-< requesting to enable the SoftDevice. >-*/
    err_code = nrf_sdh_enable_request();
    APP_ERROR_CHECK(err_code);

    /*-< Configure the BLE stack using the default settings. >-*/
    uint32_t ram_start = 0;
    err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);
    APP_ERROR_CHECK(err_code);

    /*-< Retrieving the address of the start of application's RAM. >-*/
    err_code = nrf_sdh_ble_app_ram_start_get(&ram_start);
    APP_ERROR_CHECK(err_code);

    /*-< Enable BLE stack.>-*/
    err_code = nrf_sdh_ble_enable(&ram_start);
    APP_ERROR_CHECK(err_code); <--------------------------(err_code = 0x04 error)

    /* Register a handler for BLE events. */
    NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);
    }

    That's all, thank you.
    [Add a question]
    Please tell me how to determine the setting value of IRAM 1.
     
Children
  • Hi Yokokawa,

    It is hard for me to tell the right address. But if your logs are enabled, then your log will tell you the correct start of the IRAM address to set. Do you have some output logs?

  • I understood the RAM start address. Thank you very much
  • Question on communication settings of the multi-communication center
    1) Connection of the following program Do you operate the peripheral in "(2)"?
    -----------------------------------------------------------------------------------------
    static void on_adv_report(ble_gap_evt_adv_report_t const * p_adv_report)
    {
      ret_code_t err_code;

    //**
    Where to check **///
    (1) if (ble_advdata_name_find(p_adv_report->data.p_data,p_adv_report->data.len, m_target_periph_name)){
    (2) if (ble_advdata_uuid_find(p_adv_report->data.p_data,p_adv_report->data.len,&m_nus_uuid)){
    //** **//

      err_code = sd_ble_gap_connect(&p_adv_report->peer_addr, &m_scan_params, &m_connection_param, APP_BLE_CONN_CFG_TAG);
       if (err_code != NRF_SUCCESS){
        NRF_LOG_ERROR("Connection Request Failed, reason %d", err_code);
       }
      }else{
       err_code = sd_ble_gap_scan_start(NULL, &m_scan_buffer);
       APP_ERROR_CHECK(err_code);
      }
    }
    -----------------------------------------------------------------------------------------
    2) "Function for handling BLE events." Are the following (1) and (2) judgment unnecessary for multi-communication?

    -----------------------------------------------------------------------------------------
    static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
    {

    (1) case BLE_GAP_EVT_TIMEOUT:
      if (p_gap_evt->params.timeout.src == BLE_GAP_TIMEOUT_SRC_SCAN){
       NRF_LOG_INFO("Scan timed out.");
       scan_start();
      }

    (2) case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
      err_code = sd_ble_gap_sec_params_reply(p_ble_evt->evt.gap_evt.conn_handle,

      BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
      APP_ERROR_CHECK(err_code);
      break;
    -----------------------------------------------------------------------------------------

    Thanking you in advance
Related