• Please could you try adding NRF.setConnectionInterval(7.5) to the top of your app? That'll force Espruino to always use the fastest Bluetooth poll interval available.

    I have done what you asked and I found out something very interesting.

    Wireshark reports the connection interval setting as the first message sent by BangleJS to my PC after connection creation. It is a L2CAP protocol Connection Parameter Update Request packet containing:

    0000   02 01 2e 10 00 0c 00 05 00 12 03 08 00 06 00 06
    0010   00 00 00 90 01
    

    Byte 10 is the Command Identifier and its value is 0x03.

    After the connection is established, keystrokes have a delay of [100 - 150] ms for the key up action. In this state the usual issue of repeated and lost keystrokes can happen, especially if I quickly press the button.

    However, if I wait for ~40 seconds after connection creation Wireshark captures another Connection Parameter Update Request packet sent by BangleJS with the following contents:

    0000   02 01 2e 10 00 0c 00 05 00 12 05 08 00 06 00 06
    0010   00 00 00 90 01
    

    The contents are the same except for byte 10, which is now 0x05.

    After this packet reception, the delay of key up actions drops to [15 - 30] ms and there are no more repeated or lost keystrokes.

    Could it be that the Command Identifier of the first Parameter Update is wrong? I can see from the Wireshark dump that all the requests are accepted with a Connection Parameter Update Response packet sent by my PC, but maybe the Command Identifier 0x03 is actually ignored by the PC BLE controller...

About

Avatar for Franzo @Franzo started