Pages: 1 [2]   Go Down
Author Topic: Atmega328 vs Atmega328p....what are the differences?  (Read 15128 times)
0 Members and 1 Guest are viewing this topic.
the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: January 11, 2013, 05:09:23 pm by oric_dan(333) » Logged

vermont
Offline Offline
Sr. Member
****
Karma: 8
Posts: 316
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

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

« Last Edit: January 13, 2013, 01:17:30 am by john1993 » Logged

Upstate NY
Offline Offline
Full Member
***
Karma: 2
Posts: 184
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

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

Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17303
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

Quote
Answer from Atmel:

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


Lefty
Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

vermont
Offline Offline
Sr. Member
****
Karma: 8
Posts: 316
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17303
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Code:
// 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
« Last Edit: January 14, 2013, 01:22:11 pm by retrolefty » Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Shannon Member
****
Karma: 216
Posts: 12556
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

[ I won't respond to messages, use the forum please ]

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Sr. Member
****
Karma: 2
Posts: 344
YES! It is possible. Even Impossible Says I m Possible. :)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

"Imagination is more important than knowledge."
-Einstein

Stockholm Sweden
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Sr. Member
****
Karma: 2
Posts: 344
YES! It is possible. Even Impossible Says I m Possible. :)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks man. Finally Things are done. Thanks a lot...
smiley
Logged

"Imagination is more important than knowledge."
-Einstein

Offline Offline
Sr. Member
****
Karma: 2
Posts: 338
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: 1 [2]   Go Up
Jump to: