• Hi,
    I got a Puck.js and a "CSR 4.0" Bluetooth USB adapter for my desktop PC a few days ago.
    Firstly I updated the Puck.js to firmware 1v95 with my android tabled, which worked well.
    Then I installed the native Web IDE.

    Since then, I have been trying to discover and pair the Puck.js with my desktop PC, but without luck.
    The PC has Windows 10 v. 1703 (Creators Update).
    The CSR dongle uses native Windows drivers, which were automatically installed when first inserting it. Searching for driver update MS says everything is up to date.
    Windows PC Bluetooth recognizes my tablet when I switch Bluetooth on there, but it does not see the Puck.js and also no other BLE HID devices that can bee seen with the tablet.
    Deinstalling/reinstalling dongle and drivers did not change anything, I even tried installation of CSR Harmony stack, which only led to error messages when tring to enable Bluetooth. So I deinstalled it and after reinserting the dongle native windows drivers were there again.

    The Creators Update seems to be notorious for problems with BLE, as I found many discussions on internet about suddenly invisible/unusable peripheral devices after update to v.1703.

    So my question to other Puck.js developers on Windows 10 with Creators Update:
    How do you still connect to your Puck. js?
    Do you use a different dongle (Broadcom?) Or what does the trick for you?

  • Hi!

    I'm using a CSR module with my Windows 10 Creators Update PC (version 1709) and do have it working. I plugged the USB dongle in, and in device manager I disabled the existing Bluetooth radio that was in my PC and did 'update drivers' on the new dongle, then rebooted (the reboot seems to be required).

    However there are actually two methods of using Puck.js with Windows... You can use Windows' built-in functionality, or can just tell Windows not to touch your CSR dongle and can then have the Native Web IDE use the dongle directly without having to pair. That might actually end up being the easiest solution for you?

    There are instructions here for earlier versions of Windows that show you how to do that: http://www.espruino.com/Web+IDE#as-a-nat­ive-application

    Just to make life even more difficult it's also possible you're suffering from another issue we discovered recently - The 1v95 firmware for Puck.js seems to have some problems connecting after pairing with Windows. It should work fine when using the Native IDE direct with the CSR dongle, but pairing then connecting often seems to cause the device to reboot itself. It's something I'm looking into with Nordic at the moment and it seems to be a bug in their firmware - hopefully we'll get it sorted soon.

    ... so if you do get Windows to the point where it's showing Bluetooth LE devices you can connect to, you might want to try downgrading the Puck.js firmware to 1v94 for now - just in case that was causing you more issues.

    Hope that helps!

  • Hi Gordon,

    thank you very much for your advice!
    Then I will try connection from native Web IDE directly with the help of Zadig and WinUSB (I hope this still exists in Windows 10) this evening.

    Best regards,
    squyrrel

  • Unfortunately I had no luck.

    I installed Zadig 2.3. My CSR 4.0 dongle is visible as "Generic Bluetooth Radio", I installed the WinUSB Driver for it.
    After this, the Bluetooth section disappeared from the device manager, and the Bluetooth on/off toggle switch in the devices overview was also gone. (This was not a problem for me, as I do not use any other Bluetooth peripheral with my PC.)
    However, I like to ask whether this is expected behavior with the WinUSB driver installed?

    But it made no difference. The native Web IDE did not recognize the dongle before (only a COM1 port, which seems to be another device) and it still does not recognize it now.

    I then played around a few hours with removing and plugging the BLE dongle while installing, reinstalling and deinstalling drivers and devices in the device manager.
    But for the native Web IDE nothing changed.

    This is start of console log when having the native Windows-10 drivers:

    We have chrome.serial - not using 'serialport' module
    'noble' module couldn't be loaded, no node.js Bluetooth Low Energy Error: LIBUSB_ERROR_NOT_SUPPORTED
    Disable Web Bluetooth as we have Winnus instead
    serial_audio: Audio Sample rate : 48000
    ...

    And this is with WinUSB drivers:

    We have chrome.serial - not using 'serialport' module
    Disable Web Bluetooth as we have Winnus instead
    serial_audio: Audio Sample rate : 48000
    ...

    Now I perhaps have missed something ... I must probably try something else.
    Any help will be appreciated!

    Best regards,
    squyrrel

  • With WinUSB yes, you'd expect Windows Bluetooth functionality to disappear. If you had another bluetooth radio (eg. a built-in one) then you could still use that with Windows at the same time though.

    With WinUSB it seems really close to working - what happens in the log when you open up the connection window and leave it for a few seconds? Hopefully it should be saying something like noble starting scan, and hopefully even Found device ....

    Is it possible that your phone or some other device is still connected to Puck.js? That would be stopping it from advertising its presence which would mean you couldn't connect to it.

  • Any luck?

    If you have a Raspberry Pi kicking around you can actually set that up to connect to your Puck.js: https://github.com/espruino/EspruinoHub#­installation-of-espruinohub-and-web-ide

    The neat thing is you can program your Puck.js from anywhere (assuming you have a way to access your local network).

  • Thank you Gordon,

    I am sorry, I had no access to my PC since.
    Hopefully again this evening or tomorrow.

    From what I remember, with WinUSB (but also with native driver) the console log said that 1 device was found. It was happy that it saw a prompt, which meant that there is a device, but after sending some complex expression (can't remember exactly but I hope you know which) it said that there was only a "" response. One more line, and that was all.
    However, I believe this must be the COM1 port, which is not the BLE dongle.

    I have Bluetooth switched off (nearly) all the time on tablet and phone, so no chance that the Puck can silently pair with one of these. And switching it on, I can see the Puck advertising so it is also not paired with any other device.
    I will post the console log when trying again with WinUSB drivers.

    No Raspberry Pi here, but perhaps I will have an old Windows 7 notebook (not upgradable because of insufficient hardware) available, which has USB 2.0 ports, will give it a try then.

    Best regards,
    sqyrrel

  • Ok, installing WinUSB again with zadig, then reboot, with CRS 4.0 module plugged in.
    Then starting native Web IDE.

    This is the console log:

    We have chrome.serial - not using 'serialport' module
    Disable Web Bluetooth as we have Winnus instead
    serial_audio: Audio Sample rate : 48000
    serial_audio: Audio Serial Baud 9600 Bit time 5
    GET chrome.storage.sync = {"AUTO_SAVE_CODE":true,"BAUD_RATE":9600,­"BLOCKLY_EXTENSIONS":"|bluetooth|robot|"­,"BLOCKLY_LANGUAGE":"en","BLOCKLY_TO_JS"­:false,"BLUETOOTH_LOW_ENERGY":true,"BOAR­D_JSON_URL":"http://www.espruino.com/jso­n","CODE":"var  on = false;\nsetInterval(function() {\n  on = !on;\n  LED1.write(on);\n}, 500);","COMPILATION":true,"COMPILATION_U­RL":"http://www.espruino.com:32766","DIS­ABLE_CODE_HINTS":false,"ENABLE_Testing":­false,"ENV_ON_CONNECT":true,"FONT_SIZE":­12,"MINIFICATION_DeadCode":true,"MINIFIC­ATION_LEVEL":"","MINIFICATION_Literal":t­rue,"MINIFICATION_Mangle":true,"MINIFICA­TION_Unreachable":true,"MINIFICATION_Unu­sed":true,"MODULE_AS_FUNCTION":false,"MO­DULE_EXTENSIONS":".min.js|.js","MODULE_M­INIFICATION_LEVEL":"ESPRIMA","MODULE_PRO­XY_ENABLED":false,"MODULE_PROXY_PORT":""­,"MODULE_PROXY_URL":"","MODULE_URL":"htt­ps://www.espruino.com/modules","OFFLINE_­DATA":"","OFFLINE_DATA_DOWNLOAD":"","OFF­LINE_DATA_UPLOAD":"","OFFLINE_ENABLED":f­alse,"RESET_BEFORE_SEND":true,"SAVE_ON_S­END":0,"SERIAL_AUDIO":"0","SERIAL_TCPIP"­:"","SERIAL_THROTTLE_SEND":false,"SET_TI­ME_ON_WRITE":false,"SHOW_CODE_LINK_ICON"­:false,"SHOW_WEBCAM_ICON":0,"STORE_LINE_­NUMBERS":true,"Sound_Error":"","Sound_In­fo":"","Sound_Success":"","Sound_Warning­":"","Speak_Error":false,"Speak_Info":fa­lse,"Speak_Success":false,"Speak_Warning­":false,"UI_MODE":"Normal","WEBCAM_CONST­RAINTS":0}
    Initialising SettingsConsole
    Initialising Utils
    Initialising Config
    Initialising Notifications
    Initialising Status
    Initialising App
    Initialising File
    Initialising Code
    Initialising Serial
      - Initialising Serial Chrome Serial
      - Initialising Serial Chrome Socket
      - Initialising Serial Noble
      - Initialising Serial Windows NUS BLE
      - Initialising Serial Audio
      - Initialising Serial Web Bluetooth
    Initialising Terminal
    Initialising CodeWriter
    Initialising Modules
    Initialising Env
    Initialising Flasher
    Initialising EditorBlockly
    Initialising EditorJavaScript
    Initialising Send
    Initialising MenuPortSelector
    Initialising MenuSettings
    Initialising MenuFlasher
    Initialising SettingsAbout
    Initialising SettingsFlasher
    Initialising BoardJSON
    Initialising VersionChecker
    Initialising Compiler
    Initialising Assembler
    Initialising GetGitHub
    Initialising SetTime
    Initialising Minify
    Initialising SaveOnSend
    Initialising Tutorial
    Initialising Webcam
    Initialising FontSize
    Initialising UiMode
    Initialising URLHandler
    Initialising CodeLink
    Initialising Project
    Initialising Testing
    Initialising Notification_Sound
    Initialising Tern
    Initialising Debugger
    Initialising Tour
    Initialising SettingsProfile
    Initialising HelpLinks
    Initialising Offline
    Loaded code from storage.
    GET chrome.storage.local.OFFLINE_DATA = 0 bytes
    

    Then click the yellow "Connect/Disconnect" field, but only COM1 is avaliable.

    When choosing this, connection becomes green and status bar says CONNECTED TO PORT COM1 .
    Console log adds:

    Web Bluetooth available, but Windows Web Bluetooth is broken in <=60 - not using it
    >>> Connecting...
    Set Slow Write = true
    [object Object]
    Connected [object Object]
    Found a prompt... great!
    >>> Sending...
    ---> "\u0010console.log(\"<\",\"<<\",JSON.str­ingify(process.env),\">>\",\">\")\n"
    >>> Sent
    WARNING: No result found - just got ""
    Device found (connectionId=1)
    [success] Connected to port COM1
    

    No noble starting scan ...
    In the communications settings, "Connect over Bluetooth Smart (BTLE) via 'noble'" is enabled.
    I did not change anything there.
    What more can I check/do now?

    Thank you very much,
    squyrrel

  • Maybe here starts the problem?

    Disable Web Bluetooth as we have Winnus instead
    

    To me, this looks like Web IDE will only search for kind of "serial" devices. Like the COM1 port.

    Unfortunately I cannot find any detailed information about winnus except its github page.

    Why is Web Bluetooth superfluous now, I thought it was used for connection of the Web IDE to the Puck?
    Are there additional requirements for communicating between Web IDE and Puck using winnus?

  • There are multiple ways to connect with Bluetooth LE:

    • Web Bluetooth (not implemented fully on Chrome for Windows yet)
    • Noble - for connecting directly to the USB Bluetooth adaptor
    • Winnus - communicates with Windows 10 only

    But we shouldn't need Web Bluetooth, that's why it gets disabled for the moment.

    I'm looking into this now and I think I found a problem with how Noble is getting initialised - I'm amazed nobody other than you has come across it actually. I should have a new IDE version online in an hour or two that will hopefully fix this for you.

  • Ok, after much messing about there's a new version of the IDE available to download at http://www.espruino.com/Web+IDE

    That should fix your problems, and it should also be significantly faster. There's also a 32 bit version which will work on significantly older computers.

  • Hi Gordon,

    I really appreciate your efforts!

    I tried your modified Web IDE, and of course something has changed.
    And it it really faster.

    Now it finds the Puck but still cannot connect.
    When starting the Web IDE, console log looks like this:

    We have chrome.serial - not using 'serialport' module
    Disable Web Bluetooth as we have Winnus instead
    serial_audio: Audio Sample rate : 48000
    serial_audio: Audio Serial Baud 9600 Bit time 5
    GET chrome.storage.sync = {"AUTO_SAVE_CODE":true,"BAUD_RATE":9600,­"BLOCKLY_EXTENSIONS":"|bluetooth|robot|"­,"BLOCKLY_LANGUAGE":"en","BLOCKLY_TO_JS"­:false,"BLUETOOTH_LOW_ENERGY":true,"BOAR­D_JSON_URL":"http://www.espruino.com/jso­n","CODE":"var  on = false;\nsetInterval(function() {\n  on = !on;\n  LED1.write(on);\n}, 500);","COMPILATION":true,"COMPILATION_U­RL":"http://www.espruino.com:32766","DIS­ABLE_CODE_HINTS":false,"ENABLE_Testing":­false,"ENV_ON_CONNECT":true,"FONT_SIZE":­12,"MINIFICATION_DeadCode":true,"MINIFIC­ATION_LEVEL":"","MINIFICATION_Literal":t­rue,"MINIFICATION_Mangle":true,"MINIFICA­TION_Unreachable":true,"MINIFICATION_Unu­sed":true,"MODULE_AS_FUNCTION":false,"MO­DULE_EXTENSIONS":".min.js|.js","MODULE_M­INIFICATION_LEVEL":"ESPRIMA","MODULE_PRO­XY_ENABLED":false,"MODULE_PROXY_PORT":""­,"MODULE_PROXY_URL":"","MODULE_URL":"htt­ps://www.espruino.com/modules","OFFLINE_­DATA":"","OFFLINE_DATA_DOWNLOAD":"","OFF­LINE_DATA_UPLOAD":"","OFFLINE_ENABLED":f­alse,"RESET_BEFORE_SEND":true,"SAVE_ON_S­END":0,"SERIAL_AUDIO":"0","SERIAL_TCPIP"­:"","SERIAL_THROTTLE_SEND":false,"SET_TI­ME_ON_WRITE":false,"SHOW_CODE_LINK_ICON"­:false,"SHOW_WEBCAM_ICON":0,"STORE_LINE_­NUMBERS":true,"Sound_Error":"","Sound_In­fo":"","Sound_Success":"","Sound_Warning­":"","Speak_Error":false,"Speak_Info":fa­lse,"Speak_Success":false,"Speak_Warning­":false,"UI_MODE":"Normal","WEBCAM_CONST­RAINTS":0}
    Initialising SettingsConsole
    Initialising Utils
    Initialising Config
    Initialising Notifications
    Initialising Status
    Initialising App
    Initialising File
    Initialising Code
    Initialising Serial
      - Initialising Serial Chrome Serial
      - Initialising Serial Chrome Socket
      - Initialising Serial Noble Bluetooth LE
      - Initialising Serial Windows Bluetooth LE
      - Initialising Serial Web Audio
      - Initialising Serial Web Bluetooth
    Initialising Terminal
    Initialising CodeWriter
    Initialising Modules
    Initialising Env
    Initialising Flasher
    Initialising EditorBlockly
    Initialising EditorJavaScript
    Initialising Send
    Initialising MenuPortSelector
    Initialising MenuSettings
    Initialising MenuFlasher
    Initialising SettingsAbout
    Initialising SettingsFlasher
    Initialising BoardJSON
    Initialising VersionChecker
    Initialising Compiler
    Initialising Assembler
    Initialising GetGitHub
    Initialising SetTime
    Loaded code from storage.
    Noble: stateChange -> poweredOn
    

    And clicking on connect field, it scans and offers the Puck.js for connection!
    (It displays the MAC address as its name and in the second line (smaller) "Puck.js 3172".

    But then ....

    Noble: Starting scan
    Web Bluetooth available, but Windows Web Bluetooth is broken in <=60 - not using it
    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    >>> Connecting...
    Set Slow Write = true
    Noble: Stopping scan (openSerial)
    BT> Connecting
    BT> ERROR Connecting
    ERROR: Unable to open device (connectionInfo=undefined)
    ERROR: [notify_error] Connection Failed.
    >>> Connection Failed.
    

    I also tried this with several firmware versions of the Puck.js.
    I tried 1v95 (official), but also 1v94, 1v95.153 (latest) and 1v95.157, they all behaved the same.
    Having WinUSB driver installed on PC all the time.

    Thought I saw some similar problems in this form, but perhaps not exactly the same.
    Maybe there is a solution now, somehow, probably its just a little change of whatsoever.

    Any more advice for me?

    Best regards,
    squyrrel

  • That looks so close! Did anything happen on Puck.js's LEDs during the connection process?

    Please can you flash 1v95.153, then hold down the button for ~10 seconds while restarting it so that all 3 lights light, then you get 5 flashes of the red LED (all the while holding the button down). That should clear out any saved pairing data that could possibly have caused problems when connecting (if you had pairing data left over from trying to pair when you were using the USB dongle on Windows).

  • Hi Gordon,

    I did what you suggested, and it worked! Could connect to the Puck, and enter "1-2" on the left pane, and it replied "=-1"! Yeah!
    Then I disconnected for the moment and had a look at the console log.

    This is the log, from starting at "Found UART device":

    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    >>> Connecting...
    Set Slow Write = true
    Noble: Stopping scan (openSerial)
    BT> Connecting
    BT> Connected
    Connected [object Object]
    Found a prompt... great!
    >>> Sending...
    ---> "\u0010console.log(\"<\",\"<<\",JSON.str­ingify(process.env),\">>\",\">\")\n"
    BT> Sending "\u0010console.log(\"<"
    BT> Sending "\",\"<<\",JSON.str"
    BT> Sending "ingify(process."
    BT> Sending "env),\">>\",\">\")\n"
    >>> Sent
    WARNING: Serial port implementation is not returning ArrayBuffers
    WARNING: Serial port implementation is not returning ArrayBuffers
    WARNING: Serial port implementation is not returning ArrayBuffers
    WARNING: Serial port implementation is not returning ArrayBuffers
    WARNING: Serial port implementation is not returning ArrayBuffers
    WARNING: Serial port implementation is not returning ArrayBuffers
    WARNING: Serial port implementation is not returning ArrayBuffers
    WARNING: Serial port implementation is not returning ArrayBuffers
    WARNING: Serial port implementation is not returning ArrayBuffers
    WARNING: Serial port implementation is not returning ArrayBuffers
    WARNING: Serial port implementation is not returning ArrayBuffers
    WARNING: Serial port implementation is not returning ArrayBuffers
    WARNING: Serial port implementation is not returning ArrayBuffers
    WARNING: Serial port implementation is not returning ArrayBuffers
    Got "< << {\"VERSION\":\"1v95.153\",\"BUILD_DATE\"­:\"Jan 25 2018\",\"BUILD_TIME\":\"08:53:16\",\"GIT­_COMMIT\":\"cef34f5483ea097d2c6362b59b7b­a6e11db1317d\",\"BOARD\":\"PUCKJS\",\"CH­IP\":\"NRF52832\",\"CHIP_FAMILY\":\"NRF5­2\",\"FLASH\":524288,\"RAM\":65536,\"SER­IAL\":\"587534d5-e58df20b\",\"CONSOLE\":­\"Bluetooth\"} >> >\r\n>"
    Loading http://www.espruino.com/json/PUCKJS.json­
    Board JSON loaded
    Firmware >1.43 supports faster writes over USB
    Set Slow Write = false
    FIRMWARE: Current 1v95.153, Available 1v95
    Device found (connectionId=undefined)
    [success] Connected to port ff:cd:8a:a3:31:72
    >>> Connected to port ff:cd:8a:a3:31:72
    BT> Sending "\r"
    WARNING: Serial port implementation is not returning ArrayBuffers
    BT> Sending "\r"
    WARNING: Serial port implementation is not returning ArrayBuffers
    BT> Sending "1"
    WARNING: Serial port implementation is not returning ArrayBuffers
    BT> Sending "-"
    WARNING: Serial port implementation is not returning ArrayBuffers
    BT> Sending "2"
    WARNING: Serial port implementation is not returning ArrayBuffers
    BT> Sending "\r"
    WARNING: Serial port implementation is not returning ArrayBuffers
    Disconnect callback...
    WARNING: [notify_warn] Disconnected
    >>> Disconnected
    
    

    There still seems to be a little problem with the serial port implementation, but nothing bad.

    But then I wanted to connect again, and this time it failed.
    And since then, it always failed. I could only connect once, never again.
    I restarted the Web IDE, cleared the Puck's data again, reprogrammed the Puck with 1v94 and then with 1v95.153, cleared again, even restarted my PC, but nothing helps.
    Connecting always results in

    Noble: Starting scan
    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    Noble: Found UART device: Puck.js 3172 ff:cd:8a:a3:31:72
    >>> Connecting...
    Set Slow Write = true
    Noble: Stopping scan (openSerial)
    BT> Connecting
    BT> ERROR Connecting
    ERROR: Unable to open device (connectionInfo=undefined)
    ERROR: [notify_error] Connection Failed.
    >>> Connection Failed.
    

    Perhaps you have one more idea?

    At the time when connection worked, I fidgeted with a freshly unboxed raspi 3 - perhaps I should just place it on the table next to my keyboard and the reluctant Puck ...

    Best regards,
    squyrrel

    Edit:
    well, now I could connect once again!
    Just cannot figure why it works this time. Perhaps waiting a while not doing anything, then trying to connect, gives a better chance?

  • Glad it's going - ish.

    I'm not sure what to suggest about the connecting issues though. When you do get connected, could you just check Puck.getBatteryPercentage() and see what it says? I know repeatedly flashing can take it out of the batteries so I guess there's a small chance that it could be low, which can make connecting unstable - but it seems super unlikely.

    ... but as you have a Pi 3 now you could give EspruinoHub a try, which should be a bit more reliable - at least I hope there's no difference between it and the Pi 3 I have here which works great :)

  • Hi Gordon,

    (sorry for my name change, did this for practical reasons),
    i did not use the PI 3 yet (too impatient for configuring it right now) but tried a bit more with the Web IDE.
    The Puck is a very nice toy for embedded programming with Javascript, I like it.

    What I found is that chances for connecting with Puck seems to increase dramatically when closing the Chrome browser on Windows 10.
    Perhaps this may give an indication of the reason for connection problems?

    Best regards,
    squyrrel

  • chances for connecting with Puck seems to increase dramatically when closing the Chrome browser on Windows 10.

    That is very strange - so using the Native IDE, but whether Chrome is open or closed changes things?

    You had mentioned you had been trying Web Bluetooth out on Chrome Canary? If you'd had any Web Bluetooth pages open that definitely would have messed things up.

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

How connect to Puck.js on Windows 10 Desktop with Creators Update?

Posted by Avatar for squyrrel @squyrrel

Actions