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

Hi, i am trying to increase the transfer speed using the UART ove BLE application

I need to increas the speed using the UART ove BLE application.

I try to add new characheristics to the Nordic UART Service.

I have added the UUID for this new charactheristic

#define BLE_UUID_NUS_RX2_CHARACTERISTIC 0x0004               /**< The UUID of the RX Characteristic. */

i have added the handle to the Nodrdic service Service structure

struct ble_nus_s
{
    uint8_t                         uuid_type;          /**< UUID type for Nordic UART Service Base UUID. */
    uint16_t                        service_handle;     /**< Handle of Nordic UART Service (as provided by the SoftDevice). */
    ble_gatts_char_handles_t        tx_handles;         /**< Handles related to the TX characteristic (as provided by the SoftDevice). */
    ble_gatts_char_handles_t        rx_handles;         /**< Handles related to the RX characteristic (as provided by the SoftDevice). */
    ble_gatts_char_handles_t        rx2_handles;         /**< Handles related to the RX2 characteristic (as provided by the SoftDevice). */
      blcm_link_ctx_storage_t * const p_link_ctx_storage; /**< Pointer to link context storage with handles of all current connections and its context. */
    ble_nus_data_handler_t          data_handler;       /**< Event handler to be called for handling received data. */
};

I have added the charactheristic in the ble_nus_init function

    // Add the RX2 Characteristic.
    memset(&add_char_params, 0, sizeof(add_char_params));
    add_char_params.uuid                     = BLE_UUID_NUS_RX2_CHARACTERISTIC;
    add_char_params.uuid_type                = p_nus->uuid_type;
    add_char_params.max_len                  = BLE_NUS_MAX_RX_CHAR_LEN;
    add_char_params.init_len                 = sizeof(uint8_t);
    add_char_params.is_var_len               = true;
    add_char_params.char_props.write         = 1;
    add_char_params.char_props.write_wo_resp = 1;

    add_char_params.read_access  = SEC_OPEN;
    add_char_params.write_access = SEC_OPEN;

    err_code = characteristic_add(p_nus->service_handle, &add_char_params, &p_nus->rx2_handles);
    if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }

When i inspect the service with the nRF Connect APP, the new charactheristic appears as "Unknow Charactheristic"

How can i set the charactheristic's name?

If i try to add more charactheristics it return error code 4 (NRF_ERROR_NO_MEM)

How can i increase the memory stack?

Many thanks

Parents Reply
  • Sorry

    void read_events_poll(void){
    	
    	__ALIGN(4) uint8_t evt_buffer[NRF_SDH_BLE_EVT_BUF_SIZE];
    	ble_evt_t * p_ble_evt;
    	uint16_t     evt_len = (uint16_t)sizeof(evt_buffer);
    
    	ret_code_t ret_code = sd_ble_evt_get(evt_buffer, &evt_len);
    	if (ret_code != NRF_SUCCESS)
    		return;
    	p_ble_evt = (ble_evt_t *)evt_buffer;
    	nrf_section_iter_t  iter;
    	for (nrf_section_iter_init(&iter, &sdh_ble_observers);
    		 nrf_section_iter_get(&iter) != NULL;
    		 nrf_section_iter_next(&iter))
    	{
    		nrf_sdh_ble_evt_observer_t * p_observer;
    		nrf_sdh_ble_evt_handler_t    handler;
    
    		p_observer = (nrf_sdh_ble_evt_observer_t *)nrf_section_iter_get(&iter);
    		handler    = p_observer->handler;
    
    		handler(p_ble_evt, p_observer->p_context);
    	}
    }
    
    int main(void)
    {
        bool erase_bonds;
    
        // Initialize.
        uart_init();
        log_init();
        timers_init();
        buttons_leds_init(&erase_bonds);
        power_management_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();
    
        // Start execution.
        // printf("\r\nUART started.\r\n");
        NRF_LOG_INFO("Debug logging for UART over RTT started.");
        advertising_start();
    
        // Enter main loop.
        for (;;)
        {
    		read_events_poll();
    		sd_app_evt_wait();
        }
    }
    

Children
Related