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

my bluetooth gets disconnected while sending continous stream of data

hi, i am using uart example from nrf51822 example. when i am sending continuous stream of data then my connection breaks. it disconnects from peripheral device. how should i overcome from this situation. i think i am missing some data exchange concept for sending devices based on connection interval and all different parameters.

can anyone please guide me what should i do to make connection live while sending continuous data over ble uart.

thanks!!

Parents
  • hi, yes you are right i am using like this only in switch loop my data get updated each time. and device resets and disconnects.

    btw here is my code i am using to send data. and i am using 10 sdk NUS example.

    case APP_UART_DATA_READY:
                UNUSED_VARIABLE(app_uart_get(&data_array[index]));
                index++;
    						push++;
    						if(index%3 == 0)
    						{
    							count++;
    							err_code = app_timer_cnt_get(&uart_time);
    							APP_ERROR_CHECK(err_code);
    	
    							uart_time = app_timer_ms(uart_time);
    							sent_time = app_timer_ms(sent_time);
    							duration_time = app_timer_ms(duration_time);
    							
    							//diff
    							err_code = app_timer_cnt_diff_compute(uart_time,sent_time,&duration_time);
    							APP_ERROR_CHECK(err_code);
    							
    							SEGGER_RTT_printf(0, "uart:%d\tsent:%d\tduration:%d\n",uart_time,sent_time,duration_time);
    							//SEGGER_RTT_printf(0, "previous time:%d\n",previous_time);
    							//SEGGER_RTT_printf(0, "duration time:\t%d\n",app_timer_ms(duration_time));
    							
    							
    							
    							
    							SEGGER_RTT_printf(0, "current:%d\tsent:%d\n",uart_time,sent_time);
    								
    								if(uart_time<sent_time+waiting_time)
    								{
    										const uint8_t* midiData = parseMIDItoAppleBle(3, data_array);
    										for(int i=0;i<5;i++)
    										{
    												data[i] = midiData[i];
    										}
    										SEGGER_RTT_printf(0, "%x\t%x\t%x\t%x\t%x\tcnt:%d\n",data[0], data[1],data[2],data[3], data[4],count);
    										sendData(data,5);
    										err_code = app_timer_cnt_get(&sent_time);
    										APP_ERROR_CHECK(err_code);
    								}
    								
    						
    							index = 0;
    							//rx_buf_num=0;
    
    							//previous_time = current_time;
    							preCount=count;
    							//count=0;
    						}
    

    thanks!!

Reply
  • hi, yes you are right i am using like this only in switch loop my data get updated each time. and device resets and disconnects.

    btw here is my code i am using to send data. and i am using 10 sdk NUS example.

    case APP_UART_DATA_READY:
                UNUSED_VARIABLE(app_uart_get(&data_array[index]));
                index++;
    						push++;
    						if(index%3 == 0)
    						{
    							count++;
    							err_code = app_timer_cnt_get(&uart_time);
    							APP_ERROR_CHECK(err_code);
    	
    							uart_time = app_timer_ms(uart_time);
    							sent_time = app_timer_ms(sent_time);
    							duration_time = app_timer_ms(duration_time);
    							
    							//diff
    							err_code = app_timer_cnt_diff_compute(uart_time,sent_time,&duration_time);
    							APP_ERROR_CHECK(err_code);
    							
    							SEGGER_RTT_printf(0, "uart:%d\tsent:%d\tduration:%d\n",uart_time,sent_time,duration_time);
    							//SEGGER_RTT_printf(0, "previous time:%d\n",previous_time);
    							//SEGGER_RTT_printf(0, "duration time:\t%d\n",app_timer_ms(duration_time));
    							
    							
    							
    							
    							SEGGER_RTT_printf(0, "current:%d\tsent:%d\n",uart_time,sent_time);
    								
    								if(uart_time<sent_time+waiting_time)
    								{
    										const uint8_t* midiData = parseMIDItoAppleBle(3, data_array);
    										for(int i=0;i<5;i++)
    										{
    												data[i] = midiData[i];
    										}
    										SEGGER_RTT_printf(0, "%x\t%x\t%x\t%x\t%x\tcnt:%d\n",data[0], data[1],data[2],data[3], data[4],count);
    										sendData(data,5);
    										err_code = app_timer_cnt_get(&sent_time);
    										APP_ERROR_CHECK(err_code);
    								}
    								
    						
    							index = 0;
    							//rx_buf_num=0;
    
    							//previous_time = current_time;
    							preCount=count;
    							//count=0;
    						}
    

    thanks!!

Children
No Data
Related