Skip to content
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

Create cross-platform single-app firmware updater for EBB #53

Open
EmbeddedMan opened this issue Aug 10, 2016 · 31 comments
Open

Create cross-platform single-app firmware updater for EBB #53

EmbeddedMan opened this issue Aug 10, 2016 · 31 comments

Comments

@EmbeddedMan
Copy link
Contributor

It would be so so so nice to have a single app that a user could download and run, on Win, Mac and Linux, that would do the following:

  1. When doubled clicked, expand the necessary pieces into a temporary directory, and run the 'main app'
  2. Detect which COM port their EBB is on. If none is found, prompt them that this is a problem.
  3. Place the EBB in bootloader mode (by sending the "BL" command over the CDC-ACM connection)
  4. Wait until the EBB re-enumerates as a HID device in bootloader mode
  5. Use the Microchip HID bootloader protocol to upload a specific version of the EBB firmware hex file
  6. Reset the EBB back into normal mode
  7. Connect to the EBB after it's re-enumerated as a CDC-ACM device, and confirm (using the "V" command) that the new version has been properly flashed to the EBB

Ideally this would be a GUI app that was very small and very simple. There would be a new version of this app for each version of EBB firmware released. Since I'm not a GUI guy at all, my 'easy path' to this is to write it as some type of command line application, which, when double clicked on a desktop, would open a console and do it's user I/O that way.

The https://github.com/ApertureLabsLtd/mphidflash project is the perfect thing to use for step 4) and 5), as it is already a cross platform command line tool to do the actual flashing.

So this should be a pretty straight forward little app to write. The trick is how to make it cross platform. It needs to be able to get a list of available serial ports, open them, talk to them, detect if a certain PID/VID is connected (the EBB when in HID bootloader mode). It needs to be able to be a single executable, which can, when double clicked, unpack the necessary files (HEX file, main app, mphidflash, etc.) into a temp directory and run.

Is there a cross platform installer framework that could do this? If somebody has any good ideas as to a cross platform tool to use, I'm happy to go learn the tool and see if I can write this app.

@zemosh
Copy link

zemosh commented Aug 10, 2016

Such an app would be handy. What about having only one installer that would download the current repository, and then you could pick a version you want to upload (with the latest as default)? Regarding the language, Python seems to me as a natural candidate---it's cross-platform, and there's already a library for EBB available; it can find the port automatically, connect and talk to EBB, etc. It's possible to create a simple GUI in Python as well. I found this tool http://www.pyinstaller.org, which can create a single package for the application with all dependencies, but I haven't tried it yet.

@EmbeddedMan
Copy link
Contributor Author

I like your suggestion, but we have to make it super, super super simple and foolproof. I don't want to rely upon an active internet connection. I don't want users to have to figure out which one they want to update to.

Having another app which is 'update your EBB to the latest available' may be a second stage of this effort. But the first needs to be completely self contained app/updates that require no thought.

I will look at pyinstaller. I don't know Python yet, but it doesn't seem too hard. I wonder how small an app it can make - I'd rather not have these things be multiple megabytes.

@EmbeddedMan
Copy link
Contributor Author

Question: if a user has multiple EBBs plugged into their computer at the time that they run the updater tool, should we update every EBB that we can find? Or just the first one?

@oskay
Copy link
Contributor

oskay commented Nov 10, 2016

Thus far, we haven't generally provided software support for more than one EBB at a time... If it's easy to make it identify every one, that's fine. However, just doing the first one is fine too.

@EmbeddedMan
Copy link
Contributor Author

Well, there was a 'bug' in my code that made it update every EBB that it
found (I originally intended it to just update the first one and then
quit), and I thought maybe that wasn't such a bad thing. I'll leave it in.

On Wed, Nov 9, 2016 at 7:40 PM, Windell Oskay [email protected]
wrote:

Thus far, we haven't generally provided software support for more than one
EBB at a time... If it's easy to make it identify every one, that's fine.
However, just doing the first one is fine too.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#53 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAbeCJ4mGCA9237DVvtAyTizktERyBdCks5q8nXxgaJpZM4Jgs17
.

@EmbeddedMan
Copy link
Contributor Author

I found this out when I had 10 different serial port devices on my PC (3 of
which were EBBs) and ran the updater to see if it would work or not.

On Wed, Nov 9, 2016 at 7:42 PM, Brian Schmalz [email protected] wrote:

Well, there was a 'bug' in my code that made it update every EBB that it
found (I originally intended it to just update the first one and then
quit), and I thought maybe that wasn't such a bad thing. I'll leave it in.

On Wed, Nov 9, 2016 at 7:40 PM, Windell Oskay [email protected]
wrote:

Thus far, we haven't generally provided software support for more than
one EBB at a time... If it's easy to make it identify every one, that's
fine. However, just doing the first one is fine too.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#53 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAbeCJ4mGCA9237DVvtAyTizktERyBdCks5q8nXxgaJpZM4Jgs17
.

@EmbeddedMan
Copy link
Contributor Author

All known issues have been fixed with the Windows installer. There are now two exe files - one to program version v2.4.3, and one for v2.4.4. It would be very helpful if somebody other than me tested them out to see if any new problems crop up.

Just download either of the exes on a Windows system with an EBB plugged in, run it, and click Start.

https://github.com/evil-mad/EggBot/tree/master/EBB_firmware/EBBUpdater

*Brian

@ShelMi
Copy link

ShelMi commented Nov 27, 2016

Have attempted to use v2.4.4 update .exe for Windows. I have a Win 7 64 bit machine. Current EBB v2.3.0.
Failed in following ways:

Attempt 1: Did not place EBB in bootloader mode before running EBBUpgraderGUI_244.exe The exe aborted indicating it wanted EBB to be in bootloader mode. Interestingly, it apparently caused EBB to go into bootloader mode, as after aborting EBB was alternately flashing red and green leds.

Attempt 2: Reset EBB. Placed EBB in bootload mode with PRG/RST switches, and EBB responded by flashing red/green leds. Ran EBBUpgraderGUI_244.exe. This time upgrader aborted stating couldn't find COM port on computer.

I'm happy to try any tests you want. I'll leave my system in its current state with no further attempts to update, to leave the configuration unchanged so tests will be equivalent.

For your guidance in deciding what you can ask me to do, I'm computer-savvy. As it happens I've designed, built, and programmed a PIC 18F46J50 board myself...a lovely chip indeed! I also have a 'scope in case that's useful in any way.

Current EBB version:
ebb current version

Starting with EBB in ordinary run mode:
update fail starting from ordinary run mode ebb

Starting from bootloader mode:
update fail starting from bootloader mode ebb

@EmbeddedMan
Copy link
Contributor Author

EmbeddedMan commented Nov 27, 2016 via email

@ShelMi
Copy link

ShelMi commented Nov 27, 2016

Success! I removed both 9 v and USB cables, then connected USB cable only, then did no queries or anything on EBB, then ran installer. Worked perfectly this time.

I'll fool around a bit more with variations on the theme, to see if I can provoke the problem again.

update success

@EmbeddedMan
Copy link
Contributor Author

EmbeddedMan commented Nov 27, 2016 via email

@ShelMi
Copy link

ShelMi commented Nov 27, 2016

I've tried all combinations of "stuff", but have not been able to re-create the failure. Osmosis strikes again, but in a happy way for a change!! 8^) And thanks for making such an easy-to-use installer!!

@EmbeddedMan
Copy link
Contributor Author

EmbeddedMan commented Nov 27, 2016 via email

@oskay
Copy link
Contributor

oskay commented Nov 29, 2016

Bug found when updating multiple boards in one session. The first board on which you update the firmware, it runs once. On the second, it runs twice, and so on. By about ten, it's very annoying.

@EmbeddedMan
Copy link
Contributor Author

EmbeddedMan commented Nov 29, 2016 via email

@EmbeddedMan
Copy link
Contributor Author

I am unable to reproduce this problem. I tried with four EBBs, and they each only got updated once.

What version of Windows are you running?

ebbupgradetool

@oskay
Copy link
Contributor

oskay commented Nov 30, 2016

It's Windows 10. Flashed a batch of ~100 boards, restarting the program every 3-4 times.

@EmbeddedMan
Copy link
Contributor Author

EmbeddedMan commented Nov 30, 2016 via email

@oskay
Copy link
Contributor

oskay commented Nov 30, 2016

Any chance that it has to do with the incrementing port number? It appears to loop over available ports...

@EmbeddedMan
Copy link
Contributor Author

EmbeddedMan commented Nov 30, 2016 via email

@EmbeddedMan
Copy link
Contributor Author

EmbeddedMan commented Nov 30, 2016 via email

@oskay
Copy link
Contributor

oskay commented Dec 20, 2016

Apparently, it does look like that. Each time that you plug in a new EBB, it seems to "find" it more than once.

3tries

@oskay
Copy link
Contributor

oskay commented Dec 20, 2016

Perhaps possible to remove duplicate names from the list before starting to update?

@EmbeddedMan
Copy link
Contributor Author

EmbeddedMan commented Dec 20, 2016 via email

@EmbeddedMan
Copy link
Contributor Author

A HA! I have found the problem. It lies with a use case that I had not considered.

I expected that everyone would follow the text in the window, and when an update is finished, they would click "Exit" (as the text instructs them to). However, users always find good ways to break a developer's assumptions!

When you use it, you fire up the app, plug in an EBB, click Start Update, then (when the update is finished), remove that EBB, plug in a different EBB, and click Start Update again, correct? That use case will in fact produce exactly the type of problem you describe - I have verified it here.

Your screenshot - with multiple "Click Exit" texts in the window - was the clue I needed.

As as temporary workaround, plug in ALL of the EBBs you want to update at once, then run the app, then when it's completely done updating, click exit. Then you won't get the duplicate entries in the COM port list.

Or, if you want to do them one at a time, make sure to click Exit after each EBB so that it starts fresh the next time.

In the meantime, I will try modify the code to allow the app to work properly when used the way you use it.

@EmbeddedMan
Copy link
Contributor Author

OK, new versions of the updater EXE files have been uploaded to the GH repo. They should fix the problem you are seeing - they do for me anyway. Please give them a try, and close the issue if the problem is resolved.

@oskay
Copy link
Contributor

oskay commented Dec 21, 2016

Interesting... Isn't that how I described the issue-- updating multiple boards in one session? As I said, we had to restart the program every few times...

@oskay
Copy link
Contributor

oskay commented Dec 21, 2016

"As as temporary workaround, plug in ALL of the EBBs you want to update at once"

Oh, that's hilarious. My computer does not have 100 USB ports. :(

@EmbeddedMan
Copy link
Contributor Author

EmbeddedMan commented Dec 21, 2016 via email

@oskay
Copy link
Contributor

oskay commented Jan 15, 2018

Is this ticket obsolete, now that we have reasonable (but not truly cross-platform) updaters?

@EmbeddedMan
Copy link
Contributor Author

It still might be better if we had a single updater app that worked on all platforms. I don't know how to write that kind of app though.

The Windows app for updating EBBs does appear to work pretty well now. If you have solutions for Mac and Linux, then we have updater apps for everybody - if that's good enough, feel free to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants