-
• #2
Check the battery voltage or swap with a fresh battery...
-
• #3
You may be right.. Not sure. But I see the green LED looks very weak. (see video) Would be nice if there was some way to determine the battery voltage externally. Hey ho.
Edit: won't let me upload the video. Here is a link to it instead.
-
• #4
Wow, yes, that green LED is super-dim. It's very likely it's your battery then. The red runs off a lower voltage so would still appear bright on a low battery - it'd still be alight when the microcontroller rebooted due to lack of power.
When Espruino is working you can connect and call Puck.getBatteryPercentage() to get an idea of the amount of battery power you have left - but before then, if you don't have a volt meter, looking at the LED brightness is about all you can do.
-
• #5
Yeah.. so changed battery managed to upgrade firmware to 1.93 now though I seem unable to connect to it.
Hmmm.
-
• #6
Could you close/reopen the IDE? It seems to be in kind of an odd state.
Does anything happen on Puck.js during that time?
You could also try booting Puck.js with the button held down until all 3 LEDs come on. On 1v93 that should clear out any pairing information (or garbage that might have got left in that area from older versions of the firmware).
-
• #7
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.
-
• #8
Looks like you're on Linux? Close the chrome tab, and try
sudo /etc/init.d/bluetooth restart
- if you're on earlier versions of the bluetooth library, the library itself gets confused and stops working.Maybe check the version with
bluetoothd --version
- nothing before 5.43 will work properly.Also, install Chrome, not Chromium. Last time someone had a problem with Linux, that seemed to be the biggest issue (having to hit 'Pair' is fine though - that's just what the windows says all the time).
When you do manage to get a connection, please can you also check
Puck.getBatteryPercentage()
just in case? -
• #9
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.
-
• #10
I'm not 100% sure about the connection debugging - I know you can put your phone in Debug mode and can dump Bluetooth info over USB, but I've never done it. You could also try connecting with 'nRF connect' on Android to see if that manages.
Please could you install the cutting edge Puck.js build from here: http://www.espruino.com/binaries/travis/master/
And once flashed, put the battery in with the button held down until all 3 lights light up. On the recent builds (1v93 doesn't have it), doing that will wipe all bonding/pairing data from the Puck and will skip loading any saved code -which I guess could potentially have been a problem.
-
• #11
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
-
• #12
So the nRF toolbox can connect and stays connected?
And are you using Chrome on your Samsung phone, or Samsung's own browser?
Have you tried restarting your laptop between times in case there is some issue with the bluetooth library? I know mine's running Bluez 5.45 and can still get confused and require a bluetoothd restart at times.
Your other option is to
npm install espruino
, runsudo setcap cap_net_raw+eip $(eval readlink -f
which node)
and thenespruino --list
andespruino -p address_to_connect_to
.That'll use Bluetooth on your PC without going through Chrome's Web Bluetooth.
-
• #13
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.
-
• #14
Ok, well at least that confirms it's not something actually wrong with Puck.js. You can use the Web IDE relay - but that's pretty fiddly too: http://forum.espruino.com/conversations/300770/
You might be able to install
nodejs-legacy
(I think?) to getnode
.You could try
espruino --list --verbose
to see if it tells you anything interesting related to noble/bluetooth/BLE.It sounds a lot like something updated on your computer and caused you problems though. Perhaps the firmware for your bluetooth/wifi adaptor got updated and introduced some BLE problem? You could try an external BLE dongle?
-
• #15
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
-
• #16
That is really strange... But it doesn't become unresponsive when used from your phone?
You could actually try stopping the Bluetooth daemon completely and try again? I think Noble goes direct to the Bluetooth adaptor.
If you're up for it I'd say a £5 bluetooth LE dongle might be worth a try? I know on my laptop the bluetooth adaptor behaves pretty badly under Linux (seems reliable on Windows), but sling a cheap dongle in the side and it's pretty solid.
-
• #17
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.
-
• #18
Well this is an Intel Bluetooth module. (8087:0a2b) so should be pretty well supported.
... that's exactly what I have in my laptop! So yeah, I imagine that won't be helping.
If you do find a solution, please share it because I'd love to be able to fix it as well! As it is, I tend to use an external USB BLE dongle when I absolutely have to be sure of the connection.
Having said that, it looks like I have more success with it than you do - it usually works ok for me, and it's just occasionally it decides it's not going to work.
-
• #19
Ok .. something definitely to do with the driver because this pops up in the logs:
[Tue Aug 22 14:49:26 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 14:49:28 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 14:49:37 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 14:49:39 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 14:49:45 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 14:49:47 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 14:50:00 2017] Bluetooth: hci0 command 0x0c1a tx timeout
[Tue Aug 22 15:01:30 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 15:01:32 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 15:01:34 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 15:01:36 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 15:01:51 2017] Bluetooth: hci0 command 0x0c1a tx timeout
[Tue Aug 22 15:12:17 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 15:12:19 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 15:12:22 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 15:12:24 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 15:21:07 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 15:21:09 2017] Bluetooth: hci0 command 0x200c tx timeout
[Tue Aug 22 15:22:25 2017] usbcore: deregistering interface driver
btusb [Tue Aug 22 15:22:25 2017] Bluetooth: hci0 urb ffff9b81a786e6c0
failed to resubmit (2) [Tue Aug 22 15:22:49 2017] usbcore: registered
new interface driver btusb [Tue Aug 22 15:22:49 2017] Bluetooth: hci0:
Firmware revision 0.1 build 82 week 37 2016 [Tue Aug 22 15:25:24 2017]
Bluetooth: hci0 command 0x200c tx timeout [Tue Aug 22 15:25:26 2017]
Bluetooth: hci0 command 0x200c tx timeout [Tue Aug 22 15:25:43 2017]
Bluetooth: hci0 command 0x0c1a tx timeout [Tue Aug 22 15:27:35 2017]
Bluetooth: hci0 command 0x0c1a tx timeout [Tue Aug 22 15:29:45 2017]
Bluetooth: hci0 command 0x200c tx timeout [Tue Aug 22 15:29:47 2017]
Bluetooth: hci0 command 0x200c tx timeoutI'll chat to the bluetooth subsystem guys see if I can get a definitive answer to what is going on.
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?