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

BLE packets retrying

I stumbeled across a problem with my application, which runs on s120. My case is: I have a S120, configured as a peripheral and I have an Android 5.0 Motorola smartphone. I want to transfer FW via NUS service, using my own protocol for packaging data and transfering it. The new .bin FW file is on the smartphone, which then divides this file into 20 byte chunks and writes it to one of the NUS characteristics. So far so good. Transfer basically works, I can flash my device without dificulties.

The source of my problem lies in the fact, that the transfer is much slower than expected, it takes 25s to transfer 11kB of data. This is less than 0,5kB/s. So I did a sniffer trace, which gave me some idea what is happening. Packets, sent by the phone are constanlty being NACK'd by S120, which can be seen as the same numbers NESN and SN in one packet. Therefore, the packets are constantly being re-transmitted, which takes a lot of time. When I tried with an Nexus 5X with Android 7.0 on it, there was less retrying, but still way more than it should be.

Some time ago, I was trying this kind of transfer on an iPhone 5 and it worked almost 6 times faster, transferring about 100kB of data in about 30s.Sadly, I don't have a trace for it, but as far as I can remember, there was almost no retrying present.

I'm attatching a sniffer traces for both the Nexus and partially for Motorola phone. Note, there are notifications sent from S120 to the phone every 4 received packets (80 Bytes). So Ideally, the transfer should look like:

  1. S120 notif
  2. phone writes 4 packets in one connection event
  3. S120 notif

As it can be seen from the traces, this isn't the case with all the retrying going on.

Can someone point me in the right direction to start debugging this phenomena? Is there something wrong on the S120 side or phone app?

nexus_transfer.pcapng

motorola_transfer.pcapng

Related