USB bootloader with program using usb?

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
confus
Posts: 4
Joined: Tue Nov 02, 2010 12:49 pm

USB bootloader with program using usb?

Post by confus » Wed Jul 22, 2015 10:27 am

I wondered if one could use a vusb-based bootloader and still use the USB connection in ones' main firmware.

Say I have device that uses the USB conncetion e.g. to switch a few relays controlled by the connected PC. I then press a button to put the device in bootloader mode. I then update the firmware over the same USB connection, the device resets and I can switch the relays again over USB. Would that at all be possible?

I guess one would have to change a few compile time options to runtime stuff in v-usb but maybe a ready-made bootloader exists? Does someone know of one?

blargg
Rank 3
Rank 3
Posts: 102
Joined: Thu Nov 14, 2013 10:01 pm

Re: USB bootloader with program using usb?

Post by blargg » Thu Jul 23, 2015 10:38 am

USBaspLoader and variations allow this on devices with bootloader support (separate interrupt vectors for bootloader). I use such a setup all the time and it's great. Some allow various ways of entering bootloader: for a few seconds on device being plugged in, when reset is pressed, etc.

confus
Posts: 4
Joined: Tue Nov 02, 2010 12:49 pm

Re: USB bootloader with program using usb?

Post by confus » Thu Jul 23, 2015 11:46 am

Ah, thanks. Would you mind giving me a kick start by posting the firmware and schematic of one of your simpler or a minimal projects? I find it easier to learn from examples.

blargg
Rank 3
Rank 3
Posts: 102
Joined: Thu Nov 14, 2013 10:01 pm

Re: USB bootloader with program using usb?

Post by blargg » Mon Jul 27, 2015 6:26 am

The simplest approach is to get one (or two) USBasp hardware boards and flash USBaspLoader on it. Then you can load a new program into the board and use it as a development board with I/O and USB. If you have two of these or one and another ICSP programmer, I'll post one that's configured and ready to build and flash.

Post Reply