7

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?

Kevin Vermeer
  • 19,989
  • 8
  • 57
  • 102
Tristan
  • 548
  • 1
  • 8
  • 21

1 Answers1

7

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).

avakar
  • 3,014
  • 2
  • 17
  • 18
  • Thanks for the answer - Once I get off my lazy butt and design myself a PCB, I'll try this out and try to write some code to do exactly this. Is there any other little gotchas to take care of when doing this, like you needing to use 12 V to program like you do on some other MCUs? – Tristan Oct 07 '11 at 04:52
  • @TristanSeifert, no gotchas, it's pretty much straightforward. Take a look at https://technika.junior.cz/trac/browser/shupito/shupito/fw_common/handler_avricsp.hpp if you want some inspiration. :) Goot luck! – avakar Oct 07 '11 at 05:11