When I put together the firmware roadmap, it became clear to me that having an easy and convenient way to update the board with any future versions will be one of the most important features. With such a feature, I don't have to worry too much about missing features and can go ahead and offer 4chord MIDI to the world. Sure, there's the ISP connector, so updating the firmware has always been possible, but like I wrote in the previous log, I want that everyone can fully enjoy 4chord MIDI, regardless of their programming or electronics background.
Well, today I finalized the first proof of concept implementation of a bootloader that will be able to do just that: updating the firmware.
Thanks to the ATmega328's built-in bootloader support, it was surprisingly easy (almost disappointing) to have separated application and bootloader code. But of course, the main focus was the self programming and transferring the firmware data, so good to not have to worry about the linker along the way.
Like I said, this is a first proof of concept, but it has full support to
- receive new firmware data one memory page at a time - a Python script takes care of that
- write the firmware data chunks to the flash
- read the freshly written data back and send it back to the Python script which is then either moving on to the next memory page or sending the last one again, until the data matches
- displaying some progress information (okay that one needs still some work)
Here's a little video showing the firmware upgrade in action:
Pressing the "Select" menu button while powering up the board will enter the bootloader mode. It has a simple UART interface to reset / handoff to application, but pressing the "I" chord and "IV" chord button at the same time will also reset the board.
Next step is to fully integrate it into the Makefile and push some code to the Github repo.Coming soon. Development branch for bootloader is now here: https://github.com/sgreg/4chord-midi/tree/feature/bootloader
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.