-
Yeah the phone stays connected ok it seems. At least enough to upload the sketches a few times changing the LED number.
Well this is an Intel Bluetooth module. (8087:0a2b) so should be pretty well supported. Restarting the bluetooth will show the puck again and connect but then it will drop after a while. I was repeatedly sending
Puck.getBatteryPercentage()
and I did that for about 11 times every 2 or so seconds. Then I got to typing the the example sketchvar on = false;
=false
setInterval(function() {on =!on; LED1.write(on); }, 500);
Press Ctrl-C again to exitI literally got to the last char and then pressed return and nada. It became unresponsive so I had to Cntrl-C it.
I shall investigate if there are some tweaks for my bluetooth connection. Because it does seem whatever happened it has become worse ;)
Thanks for the help.
-
Yeah, well that seems to have gotten us a little closer. Look what verbose revealed.
espruino --list --verbose
0.0.33 Espruino Command-line Tool 0.0.33
-----------------------------------
Acorn library not found - you'll need it for compiled code Found
/usr/local/lib/node_modules/espruino/libs/targz.js Found
/usr/local/lib/node_modules/espruino/libs/utf8.js Found
/usr/local/lib/node_modules/espruino/espruino.js Found
/usr/local/lib/node_modules/espruino/core/codeWriter.js Found
/usr/local/lib/node_modules/espruino/core/config.js Found
/usr/local/lib/node_modules/espruino/core/env.js Found
/usr/local/lib/node_modules/espruino/core/flasher.js Found
/usr/local/lib/node_modules/espruino/core/modules.js Found
/usr/local/lib/node_modules/espruino/core/notifications.js Found
/usr/local/lib/node_modules/espruino/core/serial.js Found
/usr/local/lib/node_modules/espruino/core/serial_audio.js Found
/usr/local/lib/node_modules/espruino/core/serial_chrome.js Found
/usr/local/lib/node_modules/espruino/core/serial_noble.js 'noble'
module couldn't be loaded, no node.js Bluetooth Low Energy { [Error:
Cannot find module 'bluetooth-hci-socket'] code: 'MODULE_NOT_FOUND' }
Found /usr/local/lib/node_modules/espruino/core/serial_nodeserial.js
No 'serialport' module found Found
/usr/local/lib/node_modules/espruino/core/serial_socket.js No
chrome.sockets - serial_socket disabled Found
/usr/local/lib/node_modules/espruino/core/serial_web_bluetooth.js No
navigator.bluetooth - Web Bluetooth not enabled Found
/usr/local/lib/node_modules/espruino/core/serial_websocket.js Found
/usr/local/lib/node_modules/espruino/core/serial_winnus.js 'winnus'
module not found, no Windows Bluetooth Low Energy { [Error: Cannot
find module 'winnus'] code: 'MODULE_NOT_FOUND' } Found
/usr/local/lib/node_modules/espruino/core/settingsAbout.js Found
/usr/local/lib/node_modules/espruino/core/status.js Found
/usr/local/lib/node_modules/espruino/core/terminal.js Found
/usr/local/lib/node_modules/espruino/core/utils.js Found
/usr/local/lib/node_modules/espruino/plugins/_examplePlugin.js Found
/usr/local/lib/node_modules/espruino/plugins/assembler.js Found
/usr/local/lib/node_modules/espruino/plugins/boardJSON.js Found
/usr/local/lib/node_modules/espruino/plugins/compiler.js Found
/usr/local/lib/node_modules/espruino/plugins/getGitHub.js Found
/usr/local/lib/node_modules/espruino/plugins/localModules.js Found
/usr/local/lib/node_modules/espruino/plugins/minify.js Found
/usr/local/lib/node_modules/espruino/plugins/npmModules.js Found
/usr/local/lib/node_modules/espruino/plugins/saveOnSend.js Found
/usr/local/lib/node_modules/espruino/plugins/setTime.js Found
/usr/local/lib/node_modules/espruino/plugins/uiMode.js Found
/usr/local/lib/node_modules/espruino/plugins/unicode.js Found
/usr/local/lib/node_modules/espruino/plugins/versionChecker.js
Initialising CodeWriter Initialising Config Initialising Env
Initialising Flasher Initialising Modules Initialising Notifications
Initialising Serial Initialising SettingsAbout Initialising Status
Initialising Utils Initialising ExamplePlugin Initialising Assembler
Initialising BoardJSON Initialising Compiler Initialising GetGitHub
Initialising LocalModules Initialising Minify Initialising NPMModules
Initialising SaveOnSend Initialising SetTime Initialising UiMode
Initialising Unicode Initialising VersionChecker Searching for serial
ports... PORTS:Turns out that both noble and bluetooth-hci-socket both need to be installed globally as well:
npm -g install noble bluetooth-hci-socket
espruino --list Espruino Command-line Tool 0.0.33
-----------------------------------
PORTS: f8:37:bb:11:74:a7 (Puck.js 74a7)
Woo Hoo! Now finally it connects. At least long enough to get Battery status.
espruino --verbose -p f8:37:bb:11:74:a7
0.0.33 Espruino Command-line Tool 0.0.33
-----------------------------------
Acorn library not found - you'll need it for compiled code Found
/usr/local/lib/node_modules/espruino/libs/targz.js Found
/usr/local/lib/node_modules/espruino/libs/utf8.js Found
/usr/local/lib/node_modules/espruino/espruino.js Found
/usr/local/lib/node_modules/espruino/core/codeWriter.js Found
/usr/local/lib/node_modules/espruino/core/config.js Found
/usr/local/lib/node_modules/espruino/core/env.js Found
/usr/local/lib/node_modules/espruino/core/flasher.js Found
/usr/local/lib/node_modules/espruino/core/modules.js Found
/usr/local/lib/node_modules/espruino/core/notifications.js Found
/usr/local/lib/node_modules/espruino/core/serial.js Found
/usr/local/lib/node_modules/espruino/core/serial_audio.js Found
/usr/local/lib/node_modules/espruino/core/serial_chrome.js Found
/usr/local/lib/node_modules/espruino/core/serial_noble.js Found
/usr/local/lib/node_modules/espruino/core/serial_nodeserial.js No
'serialport' module found Found
/usr/local/lib/node_modules/espruino/core/serial_socket.js No
chrome.sockets - serial_socket disabled Found
/usr/local/lib/node_modules/espruino/core/serial_web_bluetooth.js No
navigator.bluetooth - Web Bluetooth not enabled Found
/usr/local/lib/node_modules/espruino/core/serial_websocket.js Found
/usr/local/lib/node_modules/espruino/core/serial_winnus.js 'winnus'
module not found, no Windows Bluetooth Low Energy { [Error: Cannot
find module 'winnus'] code: 'MODULE_NOT_FOUND' } Found
/usr/local/lib/node_modules/espruino/core/settingsAbout.js Found
/usr/local/lib/node_modules/espruino/core/status.js Found
/usr/local/lib/node_modules/espruino/core/terminal.js Found
/usr/local/lib/node_modules/espruino/core/utils.js Found
/usr/local/lib/node_modules/espruino/plugins/_examplePlugin.js Found
/usr/local/lib/node_modules/espruino/plugins/assembler.js Found
/usr/local/lib/node_modules/espruino/plugins/boardJSON.js Found
/usr/local/lib/node_modules/espruino/plugins/compiler.js Found
/usr/local/lib/node_modules/espruino/plugins/getGitHub.js Found
/usr/local/lib/node_modules/espruino/plugins/localModules.js Found
/usr/local/lib/node_modules/espruino/plugins/minify.js Found
/usr/local/lib/node_modules/espruino/plugins/npmModules.js Found
/usr/local/lib/node_modules/espruino/plugins/saveOnSend.js Found
/usr/local/lib/node_modules/espruino/plugins/setTime.js Found
/usr/local/lib/node_modules/espruino/plugins/uiMode.js Found
/usr/local/lib/node_modules/espruino/plugins/unicode.js Found
/usr/local/lib/node_modules/espruino/plugins/versionChecker.js
Initialising CodeWriter Initialising Config Initialising Env
Initialising Flasher Initialising Modules Initialising Notifications
Initialising Serial- Initialising Serial Noble Initialising SettingsAbout Initialising Status Initialising Utils Initialising ExamplePlugin Initialising
Assembler Initialising BoardJSON Initialising Compiler Initialising
GetGitHub Initialising LocalModules Initialising Minify Initialising
NPMModules Initialising SaveOnSend Initialising SetTime Initialising
UiMode Initialising Unicode Initialising VersionChecker Connecting to
'f8:37:bb:11:74:a7' noble starting scan Port "f8:37:bb:11:74:a7" not
found - checking ports again (2 attempts left) noble starting scan
Found UART device: Puck.js 74a7 f8:37:bb:11:74:a7 noble stopping scan
BT> Connecting BT> Connected Connected {} BT> Sending "\n" Received a
prompt after sending newline... good!
>>> Sending...
---> "\u0010console.log(\"<\",\"<<\",JSON.stringify(process.env),\">>\",\">\")\n"
BT> Sending "\u0010console.log(\"<" BT> Sending "\",\"<<\",JSON.str"
BT> Sending "ingify(process." BT> Sending "env),\">>\",\">\")\n"
>>> Sent Got "< << {\"VERSION\":\"1v93\",\"BUILD_DATE\":\"Aug 21 2017\",\"BUILD_TIME\":\"15:32:25\",\"GIT_COMMIT\":\"7237347960825c8a36d706e3bc1dcfa60e3caedc\",\"BOARD\":\"PUCKJS\",\"CHIP\":\"NRF52832\",\"CHIP_FAMILY\":\"NRF52\",\"FLASH\":524288,\"RAM\":65536,\"SERIAL\":\"852140da-3f75e857\",\"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 1v93, Available 1v93 Connected BT> Sending
"\r"
=undefined
BT> Sending "Puck.getBatteryPerce" BT> Sending "ntage()" Puck.getBatteryPercentage()BT> Sending "\r"
=100
But wait a few seconds and it becomes unresponsive again :(
=100
BT> Sending "\r"
It does not even say timed out or anything. Just becomes unresponsive when I type anything.
Weird.
- Initialising Serial Noble Initialising SettingsAbout Initialising Status Initialising Utils Initialising ExamplePlugin Initialising
-
Yes I did use Google Chrome on my phone. However after a restart of my phone it seemed to work. That is I was able to connect to it using Chrome WebIDE and upload the sample sketch. Which I have not been able to do for a while now. Trouble is it is VERY fiddly trying to type anything via the phone.
I have rebooted my laptop 'just in case'. No joy.
Ironically enough I did just install
npm install espruino
there are a few slight modifications you need to use for Debian though. The package is called nodejs as is the resultant binary. Still I did runsudo setcap cap_net_raw+eip $(eval readlink -fwhich nodejs)
and that seemed fine. You then need to link node to nodejsln -s /usr/bin/nodejs /usr/bin/node
Howeverespruino --list
just gives meespruino --list
Espruino Command-line Tool 0.0.33-----------------------------------
PORTS:
Which does not bode well. Oddly enough it still sees the puck when scanning for it in the browser. So not sure what is going on here.
-
Please could you install the cutting edge Puck.js build from here: http://www.espruino.com/binaries/travis/master/
So I flashed the espruino_1v93_puckjs.zip 2017-08-21 16:32 263K
md5sum: bbec17e5f851057ffb2214bf5c5ec145 espruino_1v93_puckjs.zip
Reset it like you suggested till all 3 LEDs lit but now I seem unable to connect to it via the IDE from both the laptop and the phone now!? I can connect to it via nRFTool box and this is what I get back from the limited log.
nRF Connect, 2017-08-22 Puck.js 74a7 (F8:37:BB:11:74:A7)
V 10:03:34.757 Connecting to F8:37:BB:11:74:A7... D 10:03:34.758 gatt
= device.connectGatt(autoConnect = false, TRANSPORT_LE) D 10:03:35.342 [Callback] Connection state changed with status: 0 and
new state: CONNECTED (2) I 10:03:35.343 Connected to F8:37:BB:11:74:A7
D 10:03:35.343 [Broadcast] Action received:
android.bluetooth.device.action.ACL_CONNECTED
V 10:03:35.361 Discovering services...
D 10:03:35.361 gatt.discoverServices() D 10:03:35.746 [Callback]
Services discovered with status: 0 I 10:03:35.749 Services discovered
V 10:03:35.790 Generic Access (0x1800)- Device Name R W
- Appearance R
- Peripheral Preferred Connection Parameters R
- Central Address Resolution R Generic Attribute (0x1801) Nordic UART Service (6e400001-b5a3-f393-e0a9-e50e24dcca9e)
- TX Characteristic N Client Characteristic Configuration (0x2902)
- RX Characteristic W WNR V 10:03:42.473 Reading all characteristics... V 10:03:42.473 Reading
characteristic 00002a00-0000-1000-8000-00805f9b34fb
D 10:03:42.473 gatt.readCharacteristic(00002a00-0000-1000-8000-00805f9b34fb)
V 10:03:42.503 Reading characteristic
00002a01-0000-1000-8000-00805f9b34fb
D 10:03:42.503 gatt.readCharacteristic(00002a01-0000-1000-8000-00805f9b34fb)
I 10:03:42.504 Read Response received from
00002a00-0000-1000-8000-00805f9b34fb, value: (0x)
50-75-63-6B-2E-6A-73-20-37-34-61-37, "Puck.js 74a7"
A 10:03:42.504 "Puck.js 74a7" received V 10:03:42.539 Reading
characteristic 00002a04-0000-1000-8000-00805f9b34fb
D 10:03:42.539 gatt.readCharacteristic(00002a04-0000-1000-8000-00805f9b34fb)
I 10:03:42.539 Read Response received from
00002a01-0000-1000-8000-00805f9b34fb, value: (0x) 00-00
A 10:03:42.539 "[0] Unknown" received I 10:03:42.578 Read Response
received from 00002a04-0000-1000-8000-00805f9b34fb, value: (0x)
06-00-10-00-00-00-90-01 A 10:03:42.578 "Connection Interval: 7.50ms -
20.00ms, Slave Latency: 0, Supervision Timeout Multiplier: 400" received V 10:03:42.579 Reading characteristic
00002aa6-0000-1000-8000-00805f9b34fb
D 10:03:42.579 gatt.readCharacteristic(00002aa6-0000-1000-8000-00805f9b34fb)
V 10:03:42.633 4 characteristics read I 10:03:42.633 Read Response
received from 00002aa6-0000-1000-8000-00805f9b34fb, value: (0x) 01
A 10:03:42.633 "Address resolution supported" received
D 10:03:55.244 wait(400) D 10:03:55.645 wait(1200)
V 10:04:26.147 Enabling services... V 10:04:26.147 Enabling
notifications for 6e400003-b5a3-f393-e0a9-e50e24dcca9e
D 10:04:26.148 gatt.setCharacteristicNotification(6e400003-b5a3-f393-e0a9-e50e24dcca9e,
true)
D 10:04:26.151 gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb,
value=0x0100) I 10:04:26.190 Data written to descr.
00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
A 10:04:26.190 "Notifications enabled" sent
V 10:04:26.200 Notifications enabled for
6e400003-b5a3-f393-e0a9-e50e24dcca9e V 10:04:26.200 All services
enabled V 10:04:35.524 Reading remote RSSI...
D 10:04:35.524 gatt.readRemoteRssi() I 10:04:35.539 Remote RSSI
received: -56 dBm
Does that help at all?
- Device Name R W
-
No joy alas. Even with Chrome it does the same
.For the record I am using Debian 9.0 (testing) Kernel 4.12.0-1 and bluetoothd is 5.45
Like I say though, it is not just my laptop that seems to have problems keeping a connection my phone does too. A Samsung S7.
Now the odd thing is that before on an older firmware I did not seem to have such problems but of course that was a few months back so hard to say what has changed.
Anyway to debug BLE connections? I would be curious to know if it is the Puck dropping the connection or the computer.
Thanks.
-
Did the reset and seemed ok for a minute but then just disconnected again and went back to being erratic. What I find different is the fact I keep on having to hit pair with the device when it disconnects even though it is a saved connection. (you can see in the video is show it as (paired) but asks to pair again.
Not sure what is going on here. But seems the my phone is also dropping the connection to the puck not just my laptop.
Odd.
-
Ok this is starting to get very frustrating. I have updated firmware before ok but for some reason now the puck0js won't stay in bootloader mode. That is I hold the button insert the battery release button and LED turns red. It stays red for about 10 seconds then turns off. Or if I am very quick and try to connect to it using nRF tools it will also drop out of bootloader mode.
What the hell is going on. I have not touched the puck in months (family issues to deal with) but I am pretty sure it was on firmware 1.90. I want to update to the latest 1.93 but cannot if I cannot get the damn thing to stick on bootloader mode.
Any ideas?
-
-
Hi,
So I flashed my PuckJS firmware to 1.90 following the instructions given. Pity I had to use my phone to do it, there ought to be a way to do it from the IDE or from the command line.
But I noticed that in the zip binary you are told to download there is no changelog. So where is the changelog for the firmware documented? I would like to know what new or deprecated features are changes and what bugs there were that have been squashed.
Anyone know where to find the details on this?
Thanks.
-
What about running node server.js?
Woo hoo! Now why is that not in the faq? What is cool is it even tells you your device is not compatible and asks you to set the correct one.
node server.js Thu Jan 05 2017 10:46:30 GMT+0000 (GMT) Server is listening on port 8080 noble warning: adapter does not support Bluetooth Low Energy (BLE, Bluetooth Smart). Try to run with environment variable: [sudo] NOBLE_HCI_DEVICE_ID=x node ...
So
NOBLE_HCI_DEVICE_ID=1 node server.js
works!!
Thank you so much. It was getting quite frustrating and I really think this sort of thing needs to be put into the documentation for the IDE.
Excellent now I can start with earnest tinking with my Pucks I have a few specific idea I need to test.
Thanks once again!!
-
Yeah.. I did that.. I even managed to connect to the PuckJS using bluetoothctl.
[bluetooth]# devices
Device F8:37:BB:11:74:A7 Puck.js 74a7
[bluetooth]# connect F8:37:BB:11:74:A7
Attempting to connect to F8:37:BB:11:74:A7
[CHG] Device F8:37:BB:11:74:A7 Connected: yes
Connection successfulSadly, Chrome like the braindead piece of software it is does not see that there is a device already connected to the default device and continues to try and probe hci0 and seeing nothing.
I have tried building the IDE from git and got a little further by just removing the requirement of winnus from the package.json file.
it 'installed' fine. But when I do npm start
npm start espruino-web-ide@0.65.11 start /home/user/devel/git/EspruinoWebIDE nw . Usage: nw-gyp <command> [options] where <command> is one of: - build - Invokes `make` and builds the module - clean - Removes any generated build files and the "out" dir - configure - Generates a Makefile for the current module - rebuild - Runs "clean", "configure" and "build" all at once - install - Install node development files for the specified node version. - list - Prints a listing of the currently installed node development files - remove - Removes the node development files for the specified version nw-gyp@3.4.0 /usr/local/lib/node_modules/nw-gyp node@4.6.1
However, now I have some sort of weird incompatibility with node-gyp and whatever build file it uses.
nw configure . gyp info it worked if it ends with ok gyp info using nw-gyp@3.4.0 gyp info using node@4.6.1 | linux | x64 gyp ERR! configure error gyp ERR! stack Error: Invalid version number: undefined gyp ERR! stack at getNodeDir (/usr/local/lib/node_modules/nw-gyp/lib/configure.js:71:25) gyp ERR! stack at /usr/local/lib/node_modules/nw-gyp/lib/configure.js:43:7 gyp ERR! stack at /usr/local/lib/node_modules/nw-gyp/lib/configure.js:460:9 gyp ERR! stack at ChildProcess.exithandler (child_process.js:204:7) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at maybeClose (internal/child_process.js:829:16) gyp ERR! stack at Socket.<anonymous> (internal/child_process.js:319:11) gyp ERR! stack at emitOne (events.js:77:13) gyp ERR! stack at Socket.emit (events.js:169:7) gyp ERR! System Linux 4.8.0-2-amd64 gyp ERR! command "/usr/bin/nodejs" "/usr/local/bin/nw" "configure" "." gyp ERR! cwd /home/user/devel/git/EspruinoWebIDE gyp ERR! node -v v4.6.1 gyp ERR! nw-gyp -v v3.4.0 gyp ERR! not ok
To be honest I would feel happier if I was trying to debug a C++ program because nodejs gives me a headache.
sighs
-
The winnus bit failed, but that's optional and for windows only
Hmm I was under the impression nodejs was cross platform. I mean what is winnus used for and is there a Linux equivalent to it I can add to the build options?
I will see if I can convince Chrome to play nice but seems non-trivial alas.
Thanks anyway, I put this question in Espruino because it was an IDE problem not an puck one per se. I can communicate to the puck from my phone, that is not so convienient though.
Thanks again.
-
Hi there,
So tried building EspruinoWebIDE from git and it fails because of a newer version of nodejs.
See attached file.
Also the Chrome app does not see my 2nd BLE adapter which is hci1. The adapter can see the PuckJS but the webide does not because it using hci0 be default.
hcitool -i hci1 lescan
LE Scan ...
F8:37:BB:11:74:A7 Puck.js 74a7
F8:37:BB:11:74:A7 (unknown)Any idea how to solve these problems?
Thanks.
Ok .. something definitely to do with the driver because this pops up in the logs:
I'll chat to the bluetooth subsystem guys see if I can get a definitive answer to what is going on.