You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Hi!

    Recent (cutting edge) builds of Espruino for nRF5x chips (eg. all official Espruino Bluetooth boards) are now much faster at communicating over Bluetooth. I managed to get a whole bunch of changes in:

    Speed negotiation now happens 0.1 second after connecting, not 5s. This massively improves connection speed for pretty much everything.

    Bluetooth UART transmit now attempts to send multiple transmit packets in one connection interval. This code:

    function go() {
      var t = getTime();
      for (var i=0;i<200;i++)print(("                    "+i).substr(-18));
      print(getTime()-t);
    }
    

    Used to take around 8 seconds. On pretty much all platforms it's down under 1.5s now (so over a 4x speed boost).

    High speed device-device comms - it used to be that when you connected from one Espruino to another their settings would mean they defaulted to a 20ms connection interval. You can now max this out by supplying some settings to the connect method:

    NRF.requestDevice({ filters: [{ namePrefix: 'Pixl.js' }] }).then(function(device) {
      return device.gatt.connect({minInterval:7.5, maxInterval:7.5});
    }).then(function(g) {
      ...
    

    Improved Web IDE If you're using espruino.com/ide make sure you hit refresh - there have been a few changes that should really improve Web Bluetooth transfer speed!

    Finally, Espruino requests between a 7.5 and 20ms connection interval. Usually this means that the connecting device chooses 20ms to get the lowest power consumption. You can change it to be slower with NRF.setLowPower(true), but you can't get it faster at the moment.

    Espruino now defaults to 7.5ms, and after around a minute of inactivity it slows down to 200ms to save power (which will massively help with power consumption connected devices). Do more than one operation on BLE and it'll bump back up - it's hardly noticeable, but the >2x speed improvement to code uploads really is noticeable.

    You you don't like it there's now NRF.setConnectionInterval to give you full control though.

    I'd be really interested to hear your impressions of the new builds - does the connection process still work smoothly for you? do you have any issues with it?

About

Avatar for Gordon @Gordon started