-
• #2
I hit the post character limit, so here's a little more info about the board:
VERSION 2v18 GIT_COMMIT 7171b2832 BOARD BANGLEJS2 RAM 262144 FLASH 1048576 SPIFLASH 8388608 HWVERSION 2 STORAGE 8388608 SERIAL 366870f4-6dfecf14 CONSOLE Bluetooth MODULES Flash,Storage,heatshrink,crypto,tensorflow,locale EXPTR 485764 APP_RAM_BASE 536882880
And Bangle bluetooth settings:
BLE: Checked Programmable: Checked HID: Off Passkey BETA: none Whitelist: on
Code I'm trying to send to RAM:
console.log("hello world"); Bangle.beep(200,220.00*8);
Additionally, I have written at least one custom app, got the app loaded running in a fork, and uploaded my app on the device, and that all works fine. I did have a few hiccups with connections and loading working initially but restarting the device seemed to fix things. The only issue I'm experiencing is with the IDE upload feature.
-
• #3
I always feel a little goofy when I solve my own problems only moments after posting about them on these forums, but apparently I have no problem anymore:
Steps to resolve:
Update and restart computer.
Try exact same thing again.
Note that this time the Banglejs2 device was NOT in the list for connections in the IDE, I had to pick web bluetooth and pair with it again.
Everything just seems to work now. Didn't restart the bangle or anything.
Huzzah!
Edit: A similar, or the same issue has arisen again, this time with the app launcher. I am going to reboot my computer again to see if it still resolves the issue.
<BLE> Device Name: Bangle.js dbad puck.js:408 <BLE> Device ID: mhStQJUeTW1Tlah21FzG+Q== puck.js:408 <BLE> Connected comms.js:231 <COMMS> Ctrl-C gave "" comms.js:278 <COMMS> getDeviceInfo Object loader.js:85 sendUsageStats: Submitting usage stats... index.js:941 Current device time is Mon Jun 05 2023 23:23:04 GMT-0400 (Eastern Daylight Time) loader.js:91 sendUsageStats (200): espruinotools.js:139 Minifying espruinotools.js:139 Minification complete espruinotools.js:139 Minifying espruinotools.js:139 Minification complete comms.js:150 <COMMS> uploadApp: barometer.app.js, barometer.img, barometer.info comms.js:41 <COMMS> reset comms.js:43 <COMMS> reset: got "\u001b[?7l\r\n ____ _ \r\n| __|___ ___ ___ _ _|_|___ ___ \r\n| __|_ -| . | _| | | | | . |\r\n|____|___| _|_| |___|_|_|_|___|\r\n |_| espruino.com\r\n 2v18 (c) 2021 G.Williams\r\n\r\n>" comms.js:52 <COMMS> reset: rebooted - sending commands to clear out any boot code puck.js:408 <BLE> SEND ERROR: NotSupportedError: GATT operation failed for unknown reason. puck.js:408 <BLE> Disconnected (gattserverdisconnected)
Edit: Yes that fixed it again. The issue seems to be associated with whether or not the bangle appears "paired" already in the 'connection' dialogue. I suspect a similar thing is going on between both the web IDE and the app loader.
I notice if I navigate in chrome to : chrome://bluetooth-internals/#devices
I can see my device (DB:AD) and it sometimes shows stuff in the services column and even shows "connected" at times despite not being in the "connected" state in the app loader. Fiddling around with the "forget" and "disconnect" buttons in the chrome bluetooth management tab seemed to eventually get the app loader to work again. -
• #4
Sometimes something similar happens to me - it always disconnects when I copy paste to left side of IDE while typing stuff letter by letter works. Reloading the page with shift key clears the cache and it often helps in this case. Next time I'll also try the chrome://bluetooth-internals/#devices
-
• #5
Wow, that's an odd problem - glad you got it working (kindof) though.
What type of computer and browser do both of you have?
I wonder whether again this could be MTU related - the IDE will try and use a higher MTU if it receives that much data, but perhaps there is some issue writing it. In the App Loader at least there's a setting (
Bluetooth Compatibility mode
) that allows you to not do that, and it'd be interesting to see if it solves the issue for you.If so I could look at adding it to the IDE...
-
• #6
What type of computer and browser do both of you have?
Chrome in Windows 10 or 11. But in my case I do a lot of stuff that might confuse Chrome, like running
E.reboot()
while connected, renaming device, reflashing FW over SWD and reconnecting, switching just softdevice version, ...In normal usage it mostly works just fine. Disabling higher MTU is maybe too much. But maybe it could be indeed somehow related. What if they negotiate higher MTU and then Chrome would reconnect behind scenes without telling the web bluetooth part that MTU is lower now? But that is quite unlikely. Or could WebIDE cache MTU for next connection that would negotiate lower MTU? I guess not. I think I also have the "SEND ERROR: NotSupportedError: GATT operation failed for unknown reason." error in console in that case. Will check again when it happens next time (which is quite rare). I'll also try to paste less than 21 characters in such case to see if that works. And then try paste something over 20.
-
• #7
I am using chrome on windows 10 with both the web IDE, the app loader, the unofficial forked app loader with my in-progress apps, and sometimes the chrome plugin version of the web IDE.
So far the issue only seems to appear when I have already connected at least once. I intuitively suspect it has to do with trying to connect to one service after having already connected to another, similar service, but I have not tried systemic reproduction yet. Will comment again if I can get exact reproduction. Will also check the Bluetooth compatibility mode on the app loader.
EDIT:
Another tidbit - when I am using the web IDE, the user interface doesn't even let me choose what to connect to.Found out I had bookmarkedhttps://www.espruino.com/ide/?emulator
and that caused that issue.After a complete reboot of my computer it seems to work just fine at least once in the web IDE. Then, if I disconnect and attempt to reconnect, it fails to upload code chunks, access device storage, etc.
This seems to be 100% predictable based on whether or not I see the word
paired
written next to the bangle device in the web bluetooth selection interface. Reproduction so far only requires a reboot of computer (plus clearing all cookies and site data for the web IDE), visiting the web IDE, connecting to the bangle, uploading code, disconnecting, and reconnecting. -
• #8
Edit: Deleted previous content in this comment because I am positive I have found the root cause for myself.
The exact reproduction steps are
Turn on Logitech K380 bluetooth keyboard. Make sure it's paired and connected with computer.
Connect the BangleJS2 to the web IDE or the app loader (with compatibility mode turned off in the app loader)
Send commands through the console (left side) - noting that they work fine.
Send code snippets through the IDE editor to RAM (right side) - or attempt to send data with the app loader - noting that it fails and the connection is lost.
To resolve the issue you merely
Run the app loader in bluetooth compatibility mode all the time OR
Connect the BangleJS2 to either the app loader or the web IDE while the keyboard is turned off. (you can turn the keyboard back on after the initial connection is made)
It seems like some kind of bluetooth interference but I am not familiar enough with the technology to say exactly what could be happening. Some connection parameter negotiation problem / incongruity? It definitely connects either way, it just has issues sending data (MTU related?)
-
• #9
Thanks - so you think without the Logitech keyboard it all works? To be honest it sounds a lot like a Bluetooth driver issue on your PC.
One other thing what you guys said made me think of: Do you have anything on the Bangle that might be changing the services it advertises (like HID mode, or the Bluetooth HRM app/similar)?
Because maybe if the Bangle changes its services, the characteristic handles would change number and that might throw off Chrome if it cached them.
... but in terms of real fixes, all I see as options are:
- Option in the IDE to disable higher MTUs
- Create a build (or maybe have it an option somehow) for Bangle.js to have the lower MTU
- Option in the IDE to disable higher MTUs
-
• #10
I have been having the same issue with the apploader for a long time now. I dont know the exact reason for it. After connecting to the bangle js beta apploader and disconecting my bangle js 2 would only connect for about 10-20 seconds to both the normal and beta apploader. It used to fix itself after resetting the watch. But if I would connect to the beta apploader the same thing would happen again.
-
• #11
I am running default apps on my Bangle right now - I do have one custom app I am working on, but it doesn't interact with bluetooth.
so you think without the Logitech keyboard it all works? To be honest it sounds a lot like a Bluetooth driver issue on your PC.
Yeah if I turn off the logitech keyboard everything works perfectly - and it only needs to be off at the moment the bangle connects, then I can turn it right back on. I'm interested in the idea it might be something with the bluetooth driver on my PC. I have a couple other bluetooth devices - a keyboard, a camera, and some speakers (all are typically disconnected). If the same issue does not happen with them it might suggest its specific to this keyboard. I'll also see if there are any driver updates out there.
Utimately, the issue is very small for me now - it's extremely easy to work around, just a flick of a switch and then back one second later. Happy to help with additional diagnostics but just want to make sure the lack of urgency on my end is clear.
Edit: Ooh I can also try with my phone, since that has bluetooth as well - eliminate the PC from the equation. Will report back if I find out anything useful.
-
• #12
Wow, that is interesting. Personally, I feel like if one Bluetooth peripheral can affect another, that's definitely an issue with the host computer's bluetooth stack. There's really not that much I can do at my end.
... maybe you could check all your drivers for your PC's bluetooth are totally up to date?
@kjek do you have other Bluetooth peripherals connected to your PC as well?
-
• #14
@kjek If you were using Whitelist, are there other Bluetooth settings you changed too, like Passcode? Maybe you could try booting the Bangle with the button held down (all the way through bootloader, until it starts). That should hopefully boot the Bangle without loading any code at all - and i'd be interested to see if you can keep a connection for longer in that case
-
• #15
Just a note that it seems this happens on other Espruino devices too - see https://forum.espruino.com/conversations/387632/#comment17024772
The change went in over 3 years ago and it seems like nobody has issues until this month, so I'm pretty sure this is a driver issue on Windows.
I have a Windows 11 Laptop here with a Realtek Bluetooth Adaptor in and it's fine. If you check in Device Manager, what make is yours?
-
• #16
Don't forget the
throttle send option: always
in the web ide which is very similar to the bluetooth compatibility checkbox on theapploader site
. I use this all the time to get my broken phone's bluetooth working. -
• #18
Well, 2.13 already has the larger MTU feature that may be related to this issue (it was part of 2.09 https://forum.espruino.com/conversations/362761/ ) so in theory it could break also with Bangle 1. But at least for me this issue is pretty random so even if it works for you now you may still hit the issue with Bangle1 later.
To verify it is MTU related you can try the copy paste test in WebIDE described here https://forum.espruino.com/conversations/387632/#17024455
If it is the same issue then pasting block of text over 20 bytes will disconnect your Banglejs2 device too while pasting smaller block would work.
It may not be strictly Windows related but maybe it is Chrome vs OS Bluetooth stack related. And Chrome also changes quite often just like Windows updates. I wonder if it happens in Linux too, I use both and it happens to me from time to time but I am not sure which OS I was using when it happened.
Hi there! Just got my physical Bangle JS2 device today and have been tinkering, after using the emulator and the web IDE for about a week.
I have been having a couple fishy issues with bluetooth, but this one particular issue has me scratching my head. I hope someone can offer some suggestions! Basically what happens is:
I load up the web IDE, hit the connect button, and select my bangle from the list (it's there!)
Once connected, I send a couple commands through the console on the left of the IDE (console.log, Bangle.beep, etc). Everything works fine.
I take some benign code and put it in the right side:
console.log("Hello world!");
I hit UPLOAD (RAM). It looks like it is trying to do it, but then it says the Bangle has disconnected.
Same thing happens if I hit the little Database icon (view storage). Here's what I am seeing in the developer console for the IDE
Pre disconnect:
And then this additional content appears in the console after I hit "Send to Espruino (RAM)"
Any ideas of what I might be able to try?