electro-smith / oopsy

gen~ to Daisy: exporting Max Gen patchers for the ElectroSmith Daisy hardware platforms
MIT License
121 stars 27 forks source link

Jump to bootloader from software #2

Open stephenhensley opened 3 years ago

stephenhensley commented 3 years ago

Requirements:

stephenhensley commented 3 years ago

@grrrwaaa Do you know of a Serial communication library for node (or if there's any native support for connecting to USB/Virtual COM ports?). I'll probably be merging in the libdaisy function for jumping to the system bootloader. So I want to start on a plan of attack for adding it to oopsy.

The first thing that came to mind was maybe just using MIDI program change message, but A: That would require MIDI or B: would need USB MIDI to work, which is still not set up.

So unless we want to wait until USB MIDI is in place, we'll have to connect to the device via the Virtual COM port and tell it to restart. (That's the only thing I can think of that would work universally without any special consideration for the board.

We could add a UI option to the Display UIs, but that's not really much different than pushing the buttons.

Definitely interested in your thoughts.

grrrwaaa commented 3 years ago

Yeah I've been followinig this addition with excitement!

Various options for serial communciation from Node.js, including some pure-javascript ones (see https://www.npmjs.com/search?q=serial%20port). An example tutorial oriented to arduino: https://itp.nyu.edu/physcomp/labs/labs-serial-communication/lab-serial-communication-with-node-js/ --

I think that all we need to know is the address of the virtual serial port....and lots of testing ;-)

stephenhensley commented 3 years ago

Indeed! Thanks for sharing those links, I'll try to get a proof of concept together in the next few weeks.

One thing I foresee being an issue is detecting which "virtual serial port" belongs to the daisy. On windows, and mac they generally appear as some ambiguous name. That said, we might be able to query them based on the USB device descriptor, however the system information is a bit weird for that (at least on my machine here).

On my windows desktop I the device is recognized as "Daisy Seed Built In", but in the System Information/Device Manager, it appears as "STM32 Virtual COM Port" (possibly because of the VID in the descriptor).

So as long as we're able to reliably select the Daisy when it is connecting/reconnecting constantly then the rest should be fairly trivial. (Send message to Daisy, Daisy does reset).

grrrwaaa commented 3 years ago

We had some progress on this today -- at least, the ability to jump to bootloader on receipt of MIDI reset (0xFF), as well as some preliminary progress toward sending a reset message via USB serial interface. However some current challenges in libdaisy/USB (https://github.com/electro-smith/libDaisy/issues/343) need to be taken into account.