Skip to content

Add SoundCard PIC32 firmware updates - #55

Merged
glopesdev merged 2 commits into
harp-tech:mainfrom
glopesdev:pic32-bootloader
Oct 25, 2026
Merged

glopesdev merged 2 commits into
harp-tech:mainfrom
glopesdev:pic32-bootloader

Conversation

@glopesdev

@glopesdev glopesdev commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

This adds firmware updates for the PIC32 coprocessor of the SoundCard, so the update command can write both processors of a SoundCard on any platform.

Harp.Toolkit.Core gains a client for the Microchip AN1388 serial bootloader on the PIC32, in the new Harp.Toolkit.Firmware.PIC32 namespace. It reads Intel HEX images record by record, and erases, programs and verifies application flash against a CRC computed from the image. A program frame is never resent, since flash cannot be programmed again without an erase. The SoundCard sequence in Harp.Toolkit.Firmware.SoundCard switches the serial port to the PIC32 bootloader through register 82, runs the update at 115200 baud, and clears the register so the coprocessor restarts on its own. The record that holds the application reset address is written last, so an interrupted update leaves the coprocessor in its bootloader rather than running an incomplete image.

The update command keeps its single firmware argument. When the image is for the SoundCard, the coprocessor image must sit next to it under the same name with a .PIC32 suffix after the device name, or the legacy .X, and the update writes the coprocessor first. Without the coprocessor image the update refuses to start, so both processors always run the same release, and a SoundCard can no longer be updated with its ATxmega image alone.

The CI workflow now downloads two SoundCard PIC32 release images, pinned by SHA-256, for tests that program a real image into an emulated bootloader.

An update from fw3.0 to fw2.2 completed on a hardware 2.2 SoundCard, including the CRC check of the coprocessor flash. The device does not report when the coprocessor application is running, so the update waits a fixed two seconds after clearing register 82.

Closes #9

The new client implements the host side of Microchip AN1388, the serial
bootloader on the PIC32 co-processor of the SoundCard. It reads the
bootloader version, erases application flash, programs the records of
an Intel HEX image and verifies the flash CRC against it. A program
frame is never resent, since flash cannot be programmed again without
an erase.

The CI workflow now downloads two SoundCard release images, pinned by
SHA-256, for the tests that program a real image.
Updating SoundCard firmware now also writes the PIC32 coprocessor image,
which must sit next to the firmware file under the same name with a
.PIC32 or legacy .X suffix after the device name. The update refuses to
start when the coprocessor image is missing, and writes the coprocessor
first.

The coprocessor update switches the serial port to the PIC32 bootloader
through register 82, writes and verifies the image at 115200 baud, and
clears the register so the coprocessor restarts on its own. The record
that holds the application reset address is written last, so an
interrupted update leaves the coprocessor in its bootloader.
@glopesdev glopesdev added the feature New planned feature label Oct 22, 2026
@glopesdev

Copy link
Copy Markdown
Contributor Author

Thanks @artursilva0 for trying this out independently.

A build of the v3.0 test firmware was written to a SoundCard with the update command from this pull request, and a sound played successfully afterwards. This confirms that the coprocessor application starts after the update, which is the one step the device cannot report by itself. Together with the fw3.0 to fw2.2 update described above, this covers both directions, so I will go ahead and merge.

@glopesdev
glopesdev merged commit c599b34 into harp-tech:main Oct 25, 2026
9 checks passed
@glopesdev
glopesdev deleted the pic32-bootloader branch October 25, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New planned feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uploading firmware for boards requiring 2 firmwares

1 participant