arduino / ArduinoCore-mbed

330 stars 195 forks source link

WebSerial to install compiled files #707

Closed hpssjellis closed 1 year ago

hpssjellis commented 1 year ago

I am doing some machine learning web browser work with WebSerial and even sites like p5.js have webSerial working for Arduino's see their online viewer here. Does anyone know if a simple webSerial interface can be used to install a pre-compiled Arduino binary? Perhaps @facchinm or @sebromero

I am guessing it can't, but thought I would ask. WebSerial works when the Arduino is in normal and DFU mode so I am curious if we can just write the binary file to the Arduino?

By the way, my very cool webSerial page is called tinyMLjs and works really well with the all Arduinos but specifically the Nano33BleSense

facchinm commented 1 year ago

Hi Jeremy, for dfu upload via WebUSB (not WebSerial) you can use this project https://devanlai.github.io/webdfu/dfu-util/ I just tested with a Portenta H7 and it works great as long as you specify Internal Flash interface and 0x8040000 as starting offset.

hpssjellis commented 1 year ago

Very interesting @facchinm I will look into that.

By the way, at a machine learning conference in Trieste Italy I met some Arduino Employees: Jose, Yu and David Cuartielles. I hope one of them mentioned to you how much I appreciate your coding help. You really have helped with a lot of the open source work I do.

hpssjellis commented 1 year ago

Wow @facchinm I can't believe how well it works on both chrome and edge. Download and upload firmware.bin easily from the Portenta using vendor 0x2341. The github is at https://github.com/devanlai/webdfu/ and I can't believe how old it is some of the files are 6 years old. I will try to connect with him and see if the development is still active.

image

image

hpssjellis commented 1 year ago

Wow this code almost worked 0n my Android phone connected to the portenta. It fully downloaded the firmware.bin file but had an issue uploading the firmware.bin file. Note sure if the downloaded file was corrupted when I tried to upload it. I should try a properly made firmware.bin file. Very cool if that could actually work.