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

Incease BLE throughput in nrf51822

Hi guys, 

I am developing a application and I want to increase the BLE throughput to atleast 1.3kB/s.

I have already read this thread: https://devzone.nordicsemi.com/f/nordic-q-a/12935/how-to-transmit-6-packets-in-s130-uart-central

and this thread: https://devzone.nordicsemi.com/f/nordic-q-a/1105/how-do-i-calculate-throughput-for-a-ble-link

With android, I decrease the interval connection down to 9ms and for ios it seems like can not go further than 24ms. 

So the speed in android is so much faster than in ios. 

I assumed that if I want to increase BLE throughput I have to increase number of packets per connection. 

I used sd130 v2 so I know that I can reach 6 packets and 4 packets for android and ios respectively. 

I have changed my ble_stack_init() so it looks like this: 

nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

		// Initialize SoftDevice.
		SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);
		
		NRF_LOG_PRINTF("\r\nINIT CRYSTAL SUCCESS\r\n");
		ble_conn_bw_counts_t conn_bw_counts = {
			.tx_counts = {.high_count = 1, .mid_count = 0, .low_count = 0},
			.rx_counts = {.high_count = 1, .mid_count = 0, .low_count = 0}
		};
		ble_enable_params_t ble_enable_params;
		memset(&ble_enable_params, 0x00, sizeof(ble_enable_params));

		
		ble_enable_params.common_enable_params.p_conn_bw_counts = &conn_bw_counts;
		
		
		softdevice_enable_get_default_config(CENTRAL_LINK_COUNT,
		PERIPHERAL_LINK_COUNT,
		&ble_enable_params);


		//Check the ram settings against the used number of links
		//CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT);
		// Enable BLE stack.
		softdevice_enable(&ble_enable_params);


		// Subscribe for BLE events.
		softdevice_ble_evt_handler_set(ble_evt_dispatch);
		

		softdevice_sys_evt_handler_set(sys_evt_dispatch);

and also in ble_advertising.c file: I added this code before sd_ble_gap_adv_start(&adv_params);

    ble_opt_t ble_opt;
    ble_common_opt_conn_bw_t conn_bw;
    memset(&conn_bw, 0x00, sizeof(conn_bw));
    memset(&ble_opt, 0x00, sizeof(ble_opt));

    // if this set to mid this will work but setting it to high will not
    conn_bw.conn_bw.conn_bw_rx = BLE_CONN_BW_HIGH;
    conn_bw.conn_bw.conn_bw_tx = BLE_CONN_BW_HIGH;
    conn_bw.role = BLE_GAP_ROLE_CENTRAL;

    // gap option is missing?
    ble_opt.common_opt.conn_bw = conn_bw;
		NRF_LOG_PRINTF("sd_ble_opt_set");
    sd_ble_opt_set(BLE_COMMON_OPT_CONN_BW, &ble_opt);

I can compile but it seemed not work since the speed is still very low. How can I know how many packets transferred every connection event and how can I make it work?  

Thank you for your time. 

Related