Updated firmware to 1.93, can't connect.

Posted on
  • After struggling a bit, I was able to connect my puck.js to the web IDE. I played around with the LEDs, with no issues, then flashed to firmware 1.93. The puck seems to turn on fine, and I have no problems connecting to it with bluetoothctl.

    However, I'm no longer able to connect to the IDE. If I try to pair, the device shows up (and as paired). After confirming though, the device fails to connect, and I get a few 'Connection Failed' popups on the lower right hand side of the IDE.

    Any suggestions on how to proceed? I've tried resetting the puck and my OS, but the problems persist. : \

  • Which OS are you using it with?

    Any chance you have an Android/iOS phone you could try and connect from to check that you can actually connect ok?

    Also, could you try powering up the Puck with the button held down (then release it when all 3 LEDs turn on)... That'll stop it loading any saved code, which could potentially have been causing you some problems if it was from an earlier version of the firmware

  • Hi Gordon,

    I'm on Linux (Arch x86_64).

    I am able to connect to the device from my Android phone, which is also how I installed the firmware.

    I did try the 'long' reset, and just tried it again, but I'm still not able to connect with the web IDE.

    I'm not sure if it's helpful, but I've tried to connect via bluetoothctl -- this is the output:

    [bluetooth]# connect F7:86:42:E9:36:7C 
    Attempting to connect to F7:86:42:E9:36:7C
    [CHG] Device F7:86:42:E9:36:7C Connected: yes
    [CHG] Device F7:86:42:E9:36:7C Connected: no
    Connection successful
    [CHG] Device F7:86:42:E9:36:7C Connected: yes
    [CHG] Device F7:86:42:E9:36:7C Connected: no
    

    Also, FWIW, I do not have issues connecting to other BT devices from my PC.

  • Please can you run bluetoothd --version?

    If I'm honest, sometimes the connection on Linux doesn't work that well, even with newer versions of bluetoothd. Restarting the bluetooth service usually fixes it though.

    The other thing you can try is to install the espruino-web-ide module on NPM: https://www.npmjs.com/package/espruino-w­eb-ide

    While getting packages set up for the IDE itself can be painful, you can easily run espruino-server and connect to port 8080 - it'll then use noble to make the bluetooth connection, which is much more reliable.

  • Thanks, Gordon.

    On Arch, bluetoothd doesn't seem to exist, but bluetoothctl -- version returns 5.46.

    Unfortunately, restarting the service hasn't changed anything.

    I'll give NPM a go. : )

  • Still no luck. :\

    I followed the instructions on GitHub. The npm Espruino IDE runs, but all I'm getting are the serial ports. Even after rebuilding the modules, there's no option for Bluetooth.

    espruino --list is able to display the Puck, and it seems I'm able to connect to it without errors.

    Would it make any sense to try and downgrade the firmware?

  • 5.46 is great news - that's more than new enough for there not to be problems.

    And the command-line app works fine? Did you try espruino-server? The 'standalone' version mentioned on GitHub is really painful to get set up (since NW.js often uses a different Node.js version to Node and NPM) - but the espruino-server version is basically just a version of the espruino command-line app that can serve up a Web IDE over HTTP.

    You could try and downgrade the firmware (my guess is you'd want 1v91, as 1v92 added bonding support) but honestly I don't think it'd make much difference.

  • Hi Gordon,

    I tried running espruino-server. It loads in my browser, and it brings up the option to connect to serial ports. But there's still no option for Bluetooth, even if I connect manually via espruino -p.

    This is what I get in the server output when I connect via espruino:

    noble: unknown peripheral f78642e9367c connected!
    noble: unknown peripheral f78642e9367c handle notify!
    

    I still fail to connect to the puck with bluetoothctl:

    [bluetooth]# connect F7:86:42:E9:36:7C 
    Attempting to connect to F7:86:42:E9:36:7C
    [CHG] Device F7:86:42:E9:36:7C Connected: yes
    Connection successful
    [CHG] Device F7:86:42:E9:36:7C ServicesResolved: yes
    [CHG] Device F7:86:42:E9:36:7C ServicesResolved: no
    [CHG] Device F7:86:42:E9:36:7C Connected: no
    

    Am I doing things in the wrong order, or is something broken?

  • One more update: I tried flashing 1v91 on the puck, and now I'm getting DFU SERVICE NOT FOUND.

    Do I have a bricked puck?

  • Ahh, hang on - so espruino and espruino-server appear to connect but don't stay connected - and same for bluetoothctl?

    I assumed from the comments before that espruino and bluetoothctl actually worked.

    When you tried flashing 1v91 onto the Puck, did you hold the button down while applying power, so the red LED stayed lit? If the red LED isn't on then it won't be in bootloader mode.

    Assuming you get it to flash you could try the absolute latest build too: http://www.espruino.com/binaries/travis/­master/

    With the new build a long-press on startup will delete all the saved pairing info, which I guess could be causing problems (if the Puck rejected the PC because it had previously been bonded with different bonding info).

  • Could it be something as simple as a flat battery? Enough to boot the Puck, but low enough that the Puck fails and restarts as soon as you try and connect.

    I have had reports that some of the batteries the Pucks ship with don't seem to last very long, and updating the firmware uses quite a bit of power - so it could be that the firmware update pushed it over the edge.

    It'd be worth trying (and potentially re-updating the firmware) with a fresh battery installed. It's pretty frustrating for everyone but I've tried to find out why it's happening and haven't had any success - I intentionally pay extra for good quality batteries.

  • Hi Gordon,

    Here's the current status -- all with a fresh battery:

    1. On 1v93:

      • espruino -p can connect to the puck. It stays connected.

      • espruino-server loads, but only displays connections for serial. It does this even if I successfully connect with espruino, both before and after starting the server. If I run espruino after espruino-server the latter's terminal output gives the unknown peripheral message.

      • bluetoothctl is not able to connect (or rather, connects then immediately disconnects) although I think I was able to connect before I tried setting up the npm packages.

    2. On 1v93.149, which I have been able to flash (I forgot to hold the button down, sorry!) everything is the same. After the firmware flashed, I held the button down until all three LEDs lit up.

    3. On 1v91, I am able to successfully connect with bluetoothctl! However, this has made no difference with either the online IDE or espruino-server. : \

    4. With Android, everything seems to be connecting smoothly, and flashing firmware seems to work well, with the blue LED staying on and then blinking off after 100% on DFU.

    I'm still able to connect to my other Bluetooth devices (keyboard, speaker) without problems.

    Is there anything else I can do?

  • Strange about espruino-server. When you run, and connect with the web browser and then click the connect button, do you see the text noble starting scan in espruino-server's console?
    All I can think is that when it installed from npm, it didn't install the noble package for some reason, even though it did for espruino. You could try re-installing espruino-server, and maybe manually installing noble as well.

    Did you also run the sudo setcap cap_net_raw+eip $(eval readlink -fwhich node) command, which allows node.js to access the bluetooth adaptor without running through sudo?

    Surely something else must have changed in your config if the online IDE used to work with the old firmware and now it doesn't though? Is

    Your other option is to use the Web IDE relay to use your phone to connect, but it's far from ideal: http://forum.espruino.com/conversations/­300770/

  • I did not see noble starting scan in the console.

    I tried reinstalling the server and noble. I'm not sure if I missed it the first time, but I'm getting a bunch of errors throughout the npm installs. Quickly skimming them over, they appear to be permissions issues. I have my npm setup with a different default directory (as per option 2 here -- could that be the issue, especially if I'm running with sudo?

    Also, libudev-dev is not available in Arch -- I installed libudev0-shim -- perhaps another source of problems?

    I'd be happy to email the error logs, if that is useful.

    The packages do eventually install, so I also tried installing noble (also had some warnings), but espruino-server still doesn't work with Bluetooth.

    I've also made sure to run the setcap command. No apparent problems with that command.

    I tried the Web IDE relay -- a couple of issues:

    1. Maybe obvious, but it didn't work in Firefox. Installed Chrome, which tries to pair.
    2. Initially, the puck seemed to connect. I went to pull up the browser on the PC. When I returned to Android, the connection had failed.
    3. I tried reconnecting again, but the connection would instantly fail. I reset the puck, and this continued a few times. Eventually, I was able to connect.
    4. However, going back to the PC, I couldn't find the option to enter the relay key. Is it not under the Communications tab anymore?
  • FYI, I didn't post this before, but this is the console output from the PC's Web IDE, if I try to connect directly to the puck:

    >>> Connecting...
    Set Slow Write = true
    >>> Connecting to Puck.js 367c
    BT>  Device Name:       Puck.js 367c
    BT>  Device ID:         /V/CLksgIvVJ0Sn0qd0mAA==
    >>> Connected to BLE
    BT> Connected
    BT> Disconnected (gattserverdisconnected)
    ERROR: [notify_error] Connection Failed.
    >>> Connection Failed.
    BT> ERROR: NetworkError: GATT Server is disconnected. Cannot retrieve services. (Re)connect first with `device.gatt.connect`.
    ERROR: [notify_error] Connection Failed.
    >>> Connection Failed.
    
  • The Relay Key entry should be 5th from the top in Communications. Which one doesn't work in Firefox? the phone, or the PC version? I'd have thought the PC one would be fine but I have to say I haven't tested it.

    There will be some errors in the NPM install process I think, because it has an optional dependency on a windows package called winnus (which will fail on non-windows OS's).

    Having Arch won't help, but if the espruino CLI software works then I don't see why the espruino-server doesn't - it's using exactly the same module and code.

    When you start espruino-server after doing all that extra stuff and go to the 'connect' window, do you see noble starting scan now? If not, that'd still be a problem. You could look in /usr/lib/node_modules/espruino-web-ide/n­ode_modules/ (or whatever your npm directory was) and see if noble was in there - if not you could copy it from /usr/lib/node_modules/espruino/node_modu­les/noble and see if that helps?

  • The Relay Key entry should be 5th from the top in Communications.

    Strange -- I don't see it. I have: Auto Save, Baud Rate, Connect over Audio, Connect over Bluetooth Smart (Web Bluetooth), Reset Before Send, Store Line Numbers . . . but no Relay Key.

    Which one doesn't work in Firefox? the phone, or the PC version?

    Sorry, Firefox didn't work on Android, but Chrome did. I'm using Chromium on the PC.

    When you start espruino-server after doing all that extra stuff and go to the 'connect' window, do you see noble starting scan now?

    I don't see that message. On the terminal, I get this output:
    Wed Aug 02 2017 16:22:58 GMT+0000 (UTC) HTTP GET /serial/ports

    Interestingly enough, if I go to Communications on espruino-server, I don't see an option for Connect over Bluetooth Smart (Web Bluetooth), which I can see in the Web IDE.

    You could look in /usr/lib/node_modules/espruino-web-ide/n­ode_modules/ (or whatever your npm directory was) and see if noble was in there[.]

    It is indeed there. : \

    Do you think any further debugging is useful at this point? It would be great to get the puck working, but I'm wondering if I might have better luck exchanging it for a pico or wifi.

  • I'm using Chromium on the PC.

    Could you just try installing standard Chrome and trying a normal Web Bluetooth connection from https://www.espruino.com/ide/ on it? That could be your problem - I found Chromium tended to be several versions behind normal Chrome, at least on Ubuntu-based systems.

    Strange -- I don't see it.

    See the attached, from https://www.espruino.com/ide/. Maybe you could look in the developer options and see if any errors are logged?

    Firefox didn't work on Android

    Ahh, yes - it doesn't support Web Bluetooth (yet)... It's only Chrome and Opera

    Interestingly enough, if I go to Communications on espruino-server, I don't see an option for Connect over Bluetooth Smart (Web Bluetooth)

    Something's really broken, it's there on mine - do you see any errors on the developer console in the browser?

    Do you think any further debugging is useful at this point?

    Well, if you can try the above stuff, but otherwise I guess it's best to exchange it. Where are you based?

    Ideally you'd have another PC or something you could try it on though. I imagine there are probably far less than 100 people using Bluetooth LE on Arch linux in the world :)


    1 Attachment

    • Screenshot at 2017-08-03 09-06-46.png
  • Following is the developer console output from Chromium:

    Error in event handler for (unknown): TypeError: Cannot read property 'sites' of undefined
        at chrome-extension://fcdjadjbdihbaodagojio­mdljhjhjfho/scripts/atd-chrome.js:80:17
    blockly.html:1 Error in event handler for (unknown): TypeError: Cannot read property 'sites' of undefined
        at chrome-extension://fcdjadjbdihbaodagojio­mdljhjhjfho/scripts/atd-chrome.js:80:17
    settingsConsole.js:30 >>> Connecting...
    settingsConsole.js:30 Set Slow Write = true
    settingsConsole.js:30 >>> Connecting to Puck.js 367c
    settingsConsole.js:30 BT>  Device Name:       Puck.js 367c
    settingsConsole.js:30 BT>  Device ID:         VU8rXtEY9pk4SfQ02NQ8oA==
    settingsConsole.js:30 >>> Connected to BLE
    settingsConsole.js:30 BT> Connected
    settingsConsole.js:30 BT> Disconnected (gattserverdisconnected)
    settingsConsole.js:40 [notify_error] Connection Failed.
    console.error @ settingsConsole.js:40
    error @ notifications.js:46
    (anonymous) @ menuPortSelector.js:169
    (anonymous) @ serial.js:134
    closeSerial @ serial_web_bluetooth.js:175
    (anonymous) @ serial_web_bluetooth.js:116
    settingsConsole.js:30 >>> Connection Failed.
    settingsConsole.js:30 BT> ERROR: NetworkError: GATT Server is disconnected. Cannot retrieve services. (Re)connect first with `device.gatt.connect`.
    settingsConsole.js:40 [notify_error] Connection Failed.
    console.error @ settingsConsole.js:40
    error @ notifications.js:46
    (anonymous) @ menuPortSelector.js:169
    (anonymous) @ serial.js:134
    (anonymous) @ serial_web_bluetooth.js:164
    Promise rejected (async)
    openSerial @ serial_web_bluetooth.js:156
    openSerialInternal @ serial.js:108
    openSerial @ serial.js:76
    connectToPort @ menuPortSelector.js:162
    connect @ menuPortSelector.js:63
    selectPortInternal @ menuPortSelector.js:71
    selectPort @ menuPortSelector.js:75
    dispatch @ jquery-1.11.0.js:4624
    elemData.handle @ jquery-1.11.0.js:4292
    settingsConsole.js:30 >>> Connection Failed.
    

    And from Chrome:

    >>> Connecting...
    settingsConsole.js:30 Set Slow Write = true
    settingsConsole.js:30 >>> Connecting to Puck.js 367c
    settingsConsole.js:30 BT>  Device Name:       Puck.js 367c
    settingsConsole.js:30 BT>  Device ID:         xDBlb1DcMujaD0Zmnp670Q==
    settingsConsole.js:30 >>> Connected to BLE
    settingsConsole.js:30 BT> Connected
    settingsConsole.js:30 BT> Disconnected (gattserverdisconnected)
    settingsConsole.js:40 [notify_error] Connection Failed.
    console.error @ settingsConsole.js:40
    settingsConsole.js:30 >>> Connection Failed.
    settingsConsole.js:30 BT> ERROR: NetworkError: GATT Server is disconnected. Cannot retrieve services. (Re)connect first with `device.gatt.connect`.
    settingsConsole.js:40 [notify_error] Connection Failed.
    console.error @ settingsConsole.js:40
    settingsConsole.js:30 >>> Connection Failed.
    

    :\

    I'm going to try it on another PC now, although it's also running Arch.

  • Hi Gordon -- I finally have some good news. The puck works out of the box with the other system. The only thing I did there was turn the experimental features on in Chromium.

    I don't use that PC regularly, so I still need to try to get the other one to work. But it's great to see that the puck itself is working. And since it seems to work out of the box, I'm going to see if I can roll back to a cleaner slate on this machine.

  • Done! : )

    I removed everything from npm, reverted everything back to defaults, unpaired/removed the puck with bluetoothctl, cleared the cache, restarted, removed all code from the IDE and saved the blank file, then I tried to pair straight from the IDE -- no pairing with bluetoothctl first, though I did have it open in the terminal.

    This is what the 'good' output looked like:

    [CHG] Controller 00:16:EB:79:49:23 Discovering: yes
    [NEW] Device F7:86:42:E9:36:7C Puck.js 367c
    [CHG] Device F7:86:42:E9:36:7C RSSI: -55
    [CHG] Device F7:86:42:E9:36:7C RSSI is nil
    [CHG] Controller 00:16:EB:79:49:23 Discovering: no
    [CHG] Device F7:86:42:E9:36:7C Connected: yes
    [CHG] Device F7:86:42:E9:36:7C Trusted: yes
    [NEW] Primary Service
        /org/bluez/hci0/dev_F7_86_42_E9_36_7C/se­rvice000a
        00001801-0000-1000-8000-00805f9b34fb
        Generic Attribute Profile
    [NEW] Primary Service
        /org/bluez/hci0/dev_F7_86_42_E9_36_7C/se­rvice000b
        6e400001-b5a3-f393-e0a9-e50e24dcca9e
        Nordic UART Service
    [NEW] Characteristic
        /org/bluez/hci0/dev_F7_86_42_E9_36_7C/se­rvice000b/char000c
        6e400003-b5a3-f393-e0a9-e50e24dcca9e
        Nordic UART RX
    [NEW] Descriptor
        /org/bluez/hci0/dev_F7_86_42_E9_36_7C/se­rvice000b/char000c/desc000e
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
    [NEW] Characteristic
        /org/bluez/hci0/dev_F7_86_42_E9_36_7C/se­rvice000b/char000f
        6e400002-b5a3-f393-e0a9-e50e24dcca9e
        Nordic UART TX
    [CHG] Device F7:86:42:E9:36:7C UUIDs: 00001800-0000-1000-8000-00805f9b34fb
    [CHG] Device F7:86:42:E9:36:7C UUIDs: 00001801-0000-1000-8000-00805f9b34fb
    [CHG] Device F7:86:42:E9:36:7C UUIDs: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
    [CHG] Device F7:86:42:E9:36:7C ServicesResolved: yes
    

    Gordon, thanks again for your patience and persistence. I'm still not sure what went wrong or what fixed it. : \ I hope that things stay fixed!

  • That's great news! If this happens again, if you could make a note of the exact steps you used to revert everything I guess it might help anyone else in a similar position.

    And no problem - these kinds of problems remind me a little of https://xkcd.com/1785/

  • Wow -- I'd not seen that one. On point!

    Having played around with things a little more, I'm now thinking that the real fix is this:

    bluetoothctl
    remove [mac address of puck]
    

    Then maybe do a 'hard' reset on the puck. My bet is that if I'd done that, I would have been able to pair again from the Web IDE on the next attempt.

    Otherwise, things on my end seem to be working even without the --experimental flag set on bluetooth.service. Maybe because Arch is rolling release?

    Thanks again for all your time and help, Gordon. I still have to really dig into things, but having JS on these systems is amazing. I hope learning C and Python is in my future, but for now this opens up a lot of options for me. I ordered an Espruino WiFi today.

  • Great, thanks for trying to figure it out! Hopefully that'll help anyone else who gets this kind of problem as well :)

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

Updated firmware to 1.93, can't connect.

Posted by Avatar for user79870 @user79870

Actions