Electronic – Re-programming an AVR from another MCU over SPI


Many AVRs have the capability to be ISP'd – or in system programmed over SPI. I have a project where the entire device can get firmware updates, and I'd like to also update the firmware on it's front panel from the main micro. Since the front panel is conveniently connected through SPI, I've had the idea of just re-programming it from my main MCU over SPI.

That's the ISP method, which would be quite easy and would not require me to write a boot loader. If I can't do the ISP, then of course I will be needing a bootloader.

So basically – can another MCU re-program the ATMEGA644 over the SPI bus?

Best Answer

Yes, very easily. In this scenario, RESET works as the active-low slave-select. The programming algorithm is very well documented in every AVR datasheet (look under Memory programming, Serial Downloading).

Note however that some AVR chips have their ICSP SPIs on different pins than their regular SPIs (for example, atmega128 shares the ICSP SPI with one of its USARTs).