Electronic – Programming an AVR microcontroller with multiple SPI channels

avrprogramming

I am trying to design a PCB which will make use of the ATmega324PB microcontroller [Datasheet here]. I have previously worked with smaller AVR chips such as the ATmega168PB, and programmed them through the ISP pins using an AVR Pocket Programmer.

  1. This is the first microcontroller I've used with multiple SPI channels (MOSI0 and MOSI1 etc.). The datasheet makes no mention of how to approach this when performing In-System Programming, am I right in assuming that channel 0 (i.e SCK0, MISO0, MOSI0) should be used for this? The only real differential I can find between them is in the block diagram in Figure 4-1 (pg 13 of the datasheet).
  2. The AVRDUDE tool used by the Pocket Programmer has not been updated in some time and does not list this this specific IC as supported (though it has the 324P and 324PA listed). I'm considering upgrading to an STK500 as Atmel Studio 7 lists it as a supported device for the micro, are there any issues here?

Best Answer

It's not always the SPI port that you use for the programming of these parts, the attached image explains it and the datasheets are always clear on this. I was caught out on a Mega64 IIRC once over this.

enter image description here

Remember you can multiplex these pins so they are available for normal use.

As far as programming is concerned Olimex do clones of the good old AVRISP Mk 2. They list the A part here:

https://www.olimex.com/Products/AVR/Programmers/AVR-ISP-MK2/

I am sure if you wrote to them to double check, they would confirm whether the B is also programmable with it. I'd be very surprised were it not.