Bluetooth transfer speed is slow.

- nRF connect SDK 1.9.1

- nRF5340 DK

We use the official samples Bluetooth: Central UART and Bluetooth: Peripheral UART to test bluetooth transfer between two development kit. We found observable delays and data loss when sending data continuously.

Specifically, the central sends data with a length of 40 bytes each 0.05s. The central send a total of 5120bytes, but the peripheral recieve only 4480 bytes of data. The transmission process was accompanied by a relatively obvious delay.

  • Thank's for your advise. In addition, we want to know where the data received by the peripheral is stored. We looked through the routines and found no relevant code

  • Hi

    The data is not stored in flash on the peripheral side, it is only temporarily stored in a buffer before forwarded to the UART terminal over the UART peripheral. You can see the UART_RX_RDY, UART_RX_BUF_REQUEST in the peripheral UART example to see how this is handled. 

    Best regards,

    Simon

  • I have read two examples. can you please tell me how to improve the transmission speed of the nus service? I checked the throughput example according to your instructions, but I still don't understand how to set the nus sample. I measured the speed of the peripheral sample is only 6.4kbps. How can I set it to reach about 800kbps in the throughput sample.

  • Hi

    There are multiple parameters that can help increase the throughput, and you should begin by using the 2MBPS PHY, as well as enabling extended advertising to increase MTU and data length, and update the connection parameters/interval. All of this is done with functions like these which are used in the throughput example:

    static bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param)
    {
    	printk("Connection parameters update request received.\n");
    	printk("Minimum interval: %d, Maximum interval: %d\n",
    	       param->interval_min, param->interval_max);
    	printk("Latency: %d, Timeout: %d\n", param->latency, param->timeout);
    
    	return true;
    }
    
    static void le_param_updated(struct bt_conn *conn, uint16_t interval,
    			     uint16_t latency, uint16_t timeout)
    {
    	printk("Connection parameters updated.\n"
    	       " interval: %d, latency: %d, timeout: %d\n",
    	       interval, latency, timeout);
    
    	k_sem_give(&throughput_sem);
    }
    
    static void le_phy_updated(struct bt_conn *conn,
    			   struct bt_conn_le_phy_info *param)
    {
    	printk("LE PHY updated: TX PHY %s, RX PHY %s\n",
    	       phy2str(param->tx_phy), phy2str(param->rx_phy));
    
    	k_sem_give(&throughput_sem);
    }

    Best regards,

    Simon

Related