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

Soft Device received data handling

Hi,

I am having some issues transferring data from an iPhone to the nRF51822. Actually, I write block of 16 of my data from the iPhone on a specific characteristic on the nRF51822 and on each write event, I transfer the written data to another microcontroller which handles it. When dealing with "huge" amounts of data (around 5kB), it happens sometimes that the data rate slows down drastically (like 4kB/s to a few bytes per second) and I receive the error on the iPhone that some blocks could not be written.

As I haven't clearly identified the issue yet, I would like to know more about how the soft device handles the data written on a characteristic (to give me a hint to debug properly). Is it cached while not handled by the on_write event? What are the buffer sizes?...

  • Self answer but can be useful for the community.

    I limited the amount of data sent by the iPhone to 1kB and wait for the nRF51822 to ask for the following block and it worked better as I didn't lose data anymore. However, the data rate was fine at the beginning and dropped drastically during the transfer. The reason for that was that the connection parameters were not complying with the iOS requirements. Thus the iPhone was asking for a connection parameter update, which screwed the whole thing up. Once the connection parameters corrected on the nRF51822, it works nicely.

  • Great that you found the solution and posted an answer yourself! :-) It's important to always make sure to have control over the connection interval when doing high-throughput data-transfer.

    Also, I'd recommend you to do some throttling on the iOS side, since iOS doesn't behave nicely if you fill its buffers. Everything that is sent over the air will arrive at the S110's on_write handler, since it will take care to not ACK incoming packets if there isn't room. This should therefore avoid any data loss.

    A final tip: The max size for a write is 20 bytes, and the limit is most often on the number of transactions, not the number of bytes, so to maximize throughput, you should use 20 byte payloads.

    I'll mark this as the accepted answer, to clear up the discussion! :-)

Related