Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: airman00 on October 24, 2008, 11:05:05 AM

Title: ATmega328 - Drop in replacement for ATmega168
Post by: airman00 on October 24, 2008, 11:05:05 AM
http://www.adafruit.com/index.php?main_page=product_info&cPath=17&products_id=123   - $7.50 .

The cost is a bit high but I assume the price will become lower in the coming months.

Quote
ATmega8 - a chip with 8K of flash memory and 1K of RAM. Then AVR released the ATmega168, a drop-in replacement with 16K of flash and 1K of RAM - a really big improvement! Now there is the ATmega328 with 32K of flash and 2K of RAM. Basically its got the capacity of an ATmega32 but in a slimmer package. These chips are notable for their ability to drop-in replace the ATmega168.

Time to upgrade the $50 Robot controller ;)
Title: Re: ATmega328 - Drop in replacement for ATmega168
Post by: pomprocker on October 24, 2008, 03:28:37 PM
Its an upgrade for the 168P

http://www.atmel.com/dyn/products/product_card.asp?part_id=4198 (http://www.atmel.com/dyn/products/product_card.asp?part_id=4198)


http://www.atmel.com/ad/picopower/ (http://www.atmel.com/ad/picopower/)
Title: Re: ATmega328 - Drop in replacement for ATmega168
Post by: waymental on October 25, 2008, 07:33:16 AM
ATMEGA328P-PU-ND

$2.66 each on digikey.com

but package size of 14
Title: Re: ATmega328 - Drop in replacement for ATmega168
Post by: airman00 on October 25, 2008, 05:26:30 PM
ATMEGA328P-PU-ND

$2.66 each on digikey.com

but package size of 14

its out of stock by digikey
Title: Re: ATmega328 - Drop in replacement for ATmega168
Post by: Admin on October 27, 2008, 08:25:08 AM
Hmmm looking at the specs . . . the only difference is twice the memory as the 168.

airman00, I remember you mentioning that you are making a product with the 168 . . . here is your chance to double your memory as a way to outdo the Arduino. ;D
Title: Re: ATmega328 - Drop in replacement for ATmega168
Post by: airman00 on October 27, 2008, 08:48:05 AM
airman00, I remember you mentioning that you are making a product with the 168 . . . here is your chance to double your memory as a way to outdo the Arduino. ;D

 have a DIP socket , so I can put either the 8,168,or 328
Title: Re: ATmega328 - Drop in replacement for ATmega168
Post by: pomprocker on January 05, 2009, 09:12:02 PM
got two ATmega328P's in the mail from mouser today when I got home.


Dropping them in my Roboduino, and my $50 robot board.
 ;D

Title: Re: ATmega328 - Drop in replacement for ATmega168
Post by: pomprocker on January 06, 2009, 12:26:01 AM
hmmm, what to do...it may just be late and i'm tired and i don't see something i missed:


Compiling: 50_robot_sharp_IR.c
avr-gcc -c -mmcu=atmega328p -I. -gstabs   -O0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=50_robot_sharp_IR.lst  -std=gnu99 -Wp,-M,-MP,-MT,50_robot_sharp_IR.o,-MF,.dep/50_robot_sharp_IR.o.d 50_robo
t_sharp_IR.c -o 50_robot_sharp_IR.o

unknown MCU 'atmega328p' specified
Known MCU names:
   avr2
   at90s2313
   at90s2323
   at90s2333
   at90s2343
   attiny22
   attiny26
   at90s4414
   at90s4433
   at90s4434
   at90s8515
   at90c8534
   at90s8535
   at86rf401
   attiny261
   attiny461
   attiny861
   attiny13
   attiny2313
   attiny24
   attiny44
   attiny84
   attiny25
   attiny45
   attiny85
   avr3
   atmega103
   atmega603
   at43usb320
   at43usb355
   at76c711
   avr4
   atmega8
   atmega48
   atmega88
   atmega8515
   atmega8535
   at90pwm2
   at90pwm3
   avr5
   atmega16
   atmega161
   atmega162
   atmega163
   atmega164p
   atmega165
   atmega165p
   atmega168
   atmega169
   atmega169p
   atmega32
   atmega323
   atmega324p
   atmega325
   atmega3250
   atmega329
   atmega3290
   atmega406
   atmega64
   atmega640
   atmega644
   atmega644p
   atmega645
   atmega6450
   atmega649
   atmega6490
   atmega128
   atmega1280
   atmega1281
   at90can32
   at90can64
   at90can128
   at90usb646
   at90usb647
   at90usb1286
   at90usb1287
   at94k
   avr6
   atmega2560
   atmega2561
   avr1
   at90s1200
   attiny11
   attiny12
   attiny15
   attiny28
50_robot_sharp_IR.c:1: error: MCU 'atmega328p' supported for assembler only



I think I have to upgrade some libraries...bah i'm too tired, another day...
Title: Re: ATmega328 - Drop in replacement for ATmega168
Post by: TrickyNekro on January 06, 2009, 07:23:16 AM
Hmmm looking at the specs . . . the only difference is twice the memory as the 168.

airman00, I remember you mentioning that you are making a product with the 168 . . . here is your chance to double your memory as a way to outdo the Arduino. ;D

Double flash but also double EEPROM....  :P
Title: Re: ATmega328 - Drop in replacement for ATmega168
Post by: pomprocker on January 06, 2009, 10:58:33 AM
yeah i ended up upgrading my winavr last night to the december 2008 version, but then I got some other syntax errors, like it didnt recognize the registers or something
Title: Re: ATmega328 - Drop in replacement for ATmega168
Post by: Ro-Bot-X on January 06, 2009, 06:02:21 PM
The Arduino guys worked the kinks out and Arduino version 11 is compatible with ATmega368. You can buy the microcontroller with the bootloader uploaded from a few sites that sell Arduino stuff. Take a look at the Arduino forum, there is no reason to reinvent the wheel... (I mean struggle to solve a problem others did allready...)
Title: Re: ATmega328 - Drop in replacement for ATmega168
Post by: pomprocker on January 06, 2009, 07:21:31 PM
Oh but this is for AVR Studio 4
Title: Re: ATmega328 - Drop in replacement for ATmega168
Post by: Ro-Bot-X on January 06, 2009, 08:30:08 PM
And Arduino is based on AVR GCC... and they are using some of the avrlib... and AVRdude to program the microcontroller... So maybe, maybe it will worth a look... I looked when they were talking about it, and there is some info that may help you. I don't remember exactly what was it, and I'm sorry I don't have the time to dig it up.
Title: Re: ATmega328 - Drop in replacement for ATmega168
Post by: pomprocker on January 08, 2009, 12:13:20 AM
Gettin these errors now after updating the winavr to 20081205, at least it recognized the mcu now.  all UART errors. Would the 328 have different register names?


Compiling: uart.c
avr-gcc -c -mmcu=atmega328p -I. -gstabs   -O0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=uart.lst  -std=gnu99 -Wp,-M,-MP,-MT,uart.o,-MF,.dep/uart.o.d uart.c -o uart.o
uart.c: In function 'uartInit':
uart.c:52: error: 'UCR' undeclared (first use in this function)
uart.c:52: error: (Each undeclared identifier is reported only once
uart.c:52: error: for each function it appears in.)
uart.c:52: error: 'RXCIE' undeclared (first use in this function)
uart.c:52: error: 'TXCIE' undeclared (first use in this function)
uart.c:52: error: 'RXEN' undeclared (first use in this function)
uart.c:52: error: 'TXEN' undeclared (first use in this function)
uart.c: In function 'uartSetBaudRate':
uart.c:93: error: 'UBRRL' undeclared (first use in this function)
uart.c: In function 'uartSendByte':
uart.c:119: error: 'UDR' undeclared (first use in this function)
uart.c: At top level:
uart.c:230: warning: 'SIG_UART_TRANS' appears to be a misspelled signal handler
uart.c: In function 'SIG_UART_TRANS':
uart.c:239: error: 'UDR' undeclared (first use in this function)
uart.c: At top level:
uart.c:258: warning: 'SIG_UART_RECV' appears to be a misspelled signal handler
uart.c: In function 'SIG_UART_RECV':
uart.c:263: error: 'UDR' undeclared (first use in this function)
make: *** [uart.o] Error 1
Build failed with 11 errors and 3 warnings...