I haven’t had much of a chance to play with it. When you commented out the lines does it work properly?
No. commenting out those lines only shows all ports (that where available during browser startup)
Oh I see. I do not know enough about it but assume that you must be able to re-enumerate them somehow.
I just realised this API isn’t available on Firefox, so that’s probably a large chunk of the userbase who wouldn’t have access to it anyway.
(It’s also not available on any of the listed tablet/phone browsers.)
I use Firefox myself however Chrome / Chromium has anywhere between 66 - 75% of the market depending on which site you believe. Firefox is low - approx 7 or 8 %.
The general market probably, but not necessarily the developer market or this forum’s userbase.
I’m half tempted to run a poll.
Curiosity got the better of me:
(Also, I wonder if that figure includes phones and tablets, which usually have Chrome preinstalled.)
Not my iPhone! (Having chrome preinstalled)
I’d expect something like that too but all examples I’ve seen are/behave the same.
The code to select a port is:
const port = await navigator.serial.requestPort();
Only options that are possible are vid pid filters
Okay I just tried it on my W10 laptop and it seems it will detect live port changes. So it’s probably my old W8.1 desktop thats the issue.
AFAIK ‘Chrome’ on OSX runs on webkit and not real chromium. Might as well stick with safari
I actually run Firefox on my phone too so I can share the bookmarks across devices. I don’t mind Safari on a phone but not really on the desktop.
So back to the real question … can that code be used to flash from the Cart web site?
If it can definitely flash a
.hex file without issue, there’s no reason (as far as I can see) that it shouldn’t be able to be adapted to work with the FX chip. As I mentioned before, it’s just a matter of sending commands to the bootloader - the ‘knocking’ is the difficult bit.
The FX model bootloader (Cathy3K? I’m terrible at keeping track of these bootloader versions) uses a modified version of AVR109 with a few additional commands. It’s documented in a thread somewhere.
Here’s the thread with the extended commands:
I can assist with the Cart side of the project but I am not sure I know enough to do the flashing part.
A session that uploads data to the FX chip might look like:
0x50- Enter programming mode
0x42- Begin block command
- <High byte of a page address>
- <Low byte of a page address>
0x43- Specify that the block is to be written to the FX chip
- <A page worth of data to be written to the FX chip>
0x4C- Leave programming mode
0x45- Exit bootloader
At least I presume a ‘block’ for the FX chip is a page.
I don’t recall how many bytes are in a page though.
I think it’s either 256B, 1KB or 4KB.
I could give you a copy of my command-line uploader (written in C++) if it’ll help, but I abstracted the commands away so you’d have to do a bit of digging to see the full extent of what’s going on.
As for the ‘knocking’, you have to:
- Connect on the active port with settings of:
- 1200 baud
- A byte size of 8
- No parity bit(s)
- 1 stop bit
- Then close the connection
After which, another port will become available (for Windows it’s usually the next numbered COM port) and that will be an open connection to the device in bootloader mode.
I can’t remember who it was that termed this ritual ‘knocking’, but the idea is that the first connection is like the secret knock that gets you into the masonic lodge of the bootloader.
Hold onto the C++ code … the example JS code is probably much closer to what the end product will look like. If it is doing pretty much what your C++ code is doing, it will make an excellent starting point for someone to use.
But unfortunately, probably not me!
I’ve made a few little changes to that avr109 webserial and managed to upload a hex file now (Chrome and Edge). Looks promising
I cannot wait to see this work.
No real work today?
I’ll see if I can play around with it some more.
Shout out when its time to integrate into the cart site
Another thing to consider is what O/Ss need to be supported. Arduino supports Win, iOS, Linux.