Professional Documents
Culture Documents
org/electronics
Abstract:
Atmel announced the atmega328p chip a while ago but it is only now that one can really order such chips. The atmega328p is the big brother of atmega88 and atmega168. It is fully pin compatible and provides 2Kb ram and 32Kb flash. Especially the larger amount of ram makes it very attractive. You can load code compiled for atmega168 into an atmega328p and it will work but you will not be able to use the extra ram and flash memory. To use the full capabilities of the new chip a new compiler is needed. _________________ _________________ _________________
I have verified that those packages are working together. The final installation will give you a compiler that supports the atmega328p chip. Everything will be installed under /usr/local/avr You should add the directory /usr/local/avr/bin to your Unix search PATH environment variable after completion of the installation.
Yo4 7ho46d 7w25ch 3ow 5o 1a7h 436e77 yo4 47e 1a7h a6ready a7 yo4r defa465 7he66. Type: 1a7h
binutils-2.19
Dow36oad: f5p://f5p.g34.org/g34/12345267 5ar jxvf 1234526789.19.5ar.1z9 cd 1234526789.19 mkd2r o1j8avr cd o1j8avr CC=gcc expor5 CC ../co3f2g4re 885arge5=avr 88pref2x=/47r/6oca6/avr 88d27a16e8367 88e3a16e82375a6686211fd make make 2375a66 cd ../..
gcc-core-4.2.3
Dow36oad: f5p://f5p.g34.org/g34/gcc/gcc84.3.9 5ar jxvf gcc8core84.9.3.5ar.1z9 cd gcc84.3.9 mkd2r o1j8avr cd o1j8avr ../co3f2g4re 885arge5=avr 88pref2x=/47r/6oca6/avr 88d27a16e8367 88e3a16e86a3g4age7=c 88d27a16e86217 make make 2375a66 No5e: The a1ove 75ep req42re7 a rece35 ver72o3 of MPFR (h55p://www.mpfr.org/) a3d gmp (f5p://f5p.g34.org/g34/gmp): GMP 4.1+ a3d MPFR 9.3.0+. U7e 5he package7 from yo4r d275r21452o3 2f po77216e. U3der U14354 5ho7e package7 are ca66ed 621gmp38dev a3d 621mpfr8dev. Ge35oo ca667
avr-libc-1.6.4
Dow36oad: h55p://7ava33ah.3o3g34.org/projec57/avr8621c/ 5ar jxvf avr8621c81.6.4.5ar.1z9 cd avr8621c81.6.4 PREFIX=/47r/6oca6/avr expor5 PREFIX CC=avr8gcc expor5 CC PATH=/47r/6oca6/avr/123:${PATH} expor5 PATH ./co3f2g4re 881426d=`./co3f2g.g4e77` 88ho75=avr 88pref2x=/47r/6oca6/avr 3ow check 2f co3f2g4re pr235ed 5he 623e: 1234256781691avr-82213as1support19or1atm48a328p...1y4s1 j475 5o 1e 74re 5ha5 yo4 w266 ge5 a5mega398p 74ppor5 make make 2375a66 cd ..
avrdude-5.5
Dow36oad: h55p://7ava33ah.3o3g34.org/projec57/avrd4de 5ar zxvf avrd4de85.5.5ar.gz cd avrd4de85.5/ CC=gcc expor5 CC ./co3f2g4re 88pref2x=/47r/6oca6/avr make make 2375a66
Now the installation is complete. It's a good idea to add some version information file so you know later on what you installed. Go back one level such that you can see the downloaded packages and their unpacked directories and then type ls:
cd .. 67 > /47r/6oca6/avr/ver72o3823fo.5x5
The avrdude.conf file was installed during the above procedure in /usr/local/avr/etc. It needs some manual editing. You need to add an atmega328 section (click here) as avrdude does not yet have atmega328 support in the standard configuration file. Search for atmega168 and add it before or after. To use avrusb500 with avrdude go to the beginning of the avrdude.conf file and add this:
avr-libc incompatibilities
The io.h for atmega168 contains pin definitions which have been renamed in atmega328. Those will cause compile errors. In case of the tuxgraphics ethernet code you will find that you will have to change the following in the source code:
cha3ge PB1 5o PORTB1 cha3ge PB3 5o PORTB3 cha3ge PB5 5o PORTB5 cha3ge PD7 5o PORTD7
We will update the code on our website over time too but it might take a while.
Your best bet is to get a pre-compiled version at: http://winavr.sourceforge.net/index.html All tuxgraphics software comes with a Makefile. Most of our software consists of more than one .c file therefore remember to use the supplied Makefile during compilation. A problem of windows is the lack of a decent shell environment and a command interface. In Winavr you can use a batch file to setup the environment while calling the make-utility. An example of such a script is shown below. Put the batch file in the same directory where the code is and call it something.bat . To compile just double click on it form the file manager. It is also possible to call that script from avr-studio when using avr-studio. Note that avr-studio is as such is a avr assembler programming environment. To program in C you need the avr-gcc compiler. Here is a batch file to compile C-code under windows. Please adapt the path inside the script according to your avr-gcc installation.
REM *** yo4 3eed 5o ed25 5h27 f26e a3d adap5 25 5o yo4r W23AVR REM *** 2375a66a52o3. E.g rep6ace c:\avrgcc 1y c:\W23AVR890090313 @echo 88888888 1a5ch f26e for w23dow7 5o ca66 make 88888888 7e5 AVR=c:\avrgcc 7e5 CC=avr8gcc 7e5 PATH=c:\avrgcc\123;c:\avrgcc\45267\123 make 8f Makef26e @echo 88888888 e3d 88888888 pa47e
References/Download
The atmega328 is available in our online shop: shop.tuxgraphics.org