Most recent activity
-
- 19 comments
- 5,431 views
-
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 .. 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.