Bangle disconnects from IDE when uploading code from right hand side / viewing filesystem #6097
Replies: 1 comment
-
Posted at 2023-06-05 by Philip I hit the post character limit, so here's a little more info about the board:
And Bangle bluetooth settings:
Code I'm trying to send to RAM:
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. Posted at 2023-06-05 by Philip 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:
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.
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 Posted at 2023-06-06 by @fanoush 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 Posted at 2023-06-06 by @gfwilliams 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 ( If so I could look at adding it to the IDE... Posted at 2023-06-06 by @fanoush
Chrome in Windows 10 or 11. But in my case I do a lot of stuff that might confuse Chrome, like running 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. Posted at 2023-06-06 by Philip 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: 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 Posted at 2023-06-06 by Philip Edit: Deleted previous content in this comment because I am positive I have found the root cause for myself. The exact reproduction steps are
To resolve the issue you merely
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?) Posted at 2023-06-09 by @gfwilliams 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:
Posted at 2023-06-09 by kjek 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. Posted at 2023-06-09 by Philip 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.
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. Posted at 2023-06-09 by @gfwilliams 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? Posted at 2023-06-12 by kjek @gfwilliams I checked for other bluetooth peripherals, and made sure none were connected. I also turned off whitelist and HID, and turned on bluetooth compatibility mode in the apploader but the bangle js 2 still disconects after about 10-20 seconds. Posted at 2023-06-12 by @gfwilliams @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 Posted at 2023-06-21 by @gfwilliams 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? Posted at 2023-06-21 by d3nd3-o0 Don't forget the Posted at 2023-06-27 by kjek @gfwilliams Posted at 2023-06-27 by @fanoush 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. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2023-06-05 by Philip
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?
Beta Was this translation helpful? Give feedback.
All reactions