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

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

(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?

i was using the m1284 to generate 8 servo signals which is why i noticed that there were 4 instead of 3 like the datasheet said. i prefer to do it with oc registers so that NO cpu time or interrupts are used. about 1/10th the code too. set and forget.

and that was very brave indeed to go over there lefty. if you dont genuflect properly or they are in a bad mood it aint pretty. lol! unfotunately a couple are moderators so it can get kinda nasty. this site is much better in that respect and seems far more helpful anyway. specially when it comes to bootloaders and arduino stuff. its nice when guys like you and the others are both experienced and willing to help. a good combo.

oric_dan(333):
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?

That would seem to be the case. I extracted this from the Servo.h which would seem where to make an entry for the 1284P would be required.

// Say which 16 bit timers can be used and in what order
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define _useTimer5
#define _useTimer1 
#define _useTimer3
#define _useTimer4 
typedef enum { _timer5, _timer1, _timer3, _timer4, _Nbr_16timers } timer16_Sequence_t ;

#elif defined(__AVR_ATmega32U4__)  
#define _useTimer1 
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;

#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
#define _useTimer3
#define _useTimer1
typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;

#elif defined(__AVR_ATmega128__) ||defined(__AVR_ATmega1281__)||defined(__AVR_ATmega2561__)
#define _useTimer3
#define _useTimer1
typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;

#else  // everything else
#define _useTimer1
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;                  
#endif

Lefty

Yeah, 24 servos and you're still using the other timers for their regular purposes.

oric_dan(333):
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.

That's because the Arduino bootloader doesn't use the hardware signature in its sketch-loading
protocol, it uses the signature bytes compiled into the bootloader binary when it was compiled.

If you use ICSP to burn a bootloader you have to match the hardware signature...