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
  • Hi,

    The NRF_ERROR_RESOURCES error indicates that the notification queue has become full. If you get this error, you need to wait for the BLE_GATTS_EVT_HVN_TX_COMPLETE event before attempting to add more packets to the queue.  You can also increase the notification queue size when you enable the Softdevice, see ble_gatts_conn_cfg_t::hvn_tx_queue_size.

    I'm not sure why you only get 8KB/s with the current setup though. Maybe you can try to increase the connection interval and NRF_SDH_BLE_GAP_EVENT_LENGTH  to 50 ms to see if that helps. The Softdevice specification includes some throughput numbers achievable with certain connection parameters to give an idea of what you can expect (link).

Reply
  • Hi,

    The NRF_ERROR_RESOURCES error indicates that the notification queue has become full. If you get this error, you need to wait for the BLE_GATTS_EVT_HVN_TX_COMPLETE event before attempting to add more packets to the queue.  You can also increase the notification queue size when you enable the Softdevice, see ble_gatts_conn_cfg_t::hvn_tx_queue_size.

    I'm not sure why you only get 8KB/s with the current setup though. Maybe you can try to increase the connection interval and NRF_SDH_BLE_GAP_EVENT_LENGTH  to 50 ms to see if that helps. The Softdevice specification includes some throughput numbers achievable with certain connection parameters to give an idea of what you can expect (link).

Children
Related