Atmega328 vs Atmega328p....what are the differences?

title says it all, what are the differences? i am thinking there would be an issue burning a bootloader to the 328 since it is probably expecting the 328p, and is the 328 newer or older than the 328p? everything i have has a 328p in it but the 328 is $1 cheaper and that adds up quick in volume, so please let me know the difference.

bob

Looks like the P uses a bit less power and has a few more machine instructions.

I think this link would be useful http://www.digitalmisery.com/2011/11/arduino-bootloader-with-atmega328-and-atmega328p/

The 2 devices have a different signature. I added the 328 to my Arduino and AVRDude files so that makes it easier to burn a bootloader. Once the bootloader is loaded they are interchangeable in the Uno board so the Uno config is sufficient to program them. I have a couple 328's that I have installed the bootloader on. they have all been in my arduino board and also in a wireless breadboard that has a MAX232 for a serial interface. Once the bootloader is loaded they all function the same with the ArduinoIDE.

Functionally I think the only real difference is in low power operation.

In addition to the power usage difference and the signature byte difference:

There’s a Brownout difference:

BOD disable only available in picoPower devices ATmega48PA/88PA/168PA/328P
BODS and BODSE only available for picoPower devices ATmega48PA/88PA/168PA/328P

There’s a couple of instruction differences, see page 522:
BRANCH INSTRUCTIONS

Mnemonics Operands Description Operation Flags #Clocks
JMP(1) k Direct Jump PC ← k None 3
CALL(1) k Direct Subroutine Call PC ← k None 4

Note: 1. These instructions are only available in ATmega168PA and ATmega328P.

Bob, on a slightly different tack, is there a difference, other than the chip-signature, between using a 1284 versus 1284P chip with the Bobuino or other 1284P bootloader?

Also, what does the pins.ods file in the Bobuino variant directory do?

Dan, What you can is is browse the spec http://www.atmel.com/Images/doc8272.pdf (which I can't seem to download at the moment) and search/find all occurrences of 'atmega2184p' which will find all the instances of uniquenesses of atmega1284p vs all the samenesses between 1284/p. pico power, signature bytes, brownout detection might be 1 or 2 other things.

I don't know what pins.ods does, need to open when I get home & see. maniacbug put all that together, the pins_arduino.h was modified for my board types, the other files are all likely the same.

I think the 1284 boards all point to same bootloader - check the boards.txt to confirm. I can upload the one I am using, which flashes the SCK pin after the install. I think it is the same as what is on the github site.

Finally downloaded, the May 2012 complete version. Page 62,63 - interrupt difference

For the charts that start at Section 28 & 29, you'd have to look at the two side by side to see the difference between non-Pico and Pico power.

CrossRoads: Finally downloaded, the May 2012 complete version. Page 62,63 - interrupt difference

For the charts that start at Section 28 & 29, you'd have to look at the two side by side to see the difference between non-Pico and Pico power.

Seems the P version has a timer3 that the non P doesn't, that's rather significant. Does manics port define and support timer 3?

CrossRoads: Dan, What you can is is browse the spec http://www.atmel.com/Images/doc8272.pdf (which I can't seem to download at the moment) and search/find all occurrences of 'atmega2184p' which will find all the instances of uniquenesses of atmega1284p vs all the samenesses between 1284/p. pico power, signature bytes, brownout detection might be 1 or 2 other things.

I don't know what pins.ods does, need to open when I get home & see. maniacbug put all that together, the pins_arduino.h was modified for my board types, the other files are all likely the same.

I think the 1284 boards all point to same bootloader - check the boards.txt to confirm. I can upload the one I am using, which flashes the SCK pin after the install. I think it is the same as what is on the github site.

I opened a pins.ods file and it opened up into an open office spreadsheet, so perhaps it's just an aid/tool he uses to build his various custom pins_arduino.h file?

Lefty

Thanks, I looked at the 584 page d/s, and decided it was easier to ask the experts!

BTW, out of stupidity, I bought a couple of the atmega1284-PU chips instead of the atmega1284P-PU chips, and to burn the bootloader, I found I had to track down the avrdude.conf file and change to the chip-signature to that for the 1284. Then, it burned the bootloader ok using the ArduinoISP sketch from a UNO chip.

However, to download sketches into the 1284 bootloader chip using the IDE, I then had to change avrdude.conf back to the original 1284P chip-signature. Interesting.

Also, thanks for building the Bobuino bootloader. It's much more Arduino pin-compatible than the others.

You're welcome. However: I didn't build the bootloader, I just developed the pinout I wanted. maniacbug did the software. I had something mangled together for IDE -0023, but the change for 1.0 was more than I was able to figure out.

I think you can copy the 1284P section in avrdude.conf, call it mega1284. Then do the same in boards.txt, make a new section with new name and call out mega1284 vs mega1284p Should let you have 2 versions and not have to switch back & forth. Worth a shot anyway!

Also, thanks for building the Bobuino bootloader. It’s much more Arduino
pin-compatible than the others.

Again the bootloader used has nothing to do with the pin abstraction defined with the custom pins_arduino.h file used for a modified core. The bootloader used is reflected in the boards.txt entry of a specific board selection and tells the IDE the baudrate used for the bootloader as well as the memory size and the fuse and lock bit values used. The pins_arduino.h file is where one defines the abstracted arduino pin numbers to the physical port.pin numbers of the chip.

Lefty

retrolefty: Seems the P version has a timer3 that the non P doesn't, that's rather significant. Does manics port define and support timer 3?

that is an error in the datasheets. there is no difference in timers between the two chips.

john1993:

retrolefty: Seems the P version has a timer3 that the non P doesn't, that's rather significant. Does manics port define and support timer 3?

that is an error in the datasheets. there is no difference in timers between the two chips.

I don't think so. I didn't even know there was a non-P version of the 1284 before today, but that latest datasheet showing a non-P chip version avalible is pretty consistent through out that the timer3 (of timer0 through timer3) in not applicable to the non-P chip. Even the front page summary has:

Peripheral Features – Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes – One/two 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode

I take that to mean the 1284P has 2 8 bit timers and 2 16 bit times, where as the non-P has two 8 bit timers but only one 16 bit timer.

You disagree, if so why?

Edit: Interesting, if you look at the cover sheet page of a old data sheet it states:

• Peripheral Features – Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes – One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode

So comparing the two datasheets ( 8272A–AVR–01/10 Vs 8272D–AVR–05/12 ) it would seem that the 1284P gained a fourth timer rather then the non-P losing a timer it never had. Pretty confusing all in all. Lefty

Ok, I'll try building a section for the 1284 chip.

Yeah, from looking at the directories, it looks like you bootstrapped onto maniac-bug's optiboot, but thanks just the same, :-). That's good, so if he updates optiboot, then Bobuino-bootloader variant should still work.

In another section of this forum, I tried to get westfw interested in modifying UNO optiboot to make it more conducive to sketch uploading via XBee, but it didn't take. Would be a great advance, I think, considering how popular XBee is.

I did look at the adafruit and other wireless programming pages, but they don't work with the existing optiboot or avrdude. I did spend some time figuring out how to mod optiboot myself, so it would upload at a slower baudrate [9600,19200] but it was too unreliable, and I ultimately decided that the avrdude transfer protocol would also need to be modded too.

retrolefty: I take that to mean the 1284P has 2 8 bit timers and 2 16 bit times, where as the non-P has two 8 bit timers but only one 16 bit timer. You disagree, if so why?

because i have both chips and assure you both have a timer3. unbelievers will find the code below blinks any leds attached to port d.

reset: ldi r23,0xff
 out ddrd,r23
 ldi r23,0b00000101
 sts tccr3b,r23
l1: lds r22,tcnt3l
 lds r23,tcnt3h
 out portd,r23
 rjmp l1

atmel data sheets are rife with misinformation. there was an almost identical situation with the 328 couple years back. another interesting but related issue is they use the same die for supposedly radically different parts. ie many of the low end 6 pin are actually relabeled higher end parts. in that case i dont complain because i get 2x or 4x the memory for a few cents less.

john1993:

retrolefty:
I take that to mean the 1284P has 2 8 bit timers and 2 16 bit times, where as the non-P has two 8 bit timers but only one 16 bit timer.
You disagree, if so why?

because i have both chips and assure you both have a timer3. unbelievers will find the code below blinks any leds attached to port d.

reset: ldi r23,0xff

out ddrd,r23
ldi r23,0b00000101
sts tccr3b,r23
l1: lds r22,tcnt3l
lds r23,tcnt3h
out portd,r23
rjmp l1




atmel data sheets are rife with misinformation. there was an almost identical situation with the 328 couple years back. another interesting but related issue is they use the same die for supposedly radically different parts. ie many of the low end 6 pin are actually relabeled higher end parts. in that case i dont complain because i get 2x or 4x the memory for a few cents less.

In the early days of microprocessors, 8080 and 6800, there were unused opcodes. That is, there were combinations of 8 bit codes that were not documented. People began exploring them, testing what they did and started using the undocumented opcodes. They was a lot of supposition that there were problems with the unused opcodes and the manufacterer just did not want to support them. Later processors locked out the unused opcodes so that they were just noops.

I suspect that the non-P timer3 may have a problem with the timer. Rather than make a new die masks, they just removed it from the spec. An engineer would be foolish to use an unsupported feature. A hobbyist can do anything they want.

Regarding the extra memory. The manufacturer probably had extra of the high end parts and needed low end parts. Rather than firing up the fab line for those parts, they took the higher end parts and just branded them with a lower end part number.

I asked over at the avrfreaks site (brave of me, huh!). They seem to be rather bored with that topic presently as they have posted a lot on this timer topic for the 1284 chips in the past and the confusion over the various datasheets. One of their posting has this quote:

Answer from Atmel:

"Timer 3 exists in both ATmega1284 and ATmega1284P. It is not available in ATmega164/324/644 devices."

Lefty

A quick question about servos and the 1284P. Looking at Servo.h in the libraries directory shows there is no line entry for 1284P chips [unless I have an obsolete version]. It also says that 1 timer can control up to 12 servos. Other chips like 2560 have multiple timers available, and can therefore control a lot servos.

So, now that we've decided the 1284 and 1284P have one extra available timer, that means the Servo library could be patched so the 1284/P chips could control up to 24 servos.

Or am I missing something?