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

large data send central to peripheral nrf52832

Hello everyone,

I need transfer large data 12KB array send central to peripheral using nrf52832. I try this examples in central (ble_app_uart_c) and peripheral (ble_app_uart). I add this few line in central

for(;;){

            uint16_t cnt=0;
           for(cnt=0;cnt<12000;cnt++)

            {
                uint8_t data=array_data[cnt];
            ble_nus_c_string_send(&m_ble_nus_c, &data, sizeof(data));
            
            }      
            
            idle_state_handle();
        }

peripheral doesn't receive any data from central. any example function or code is there to communicate central and peripheral transfer large data....????

Parents Reply Children
  • Connection handle is stored in m_ble_nus_c. You should make sure it is valid whenever you call ble_nus_c_string_send, or do not pass the error code to APP_ERROR_CHECK() if you do not care about data loss:

    ret_code_t err_code = ble_nus_c_string_send(&m_ble_nus_c, &data, sizeof(data));
    if(err_code != NRF_ERROR_INVALID_STATE && err_code != BLE_ERROR_INVALID_CONN_HANDLE)
    {
        APP_ERROR_CHECK(err_code);
    }

  • Thanks for helping

    Now i send 244byte in single transmission. i split 10000bytes into 244 bytes in every transmission but first transfer data receive peripheral(app_ble_uart) and balance data doesn't receive in peripheral side error code show

     0> <warning> ble_nus_c: Connection handle invalid.

     0> <warning> ble_nus_c: Connection handle invalid.

    for(;;)
    {
    uint8_t Buff[244];
    uint8_t cp_Lnt=0;
    	for(uint16_t cnt=0;cnt<10000;cnt++)
    			{
    				Buff[cp_Lnt]=data[cnt];
    				cp_Lnt++;
    				if(cp_Lnt>=244)
    				{
    				err_code=ble_nus_c_string_send(&m_ble_nus_c,Buff, sizeof(Buff));//send_Data
    				if(err_code != NRF_ERROR_INVALID_STATE && err_code != BLE_ERROR_INVALID_CONN_HANDLE)
    					{
    							APP_ERROR_CHECK(err_code);
    					}
    					cp_Lnt=0;
    				}
    			}
    	}

    in peripheral side connection interval set below

    #define MIN_CONN_INTERVAL               MSEC_TO_UNITS(20, UNIT_1_25_MS)
    #define MAX_CONN_INTERVAL               MSEC_TO_UNITS(20, UNIT_1_25_MS)

    what are the parameters to change getting all data receive peripheral side without losing connection and data losses...???

  • You should figure out what is causing the disconnect. Can you provide a sniffer trace of the on-air traffic using the nRFSniffer v2?

  • I don't have a Sniffer board please give any other way to find this problem solving method..???

    I put delay of 2 second in every transmission all bytes receive success without any loss

        nrf_delay_ms(2000);

        err_code=ble_nus_c_string_send(&m_ble_nus_c,Buff, sizeof(Buff));

    but i remove this delay continuously reset. i need without delay my code working function receive all data with in 1 second...???

  • Could be that the other device gets an error code, or that there are some unhandled events that cause the link to be broken. This would be much easier to debug with a sniffer trace. I would absolutely recommend getting another DK that you can use to sniff the connection, it is a valuable debugging tool when developing Bluetooth applications.

Related