Using nRF52832 w/ SDK 15.2 as peripheral connecting to an iOS 12.2 central (iPhone XS Max).
IDE: SEGGER Embedded Studio for ARM, Release 4.10a
The max data rate I can achieve is ~1250 Bytes per second using sd_ble_gatts_hvx notifications. Once I attempt to go over this, say ~2kBytes/sec then within a few hundred packets NRF_ERROR_RESOURCES is returned ... which I buffer and retry sending after BLE_GATTS_EVT_HVN_TX_COMPLETE is returned. The retry buffer has size 10 packets. Once the buffer is full then it dumps/loses the data and keeps going til the next overflow.
I've read several Nordic forums claiming much higher data rates (~775kbits 3 years ago :) and I've followed the parameters they suggested but still hitting the wall.
- Data Length Extension: 251
- Connection Event Extension: Enabled via sd_ble_opt_set(BLE_COMMON_OPT_CONN_EVT_EXT, &optionsConnExt);
- #define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247 (iOS negotiates to 185)
- My payload size: (NRF_SDH_BLE_GATT_MAX_MTU_SIZE - 3)
- Tested with following MIN_CONNECTION_INTERVAL: * #define MIN_CONNECTION_INTERVAL (uint16_t) MSEC_TO_UNITS(7.5, UNIT_1_25_MS) * #define MIN_CONNECTION_INTERVAL (uint16_t) MSEC_TO_UNITS(30, UNIT_1_25_MS) * #define MIN_CONNECTION_INTERVAL (uint16_t) MSEC_TO_UNITS(200, UNIT_1_25_MS) * #define MIN_CONNECTION_INTERVAL (uint16_t) MSEC_TO_UNITS(550, UNIT_1_25_MS)
- #define MAX_CONNECTION_INTERVAL (uint16_t) MSEC_TO_UNITS(600, UNIT_1_25_MS)- #define SLAVE_LATENCY 0 // Slave latency in terms of connection events.- #define SUPERVISION_TIMEOUT (uint16_t) MSEC_TO_UNITS(4000, UNIT_10_MS) // Supervision time-out in units of 10 milliseconds.
- #define NRF_SDH_BLE_GAP_EVENT_LENGTH 400
- Other values: max_rx_octets: 251, max_tx_octets: 251, max_rx_time: 1364, max_tx_time: 1364
Any suggestions on how to get close to 100kBytes/second?
Unfortunately, 400kbps seem to be about the maximum possible with iOS (https://devzone.nordicsemi.com/support-private/support/218063). There is a talk about throughput in: https://developer.apple.com/videos/play/wwdc2017/712/ from 30-31 minutes and onwards.
I guess you have also seen the throughput examples in the Softdevice specification here: Bluetooth Low Energy data throughput.
Thanks for the response.
I'd be happy with 400kbps but still hitting the 10kbps (~1250 Bytes/sec) wall. Can you help me achieve the 400kbps?
Just found the issue. Not sure why yet, but after removing the following lines of code in my bleStackInit function I'm able to achieve ~264kbps (~33kBytes/sec).