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

notification nrf52832 data rate

Hi, i use the saadc example(triggered by ppi+timer) with uart to get voltage signal and transmit to central device( another custom nrf52832 board), and the central prints data on pc.
the problem is the data receiving rate on the central side is so low, i read the rate on a Serial debugging assistant.
MIN_CONN_INTERVAL and MAX_CONN_INTERVAL is 7.5ms on both sides; baud rate 115200;
J-link shows "Updating data length to 251 on connection" and "Updating ATT MTU to 247 bytes(desired:247) on connection";
NRF_SDH_BLE_GAP_EVENT_LENGTH 6, but i don't know how to make connection event length extension enabled;
uint32_t ticks = nrf_drv_timer_us_to_ticks(&m_timer,3000); i trigger saadc event every 3ms and send data in saadc_callback():

 void saadc_callback(nrf_drv_saadc_evt_t const * p_event)
{    
	uint16_t val;
	uint8_t value;
    if (p_event->type == NRF_DRV_SAADC_EVT_DONE)
    {
        ret_code_t err_code;
        static uint8_t data_array[SAMPLES_IN_BUFFER*2];
        err_code = nrf_drv_saadc_buffer_convert(p_event->data.done.p_buffer, SAMPLES_IN_BUFFER);
        APP_ERROR_CHECK(err_code);
        uint8_t i;
        printf("\r\nADC event number:%d \r\n", (int)m_adc_evt_counter);
        for (i = 0; i < SAMPLES_IN_BUFFER; i++)
           {
			    val = p_event->data.done.p_buffer[i];				
				printf("%d\r\n",val);					
				value=val>>4;				
				value|=1;
				switch(i|252)
					{
					    case 252:
						value&=249;
						break;
					    case 253:
						value&=251;
						value|=2;
						break;
						case 254:
						value|=4;
						value&=253;
						break;
						case 255:
						value|=6;
                        break;								 
					}
					value=0;
					value=val;
					value&=254;//11111110
					data_array[i*2+1]=value;
                    value=0;
			}
        uint16_t length = (uint16_t)(i*2);				
        err_code = ble_nus_data_send(&m_nus, data_array, &length, m_conn_handle);
        if ( (err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_ERROR_BUSY) &&
                         (err_code != NRF_ERROR_NOT_FOUND) )
			{
				APP_ERROR_CHECK(err_code);
			}
        m_adc_evt_counter++;
    }
}

I set the uart tx/rx buffer size :
#define UART_TX_BUF_SIZE 16384 
#define UART_RX_BUF_SIZE 16384
I can only get 8KB/sec rate that's not enough and connection get disconnected sometimes.[NTF_ERROR_RESOURCE]
two custom nrf52832 boards; SDK15; S132 V6.0;
Any advice will be appreciated.

Parents Reply Children
No Data
Related