• Hello everyone,

    I'm new to Espruino and can't figure out what I am doing wrong:

    I have a Puck.js (version 1 which I updated to version 2.10) and tried to play with the BLE keyboard tutorial. First everything worked just fine. But then I presume I uploaded some broken code and now everytime I try to send new code from the Web IDE it automatically disconnects after the data was sent (it didn't do that before if I'm not completely crazy). The code that was sent to Puck.js seems to be lost. And even a hard reset and reflashing the firmware didn't help.

    I'm completely lost! If someone could please help me. Thank very much in advance!


    PS: A new Version 2 Puck.js is on its way. And I fear I could break it as well. So understanding what happended here and how I can prevent it from happening again would be great!

  • Can you be a little bit more specific about what you uploaded? ...your IDE settings about where you - wanted to. - store the code?

    You mentioned hard reset; I assume you also did the simple reset by just removing the battery for a bit, did you?

  • I tried loading it up to the RAM and also tried loading it up to Flash. In both cases it disconnects after the upload and on reconnecting it appears as no code has been uploaded.

    And yes - I did soft reset and hard reset. And I tried re-uploading the firmware. I would have guessed that at least one of these would erase every malfunctioning code I had uploaded before.

    I have one more clue: I just looked at the JS console of the IDE and it says

    SEND ERROR: NotSupportedError: GATT operation failed for unknown reason.

    Sorry - sould have looked there earlier. :/

  • Sorry you're having issues...

    SEND ERROR: NotSupportedError: GATT operation failed for unknown reason.

    This might sound stupid, but that error actually comes from your main computer, not Puck.js - so I think it's an issue with the computer - I bet it'd work fine from another.

    Please can you make sure your operating system isn't paired with the device via the OS's bluetooth menu? Also you could try rebooting your computer just in case?

    What's likely happening is:

    • You turned your Puck into a bluetooth keyboard
    • You then paired it with your PC, all was fine but the PC now thinks it's a keyboard and tries to auto-connect whenever it sees the device
    • Now you change the code on the Puck (or maybe it was written into RAM so it disappeared when you removed the battery). The Puck is no longer a HID device
    • The OS still tries to auto-connect, but when it sees the Puck is no longer a HID device, it disconnects - it doesn't realise that you're actually trying to program it with the Web IDE as well.

    Hope that helps!

  • That definitely makes sense! Thank you very much!

    I will check - a bluetooth stick for testing it on another computer is on its way anyway. So update comes asap. Trying to reboot my laptop meanwhile.

    Just one more question: To test my code I do have to connect it to my PC as a keyboard (I always removed the device after testing). How to prevent this behaviour in the first place? Is it only possible to develop on one computer and test it on another?

  • It worked after rebooting my laptop. -_- This is so cliché: "Have you tried turning it off and on again?" :D

    Sometimes the solution can be so simple. Thanks!

  • To test my code I do have to connect it to my PC as a keyboard

    Well, if you don't want to physically touch your Puck then yes, to debug you have to be connected via Bluetooth.

    But it is possible to solder on a UART connection, then you can debug and reprogram via the UART while being connected (possibly to a different computer) by Bluetooth: http://www.espruino.com/Puck.js#serial-c­onsole

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

Puck.js automatically disconnects after sending code - nothing stored though

Posted by Avatar for 2WeltenChris @2WeltenChris