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

cccd enables to report errors

Hi,

I'd like to set up cccd here, but test the error,


In the routine

nRF5_SDK_15.3.0_59ac345 nRF5_SDK_15.3.0_59ac345.0_59ac345.s.ble_peripheral?ble_app_uart/pca10040-s132-arm5_no_packs-ble_app_uart_pca10040_s132.uvprojx

How do I make a cccd in ?

Kind regards. Peter.Min

Parents
  • 1.APP_ERROR_CHECK(err_code); err_code = 0x3401(= 13313)The corresponding function is:

    err_code = ble_nus_data_send(&m_nus, data_array, &length, m_conn_handle);

    2.

    The notification code function is enabled for:
    static void on_write (ble_nus_t s p_nus, ble_evt_t const s p_ble_evt)

    The criteria for judging are:
    else if (p_evt_write-handle- s-p_nus-rx_handles.value_handle)
    (p_nus-data_handler!

    The enable method is:
    p_client-is_notification_enabled -true;

    3.This event was not handled:
    BLE_GATTS_EVT_SYS_ATTR_MISSING

    This event sdk defaults to:
    case BLE_GATTS_EVT_SYS_ATTR_MISSING:
    No system attributes have had has stored.
    err_code s sd_ble_gatts_sys_attr_set (m_conn_handle, NULL, 0, 0);
    APP_ERROR_CHECK (err_code);
    break;

    4.

    ble_evt_handler as follows

    /**@brief Function for handling BLE events.
     *
     * @param[in]   p_ble_evt   Bluetooth stack event.
     * @param[in]   p_context   Unused.
     */
    static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
    {
        uint32_t err_code;
    
        switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
                NRF_LOG_INFO("Connected");
                err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
                APP_ERROR_CHECK(err_code);
                m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
                err_code = nrf_ble_qwr_conn_handle_assign(&m_qwr, m_conn_handle);
                APP_ERROR_CHECK(err_code);
                break;
    
            case BLE_GAP_EVT_DISCONNECTED:
                NRF_LOG_INFO("Disconnected");
                // LED indication will be changed when advertising starts.
                m_conn_handle = BLE_CONN_HANDLE_INVALID;
                break;
    
            case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
            {
                NRF_LOG_DEBUG("PHY update request.");
                ble_gap_phys_t const phys =
                {
                    .rx_phys = BLE_GAP_PHY_AUTO,
                    .tx_phys = BLE_GAP_PHY_AUTO,
                };
                err_code = sd_ble_gap_phy_update(p_ble_evt->evt.gap_evt.conn_handle, &phys);
                APP_ERROR_CHECK(err_code);
            } break;
    
            case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
                // Pairing not supported
                err_code = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
                APP_ERROR_CHECK(err_code);
                break;
    
            case BLE_GATTS_EVT_SYS_ATTR_MISSING:
                // No system attributes have been stored.
                err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);
                APP_ERROR_CHECK(err_code);
                break;
    
            case BLE_GATTC_EVT_TIMEOUT:
                // Disconnect on GATT Client timeout event.
                err_code = sd_ble_gap_disconnect(p_ble_evt->evt.gattc_evt.conn_handle,
                                                 BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
                APP_ERROR_CHECK(err_code);
                break;
    
            case BLE_GATTS_EVT_TIMEOUT:
                // Disconnect on GATT Server timeout event.
                err_code = sd_ble_gap_disconnect(p_ble_evt->evt.gatts_evt.conn_handle,
                                                 BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
                APP_ERROR_CHECK(err_code);
                break;
    
            default:
                // No implementation needed.
                break;
        }
    }

    5.


    1. In order to enable cccd in nrf52532, I modified the routine:
    Project.nRF5_SDK_15.nRF5_SDK_15.0_59ac345?ble_peripheral?ble_app_uart?pca10040?s132-arm5_no_packs ble_app_uart_pca10040_s132.uvprojx

    2. In the ble_app_uart routine I made the following modifications:

    6.

    Although I know that forced enable CCDCs in ble_peripheral do not meet the Bluetooth specification,
    But I still want to force the ability to make a cccd ble_peripheral here.

    My previously modified code does nuns that do not enforce the ability to make CCCD.

    Please help me complete an example that can be forced to enable CCCD.

  • peter.min said:
    Although I know that forced enable CCDCs in ble_peripheral do not meet the Bluetooth specification,
    But I still want to force the ability to make a cccd ble_peripheral here.

     Sorry. It doesn't work this way. The actual CCCD is stored in the softdevice, and you can't force it. The one that you try to force is just a copy of that flag which is used for the application layer logic. No way to force it from the peripheral.

    You need to enable notifications from your central application.

Reply
  • peter.min said:
    Although I know that forced enable CCDCs in ble_peripheral do not meet the Bluetooth specification,
    But I still want to force the ability to make a cccd ble_peripheral here.

     Sorry. It doesn't work this way. The actual CCCD is stored in the softdevice, and you can't force it. The one that you try to force is just a copy of that flag which is used for the application layer logic. No way to force it from the peripheral.

    You need to enable notifications from your central application.

Children
No Data
Related