Skip to content

Asd/usb isp - #111

Open
sdonnan wants to merge 10 commits into
masterfrom
asd/usb-isp
Open

Asd/usb isp#111
sdonnan wants to merge 10 commits into
masterfrom
asd/usb-isp

Conversation

@sdonnan

@sdonnan sdonnan commented Aug 12, 2026

Copy link
Copy Markdown

This adds the ability to use the lpc55_isp library to interface with the ISP bootloader over USB.

It involved a bit of a refactor. Open to input on how it could be shaped better.

This will impact https://github.com/oxidecomputer/embootleby because of a new trait and a slight change in function signatures. Perhaps there is a clever way to mitigate this. Example of how the changes would look is in oxidecomputer/embootleby#9

The motivation for these changes is to provide a way for manufacturers to program Barbacks. The USB ISP is the primary programming interface. blhost cannot handle multiple devices with the same device ID connected to the same computer, which is exactly what a brand new Barback looks like. By using our own tooling here we can avoid this limitation.

@labbott labbott left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to take another pass in a bit but generally I think this looks okay. I might go ahead and delete cfpa-update in a separate PR because that was very early experimental work and we definitely don't use it.

Comment thread lpc55_isp/src/usb.rs
Comment on lines +157 to +163
// Docs don't have an encoding for pings/acks on USB so we just read a
// property
fn do_ping(&mut self) -> Result<(), IspError> {
self.send_command(CommandTag::GetProperty, &[1])?;
self.read_response(ResponseCode::GetProperty)?;
Ok(())
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches my experimentation and what blhost does as well

@labbott labbott left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, modulo some clap nit picking. EDIT: I think was looking at an old version that was still in draft.

There's a lot in this repo I would like to fix up but I don't want to block this work. Once we've updated embootleby I'd like to make sure that gets some cycles with the existing UART programming (I think this is overall very low risk).

Comment thread lpc55_isp/src/bin/lpc55_flash.rs Outdated
Comment thread lpc55_isp/src/usb.rs
Comment thread lpc55_isp/src/bin/lpc55_flash.rs Outdated
@labbott

labbott commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

This seems to work okay on one of my spare MCULinks

labbott@laura-illumos:~/lpc55_support$ pfexec ./target/release/lpc55_flash -l    
ser /dev/cua/0
ser /dev/cua/a
ser /dev/cua/b
usb 046b:ffb0:000@15-3 American Megatrends Inc.: Virtual Ethernet.
usb 046b:ff10:000@15-4 American Megatrends Inc.: Virtual Mouse Gadget
usb 046b:ff10:000@15-6 American Megatrends Inc.: Virtual Keyboard Gadget
usb 413c:2003:000@8    Dell: Dell USB Keyboard
usb 1fc9:0021:002@2    NXP SEMICONDUCTOR INC.: USB COMPOSITE DEVICE
labbott@laura-illumos:~/lpc55_support$ pfexec ./target/release/lpc55_flash 1fc9:0021:002@2 --kind usb get-property bootloader-version
Version 4b030000
labbott@laura-illumos:~/lpc55_support$ pfexec ./target/release/lpc55_flash 1fc9:0021:002@2 --kind usb flash-erase-all          
Flash erased!
labbott@laura-illumos:~/lpc55_support$ pfexec ./target/release/lpc55_flash 1fc9:0021:002@2 --kind usb write-memory 0x0 ~/old_firmware.bin 
If you didn't already erase the flash this operation will fail!
This operation may take a while
Write complete!
labbott@laura-illumos:~/lpc55_support$ pfexec ./target/release/lpc55_flash -l
ser /dev/cua/0
ser /dev/cua/1
ser /dev/cua/a
ser /dev/cua/b
usb 046b:ffb0:000@15-3 American Megatrends Inc.: Virtual Ethernet.
usb 046b:ff10:000@15-4 American Megatrends Inc.: Virtual Mouse Gadget
usb 046b:ff10:000@15-6 American Megatrends Inc.: Virtual Keyboard Gadget
usb 413c:2003:000@8    Dell: Dell USB Keyboard
usb 1fc9:0143:002@2    NXP Semiconductors: MCU-LINK r0FF CMSIS-DAP V0.078

(Note going back and forth was not automatic I use the jumper to force ISP mode)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants