Changes between 168v and 328p for programming

I have tried converting my boot cloner code from the 168V chip to the 328p chip with little success. This uses the two wire serial mode to program a boot loader into the chip.

The data sheets for the 328p when it comes to programming are less detailed than the one for the 168v.

I can read the fuses and the signature bytes. The fuses are being programmed but I think things have changed with regard to the addresses it expect.

The response to the poll ready command seems to have changed but there is no mention of this in the data sheet. It still refers to bit zero being zero when it is clear to accept a command. What I get is 0xff immediately after I issue a command and 0x9f shortly after, bit zero never changes, and it continuously reports 0x9f. I have also tried putting hefty delays after each command but to no effect.

There is a new instruction "load Extended address byte" but no mention of what it does or why it is needed.

So does anyone know:- 1) If the format of the address bits are the same in the 168v and the 328p? If so the code that works with the 168v doesn't touch the 328p.

2) Do these changes also refer to the 168p as there is a data sheet for both the P suffix and the v suffix?

3) What is the "load Extended address byte" all about?


Most of that was over my head, but I thought I'd throw out some stuff that may be obvious, just in case it's not. The 326 shuffles the fuse bits, so you'll need a separate set of bits for it (fuse calculator is your friend). Also, the 328 uses a different bootloader, so you'll have to add that to your cloner if you haven't already.

I have a version of programmer2 that I have modified so that it should work with the 328, but the code is really ugly, and I've been trying to figure out a way to add standalone functions to MegaISP to replace it.

Thanks but yes I did all that stuff. :)

The fuses have changed and I worked out what they should be and then confirmed from other postings that I was right about them. Anyway all that only kicks in when you get out of programming mode and start running it. As I said I can't program and read back in programming mode so I am falling at, if not the first, the second hurdle.

OK let me answer my own question for the sake of completeness.

1) The pole does return 0x9f when the chip is not busy and 0xff when it is. Despite what the ATMEL support people say.

2) The "load Extended address byte" while not being explained in the 328 data sheet is explained in the 1280 data sheet. This allows the writing of the upper part of the 328 memory, for reading the upper part see the point below.

3) The read address higher command uses one extra most significant bit that was down as a don't care in the 168.

4) I have found no difference between the P suffix parts and the v suffix parts.

I have now been able to successfully modify the 168 Boot cloner to work with the 328. :)