Hi,
i'm trying to sort out a performance problem I have with Android clients connecting to my nrf52832 using ble_nus service. Notice my problem is not about the absolute performance values, but the difference between iOS and Android. I'm trying to understand if anyone else here has encountered similar problems.
Here are some more details.
I have implemented a custom rx/tx protocol based on ble_nus service, SDK 14.2. Large response packets (max 4k) are sliced up to max available data length (considering DLE/MTU) and queued up with "sd_ble_gatts_hvx", while new packets are sent when a "BLE_GATTS_EVT_HVN_TX_COMPLETE" is received. Connection setup allows for 1M/2M phy, connection times from 7.5 to 500 ms, 0 latency, etc. I've been able to test with mobile phones using 2M PHY, DLE up to 251 bytes, larger MTU, etc. and the nrf52 side seems to be ok.
The problem is with mobile client implementation and seems to be unrelated to MTU, DLE or other performance tweeks. To sort our anything related to our client implementation, I am using nrf toolbox. This is what I see:
- nrf52 tries to send data. 4 packets are queued up, till NRF_ERROR_RESOURCES is received
- when BLE_NUS_EVT_TX_RDY is received and there is still data to be sent, try to queue up some more packes till NRF_ERROR_RESOURCES is received again
Both with iOS and Android the behavior is the sime, but the timings between last packet is queued and BLE_NUS_EVT_TX_RDY events are hugely different, just like if sending data to Android is way slower. In our code we tried with large MTU but it didn't change the fact that iOS even with basic 27 bytes MTU is enormously slower than Android. We've also tried different phones with different Android versions.
What's strange is that on some phones, it begins to become slow some time after connection: if the transmission starts right after connection, there are 3-4 seconds where performance is good, then it becomes slow. If instead transmission start 3-4 seconds after connection, it is slow from start.
I really don't know where to bang my head. Anyone noticed similar problems/has some suggestions?
Thanks!