Unable to upload code to the Pixl.js running 2.18, disconnects while sending #4213
Replies: 1 comment
-
Posted at 2023-06-18 by parasquid I just updated my MDBT42Q from 2.06 to 2.18 and I'm facing the same issues. Posted at 2023-06-19 by @gfwilliams Argh, sorry to hear this. so just to narrow it down:
You could try enabling What type of computer/OS are you using? Does it work if you use a different computer or a phone via 'remote connection' (click the text at the bottom left of the Web IDE connect window on your PC) ? Two people posted up a week or so ago that they'd had something very similar with Windows 11 - one of them mentioned that they had a Logitech Bluetooth keyboard and when they turned that off it all worked fine. If it's the same issue it appears to be to do with the Bluetooth MTU, and the last firmware with the lower MTU was (I think) 2v08. It's a hard one - while I could produce builds with a lower MTU again that slows things down, and this would appear to be a due to broken driver on Windows 11 :( Posted at 2023-06-19 by parasquid
yeah, if I type in the blinky example line by line it does work
this one I'll need to confirm again, but I tried pasting the sample code on the 433 remote socket example and it disconnected. I'll be able to confirm again in a few hours (I'm out right now)
I am indeed using Windows 11 (the BT stack on my Ubuntu 22.04 leaves much to be desired, but I can try with it again once it does work). I can also boot up a live Ubuntu image on this laptop to try things out. I don't use any other BT device on this laptop aside from earphones, but I'll try again later with all BT disconnected aside from the pixl. Is there a way to change the MTU for bluetooth on Windows 11? I'll also try flashing 2.08 then 2.09 and see if that is indeed the bisection point. Posted at 2023-06-20 by @fanoush for me reloading the IDE page often helps (shift + reload button), or maybe exit/relaunch Chrome, Can you try to paste text of 22 characters and then only 21 if it is MTU issue? Posted at 2023-06-20 by parasquid Sorry I wasn't able to reply immediately; had to reflash the pixl to 2.18 first. I copy and paste this:
and that works. However,
will disconnect the pixl. (i'm probably copying a LF at the end that's why the total count was only 20/21) Posted at 2023-06-21 by @gfwilliams Thanks for testing that! Ok, so then it's exactly the issue described in https://forum.espruino.com/conversations/387281/ So enabling Throttle Send in the Web IDE communication settings should fix it I think. But at this point I'd be pretty certain this is a bug in whatever Windows 11 Bluetooth Driver you're using I'm afraid. It's probably not a coincidence that this change to Espruino went in over 3 years ago and nobody had any problems until about a month or two back. I wonder if you all have the same Bluetooth radio in your PCs? If you have a look in Device Manager, what does it say? Maybe trying to get the absolute latest driver would fix it? Posted at 2023-06-21 by @fanoush So it looks MTU related. Which is strange because the IDE sends larger chunks back only if it first receives larger chunks too. And AFAIK in BLE there is only one MTU negotiated (?) for a connection between two devices, there is not a different MTU per direction. So it may be some Chrome bug that it somehow forgets that higher MTU is negotiated. Does reloading IDE help or maybe removing the device from Chrome bluetooth devices as mentioned in that other topic linked? Do you have more that one BLE device connected? - the other thread was mentioning keyboard. Also the question (to @gfwilliams ?) is, can this error/exception be handled in the IDE javascript code and retried instead of closing the connection or does Chrome itself closes the connection. Posted at 2023-06-21 by parasquid I only have bluetooth earphones paired with this laptop (which I wasn't using when doing the tests). I was using Edge btw (which is based on Chrome afaik) I haven't tried removing the device from the bluetooth devices but I'll try it again next time I'm able. I'll also try a different bluetooth adapter (I have a Feasycom one similar to that sold in the Espruino shop) Attachments: Posted at 2023-06-21 by parasquid I just tried with that bluetooth adapter (the one built-in to my thinkpad was a mediatek, this adapter shows up as a realtek) and everything works (send to Espruino button, as well as copy pasting). This works for me right now, thanks for the suggestion :) Not sure how else to update drivers for the mediatek one as I never had to install one in the first place (everything is managed though windows update) Posted at 2023-06-21 by @gfwilliams Thanks! Ok, so that's one for Mediatek. @parasquid it'd be amazingly helpful if you could try the other adaptor - that would rule out a great deal of things! @fanoush as far as I can tell from the initial post on https://forum.espruino.com/conversations/387281/ we get a And that function does trigger a disconnect - so it is possible that we could trap the error there, and then split the write up into 20 byte chunks. It could maybe even set ... but I'm hesitant to make changes here as I can't reproduce it. If you were willing to give it a try a PR would be awesome though. Posted at 2023-06-21 by @gfwilliams @parasquid that's awesome - thanks for checking! I'm not entirely sure about updating drivers either and it feels like Mediatek don't directly release them. I did spot https://www.catalog.update.microsoft.com/Search.aspx?q=Mediatek+Bluetooth though and I guess it's possible you could find the version before the one you have currently and manually download and install that? Posted at 2023-06-21 by parasquid I tried installing the updated drivers and older drivres, but it doesn't seem to update the actual installed driver in the system (Windows will either insist that the best drivers have already been installed, or if I do manual installation by browsing and selecting the device I want to install drivers for, it will install them but the driver version remains the same even after a reboot). Posted at 2023-06-21 by parasquid
If you're also able to deploy this to a test URL (so something like espruino.com/ide-mtu-test for example) I can try it out and see if it works without any configuration on my part. Posted at 2023-06-21 by parasquid Also, just to round out all of the suggestions, setting throttle send to "Always" also allows me to send to Espruino as well as copy/psate code without getting disconnected (although I can subtly notice that pasting the code isn't as smooth as when using the adapter and having throttle send to auto; it's like using ssh over a slow network connection) Posted at 2023-06-21 by @fanoush
Sadly I cannot reproduce it either. It does happen to me sometimes but I did not trace it to something specific, mostly it just works. And when it does not work reloading IDE works or it otherwise goes away soon (for no apparent reason). I only know simple disconnect and reconnect in IDE does not help in this case. As for the error handling- what could work in this case:
Posted at 2023-06-21 by @fanoush
Just to be sure, I mean this Chrome page chrome://bluetooth-internals/#devices Posted at 2023-06-27 by parasquid
Just tried this, there's nothing in there (I see the Devices and the table headers but nothing listed). Attachments: Posted at 2023-06-29 by parasquid Quick update: I was able to connect with the Mediatek BT on the Seeed Xiao BLE (and possible the Bangle.js 2 which I'll have to hunt for) without having to throttle send. I thought something got fixed since there was a windows update and I had to reboot, but unfortunately the Pixl.js still had the same issues (disconnecting when sending code). So it seems my BT adapter is fine with nrf52840 but not with nrf52832? I'll try again when I find my Bangle.js 2 charger :P Posted at 2023-06-29 by @gfwilliams What's the Xiao BLE running? Because most devices don't have the increased MTU - it was just done with Espruino to get the data throughput a bit higher and to make it compatible with connecting to the few that do. Posted at 2023-06-29 by parasquid
It's running a custom compilied Espruino here: https://forum.espruino.com/comments/17034513/ it's on the nrf52840 I've found my charger and charging up the banglejs 2 and will confirm with you if my Mediatek performs properly without having to throttle. Posted at 2023-06-29 by parasquid Yep, confirmed with the banglejs2 (running 2v18) that copy and pasting long seuqences of characters don't disconnect me. This is what I was copying and pasting:
doing the same for the mdbt42q (running 2v18) disconnects (and doesn't even show anything on the screen. Attachments: Posted at 2023-06-29 by @gfwilliams Ahh, neat - I bet if you added these lines:
You'll find it breaks - similarly if you removed those from the Pixl's python file and built yourself I bet it'd work great. Posted at 2023-06-29 by @gfwilliams I missed this last post - so you mean an up to date Bangle.js 2 using firmware we built does not disconnect itself when you send >20 chars? That is interesting... Posted at 2023-06-29 by parasquid Aha sounds great! I won't have to lug around a BT dongle if this works :) So I guess this was indeed an MTU related issue, that only affects certain builds with those defines and only on certain BT adapters. Posted at 2023-06-29 by parasquid Yeah, I just updated this banglejs2 using the App Loader. It's running Simple Clock and the vectorized Simple Clock. update: I've recompiled the custom firmware for the xiao ble (uf2 builds are really convenient since I don't nede to hunt for my jlink, just a USB and double tap the reset button; if ever we get a pixl.js 2 with the nrf52840 I hope there would be something similar :P) with the lines you've mentioned
and I'm still able to paste in long char sequences. Checking again with the pixl/mdbt42q i get disconnected as soon as I try to paste the same sequence. Posted at 2023-06-30 by @gfwilliams Thanks - that's a really interesting one then - so I guess it's to do with Nordic's SDK12 and the increased MTU on Mediatek, so I guess it's not entirely driver-side. ... although I'm not quite sure what can be done on the Espruino side to fix that (short of dropping MTU) Interesting about UF2 - I hadn't seen that! I guess they're using https://github.com/adafruit/Adafruit_nRF52_Bootloader - I'm not 100% sure from that if BLE firmware updates are actually supported as well, or if it's then only USB? But yes, having the ability to update firmware over USB would be very neat! Posted at 2023-06-30 by parasquid I've only tried out USB; there's an OTA option which requires doing some button gymnastics but I haven't tried that out (the xiao ble only has the reset button). Yeah, they are using that adafruit bootloader (their instructions for flashing the bootloader in case you "brick" the device mention it). For me though, I would rather have fw updates over BLE rather than over USB because I don't need to be plugging in a USB cable in order to do fw updates (just need a way to hold down BTN1 which I can easily solder some external switch to). Many of my Espruinos are already connected to circuits that are quite inconvenient to reach with a USB cable (not to mention a computer) so having fw updates only through USB is a nogo. I'm only appreciating the speed of fw updates over USB because I'm compiling and recompiling fw many times; but once I have a fw I'm happy with, the next fw update would be weeks from then. If we can do both BLE and USB that would be great :P In any case, I just tried with another nRF52840 I have (the Waveshare Eval Kit) and I can again connect without issues to the custom Espruino build there, so that's 3 for the 52840. I don't know if I can use SDK12 on the 52840's (the docs mention experimental support) but if I have time I'll try it out. Posted at 2023-06-30 by @gfwilliams
No... But if you add The issue is that to change the SDK it means new softdevice + bootloader, so you'd have to flash it over SWD :( Posted at 2023-06-30 by parasquid Ah that's an idea. Flashing the Pixl.js over SWD is relatively easier (I can just make a jig with pogo pins). It's the MDBT42Q that's a bit of a problem since I prototype code and hw on the Pixl.js and then deploy it on the MDBT42Q :( I'll let you know anyway if I'm able to make progress on the SDK15 for the Pixl.js :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2023-06-18 by parasquid
I've updated my Pixl.js to to 2v18 and I'm unable to upload code (either to ram or flash) because it seems to disconnect in the middle of sending.
Copy pasting code also disconnects the pixl. However, typing in code seems to work (testing with the blinky code).
My MDBT42Q breakout works correctly but that was running the 2.06 version. I then flashed 2.06 onto the pixl and uploading code works again.
I don't remember the version my pixl was running before I updated. I've tried 2.17 and 2.16 but those are broken too, I'll try to find out the latest version the pixl still works corectly with in the next few days because I'll need to finish off a project and 2.06 is enough to get things working :)
Beta Was this translation helpful? Give feedback.
All reactions