BLE UART data throughput, experience?

Posted on
  • Howdy all,

    I'm wondering if any one has a handle on how much data can be pumped out of the Puck.js via the BLE UART service, in the real world, bytes/sec. I know there is a lot of over head, as long as I have a timestamp on the data, it can lag quite a bit, just needs to be error free and no dropped information.



  • Hi - I haven't got any measured figures, but:

    The connection interval can be negotiated (depending on the PC) between 7.5 and 20ms - and it can send/receive 20 bytes per interval, so that's between 1000-2700 bytes/second. For reliable comms I'd stick a little below that if possible.

    On Espruino's side, newer firmwares will warn you with a FIFO_FULL error message if they believe that they have lost some data (eg. code was busy waiting for a write to complete so didn't have time to process the data that came in)

  • Does there have to be a separate connection for each chunk of 20 bytes (or maybe 6 x 20 bytes as the Nordic docs indicate)?

  • Hi - I'm not sure I understand the question? You mean can you send more than one chunk of data per connection interval?

    I'm not 100% sure - I don't believe so. However with BLE5 (and possibly before?) the two computers can negotiate to use larger packet sizes, so you're not limited to 20 bytes. That's not part of Espruino yet, but hopefully it will be at some point in the future - however it's only possible if both ends support it.

  • Thank you, this answers my question. Stuck with 20 bytes for now.

  • Do you have any clues if this modest throughput (1-2.7KB/s) is due to BLE limitations or more to the Espruino interpreter slowing down the transmission process?

    I am thinking of coding a simple BLE-serial passthrough adapter based on the examples provided. I would like it mostly to transmit data, but also to react to a specific sequence (key word after a given rest period in that data flux ~AT commands), to toggle a pin. Do you have any idea on how it should perform compared to other BLE-serial devices out there (like the HM-10) regarding throughput?

  • Recent firmwares have a higher MTU of 53 which should at least double throughput. This post is 4 years old and I think last time I measured it was substantially higher.

    I think you'll find it far quicker than HM-10, especially on UART TX where Espruino is able to push out multiple 53 byte packets per transmission interval at 7.5ms now

  • Thank you Gordon for your prompt and precise answer, as always!
    It sounds very promising: 53B/7.5ms = 7kB/s = 6.9KiB/s

    Do you think catching the escape sequence (pause + key word) will decrease this throughput substantially due to Espruino overheads?

  • Do you think catching the escape sequence (pause + key word) will decrease this throughput substantially due to Espruino overheads?

    It depends how you do it... If you can use something like a regular expression so you're not using too much JS then I don't believe so.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

BLE UART data throughput, experience?

Posted by Avatar for Rando @Rando