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

increase transmission buffer size in ble_app_uart_c transfer large data

hello,

I need send 10000bytes large data send central to peripheral in single transmission. I using example code ble_app_uart_c in SDK15.2 nrf52832. what are the parameter i change to increase transmission buffer size in central and peripheral code...???? 

Parents
  • Hi, 

    You can edit UART_TX_BUF_SIZEUART_RX_BUF_SIZE in main.c. You can change this define to increase or decrease the number as per your requirement but keeping the RAM size in mind. Please also see this post.

    #define UART_TX_BUF_SIZE        256                                     /**< UART TX buffer size. */
    #define UART_RX_BUF_SIZE        256                                     /**< UART RX buffer size. */

    Best regards,

    Amanda

  • Thanks for replay

    I testing send central to peripheral 10000bytes in every 5seconds using below function

    for(;;)
    {
    err_code=ble_nus_c_string_send(&m_ble_nus_c, send_Data, sizeof(send_Data)); //send_Data size like 10000byte
    
    APP_ERROR_CHECK(err_code);
    nrf_delay_ms(5000);
    }

    error code return this kind of error

     0> <warning> ble_nus_c: Connection handle invalid.

    In my application I can transmit 10000bytes central(ble_app_uart_c) to peripheral(ble_app_uart) SDK15.2.

    How did Connection  handle transmit 10000bytes send to peripheral any handle function is there...???

  • No, that won't work.

    You need to split the data because ble_nus_c_string_send does not handle 10000 bytes.

    Take a look on how it's done in uart_event_handle() in ble_app_uart_c:

    if ((data_array[index - 1] == '\n') || (index >= (m_ble_nus_max_data_len)))

     

    If the string/data being sent have a \n character or if m_ble_nus_max_data_len is reached, the data will be sent. 

    m_ble_nus_max_data_len = BLE_GATT_ATT_MTU_DEFAULT - OPCODE_LENGTH - HANDLE_LENGTH; /**< Maximum length of data (in bytes) that can be transmitted to the peer by the Nordic UART service module. */

     

    -Amanda

  • m_ble_nus_max_data_len is 244bytes i split by 244bytes and send every transmission first transmission successful receive peripheral but balance data doesn't send properly central show error 

     0> <warning> ble_nus_c: Connection handle invalid.

     0> <warning> ble_nus_c: Connection handle invalid.

     0> <warning> ble_nus_c: Connection handle invalid.

     0> <warning> ble_nus_c: Connection handle invalid.

    in every transmission how to handle connection valid to transfer peripheral

    for(;;)
    {
    	for(uint16_t cnt=0;cnt<10000;cnt++)
    			{
    				send[len]=data[cnt];
    				len++;
    				if(len>=244)
    				{
    				err_code=ble_nus_c_string_send(&m_ble_nus_c,send, sizeof(send));//send size 244byte
    				if(err_code != NRF_ERROR_INVALID_STATE && err_code != BLE_ERROR_INVALID_CONN_HANDLE)
    					{
    							APP_ERROR_CHECK(err_code);
    					}
    					len=0;
    				}
    			}
    	}

Reply
  • m_ble_nus_max_data_len is 244bytes i split by 244bytes and send every transmission first transmission successful receive peripheral but balance data doesn't send properly central show error 

     0> <warning> ble_nus_c: Connection handle invalid.

     0> <warning> ble_nus_c: Connection handle invalid.

     0> <warning> ble_nus_c: Connection handle invalid.

     0> <warning> ble_nus_c: Connection handle invalid.

    in every transmission how to handle connection valid to transfer peripheral

    for(;;)
    {
    	for(uint16_t cnt=0;cnt<10000;cnt++)
    			{
    				send[len]=data[cnt];
    				len++;
    				if(len>=244)
    				{
    				err_code=ble_nus_c_string_send(&m_ble_nus_c,send, sizeof(send));//send size 244byte
    				if(err_code != NRF_ERROR_INVALID_STATE && err_code != BLE_ERROR_INVALID_CONN_HANDLE)
    					{
    							APP_ERROR_CHECK(err_code);
    					}
    					len=0;
    				}
    			}
    	}

Children
Related