-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
USB transport #8
Comments
@phoddie I tested it with the provided example but noticed that there is a typo in line 79. But that is not the problem. I enabled the After the above fixes where applied I got this trace output. I don't know if this is related but I get this message when unloading the driver but the WebUSB connection is established. If I load the driver again I can't connect to the device, so unloading seams to work.
|
Thanks for giving it a try. Sorry about the typo. I'll fix that. It must have crept in when merging. The driver isn't unloaded if there are still instances reported by Once you are running, make sure the set the baud rate for your microcontroller at line 608. It is configured for ESP32 here. If you are using ESP8266 you will need to remove the divide by two. |
@phoddie |
@phoddie [Edit] [Edit2] |
@FWeinb - as noted in the code, WebUSB itself doesn't seem to do much buffering itself. That can lead to dropped characters. One option is to slow down the connection, which is easy but undesirable as it makes everything slower. Another is to increase the buffer size. It is reliable for me as committed but your computer may be different. The revive buffer is set to 32 KB at line 234. The USB read size is set to 32 KB at line 328. Try making both of them much bigger, say 128 KB. |
@phoddie |
@phoddie |
Good catch. I'll look at fixing |
Update to |
@phoddie The best part is that WebUSB is working over https without any warnings! Could not test with the latest changes you committed. It is way to late (early) here. |
That was very quick! I will check it out later. Get some rest.
It isn't perfect. For beginning users, that may be just fine. The IDE may be able to provide guidance to users when the driver is installed. I have a trace in the example in that case, for example.
Wahoo! |
That sounds like a great idea. I copied your error message and show it in the Log panel but that message could be improved. Any idea what the implementation status of WebUSB is for Firefox? It seams that Chrome is the only browser shipping this API. |
Since the browser knows the host OS, it could provide pretty specific advice.
As far as I know, no other browser has indicated an intent to support it. And all the editors of the WebUSB specification are from Google. ;) |
@FWeinb I tried out the WebUSB support. It is working very nicely. Congratulations. The cycle for making a change, compiling, downloading, and running is remarkably fast now. Using ESP32 I was able to exercise all features. Getting and setting runtime breakpoints works well too. On ESP8266, the mod upload reported success but it did find the mod on restart. I expect that is a problem with my local set-up (too many locally modified files...). I will sort that out. |
@phoddie It might be better to lower the baud rate on the ESP8266 too? As I am understanding it WebUSB isn't supported in workers yet, I might suspect that there are some problems reading the data on the main thread. That would explain why removing the |
Maybe. I hate to lower the baud rate. I'd rather increase it on ESP32. ;) Let me look into it a bit further. |
I committed a couple changes to The first is work that @lprader and I did this afternoon to use the default endpoints rather than hardcoding them. This allows the code to work with boards from oddWires, and presumably others that use the same CP2104 part from SiLabs. (Moddable Zero uses CP2102). The second is a rework of |
@phoddie Here are the issues I had:
I added some error handling yesterday to notify the user to please restart the debugging connection if malformed data was received. |
@FWeinb - thank you for the corrections. I'll apply those. For whatever reason,
You will always receive that. The microcontroller ROM sends some basic information at start-up. On ESP8266 that is sent at 76800 baud and ESP32 at 115200. Since that is a different baud rate than the WebUSB serial port is configured for, it appears as garbage. The Moddable SDK sets the expected baud rate when it starts. The implementation defends against unexpected characters. We use the same filtering in |
@phoddie Regarding the malformed data. I get corrupt xml data from xsbug after a restart The |
Maybe the |
@phoddie Here is an example of the kind of xml I get. |
The XML fragment is clearly missing data. That's not good. It could be configuration dependent. Still, let's not give up as there's some chance others will have the same configuration. FWIW - I'm using a USB-C connection too. At one point, I had two copies of the SiLabs driver installed. That caused some bizarre problems. Maybe you do as well? In my notes, I have these two paths as places where the driver may be installed: |
@phoddie |
@phoddie |
Well, at least it can work. That's reassuring. But, yes, it is inconvenient for development to have to reboot to update the host. |
@phoddie
is doing the trick. So I don't have to reboot all the time. |
Curious. There is something to be learned here. |
@phoddie |
This issue is for discussion of using
runmod
with WebUSB.I pushed changes to
runmod
today that provide the same functionality over USB as is available using WebSockets. The documentation has been updated with the relevant details throughout. The xsbug.js example has been updated with WebUSB support including separate newXsbugUSB
andXsbugWebSocket
classes to manage the two connection types.The text was updated successfully, but these errors were encountered: