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

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…

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

Yes, exactly what I discovered via T&E.

kf2qd: 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.

Hello, I cannot burn the UNO bootloader in my ATmega328 for the signature reason. It says will you kindly tell me the procedure to fix the issue? Thanks

Hi Here is a fix: http://www.instructables.com/id/Bootload-an-ATmega328/step6/ /Mikael

Carlmikael: Hi Here is a fix: http://www.instructables.com/id/Bootload-an-ATmega328/step6/ /Mikael

Thanks man. Finally Things are done. Thanks a lot... :)

kf2qd:
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.

Hi, How do you add the atmega 328 to your arduino and avrdude ? I always need to change the signature when bootloading atmega 328.

Thanks !

My email : vick.kok@live.com

sir i programmed for my sensor(sts21 temperature sensor)which is i2c, using arduino uno. i got output. i prepared a pcb with atmega328p tqfp 32 pin chip with all required hardwares(16mhz c,resistors). i connected my sensor to that pcb and dumped the hex file generated from arduino software program from which i got output. i used ISP to dump.i am getting display for the dumped program but not the data from sensor. what i have to do. what is my mistake. pls anyone help me. it will be very very useful for my program.

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

These are also available on non-P m328; it’s a documentation error that the footnote says otherwise (they are NOT available on m48x or m88x, but they’re pretty much a requirement of any AVR with more than 8k of flash.)

I think the brownout-disable is the only actual difference that has been found.

Note that there is now (well, announced, anyway) a 328PB chip that DOES have some new features, a slightly different pinout, and is not not available in DIP.

29.2.7 ATmega328 DC Characteristics ...versus... 29.2.8 ATmega328P DC Characteristics

The maximum values are, for some conditions, significantly different. Apparently the average chip is about the same but Atmel guarantees the worst case to be better for the P.

westfw: These [direct CALL and JMP instructions] are also available on non-P m328; it's a documentation error that the footnote says otherwise (they are NOT available on m48x or m88x, but they're pretty much a requirement of any AVR with more than 8k of flash.)

westfs: I have been trying to locate a document trail on this issue, and am not able to. (Did find your query on AVRFreaks :) ). I also noted the latest datasheets from Atmel still contains this note of only P parts supporting direct CALL and JMP instructions. Also note that 'other' datasheets (e.g., ATmega64M1) have the footnote on these two instructions calling out 16K and above flash size, as expected.

I just compiled a large program of mine and can see that direct CALL and JMP instructions are often used when looking at the ASM output. This program seems to 'Run OK' on the ATmega328 (non-p version). That and that it seems rather intuitive that any uC with more then 8K of flash would likely support direct calls,even so I would like to find an actual document trail to support that.

Can you, or anyone, point to a link for such?

Thank you,

-al-

From the Atmel datasheet “ATmega48A/PA/88A/PA/168A/PA/328/P” doc.no. “Atmel-8271I-AVR- ATmega-Datasheet_10/2014” page 616:

Mnemonics Operands Description Operation Flags #Clocks
JMP(1) k Direct Jump PC<–k None 3
CALL(1) k Subroutine Call PC<–k None 4
Note: 1. These instructions are only available in ATmega168PA and ATmega328P.

Note PimV:
The two instructions above are the only ones marked with note 1.
Of course the possibility remains that non the less these two instructions are available in the other microcontrollers as well, but that the proper functioning is not guaranteed by Atmel.