• any better solution than the "UART" between a browser and and nRF?

    Not really - you can create your own characteristics, but because the UART is handled natively by Espruino it will probably be slightly faster.

    any better serialization format for Uint16 array?

    Raw binary :) I think just Bluetooth.write(uint16array.buffer) should do it, then you can decode on the other end.

    Bluetooth LE packets are normally 20 bytes max, so if you can send in chunks that are multiples of 20 you're likely to get slightly better bandwidth.

    Also do NRF.setConnectionInterval(7.5) as this'll force high speed comms all the time (usually Espruino drops it after some inactivity).

    I guess bluetooth layer itself takes care about data integrity & ordering.

    Absolutely yes :)

  • Oh, best serialization is no serialization at all :)

    Current progress: pretty happily pushing 128 * 16 bit values at 100ms intervals, and that is more than enough for this project.
    Thanks Gordon!

    For the record, going below 100ms interval, the busy LED becomes almost always on, and the actual throughput doesn't increase (measured in the browser by the number of received "packets").

    Edit: doing some math :)
    Theoretical maximum data transfer: (1000 ms /7.5 7.5ms interval)* 20 byte packets = 2666 bytes / sec
    Measured maximum: 260 bytes * 10 times per second = 2600 bytes / sec
    Is this pretty damn close to the theoretical maximum? :)

About

Avatar for Gordon @Gordon started