Guys plzz help me out . Just recently i bought a Atmel Atmega 48 PA - PU, but dont know how to install the bootloader to it........i searched the Web but couldn't find any satisfactory answer.......and i just have an Arduino UNO with an Atmega 328 on it........to burn the bootloader....plzz help guys
I don't think that the bootloader currently supports the m48 (which lacks the separate "bootloader section" support.) It might work with the "virtual boot partition" code that is in optiboot, but that hasn't be tested in a long time and I don't know if it works.
You have to make a bootloader with Optiboot. You can make the Optiboot size less than 512 bytes. It's just a matter of the right options for Optiboot, and that is the problem. It is for me very hard to determine the right options. You also have to create a new section in boards.txt The ATmega48P(A) is the same family as the ATmega328P, so the registers are the same.
You can use the Arduino Uno as "Arduino ISP", you might even use that to upload a sketch without bootloader. This is the ATmega48PA without bootloader : http://www.thinkcreate.org/index.php/arduino-porting-to-atmega48/
In the end, it is better to buy a ATmega328P chip, because that is Arduino compatible. Why do you want to use the ATmega48PA ?
i bought it coz i didn't find any boards mentioning this microprocessor in the IDE , just wanted to know how to define a new board for it and burn the bootloader , so bought it , its just curiosity.........i will try the way you proposed and keep you posted...........thanks for the help
The ATmega48PA has very small memory. You can blink a led, and maybe say “Hello” to the serial monitor. That’s about it. The ATmega8 is one of the official Arduino chips, but even the 8kbyte flash is very limited.
1 ) External crystal or internal oscillator ? You can start with external crystal. The examples for bare-bone Arduino can be used.
2 ) Look into the file “boards.txt” for the ATmega168 and the ATmega328. Also look at the link in my previous post. Find the right fuses for the ATmega48PA. Check them with the fuse tool : http://www.engbedded.com/fusecalc/
3 ) You might also have to add an section to avrdude.conf.
4 ) Try to use Arduino as ISP to program a sketch in the ATmega48PA.
5 ) A bootloader. Now this is getting ugly. The Optiboot 5.0a is not very compatible with the Arduino IDE 1.5.8. You might better try it with Arduino IDE 1.0.6.
Inside optiboot.c, you have to add the a “#elif defined(AVR_ATmega48P)” and set the right values for ram and flash size.
I think the ATmega48PA has the same signature as the ATmega48P, so building a bootloader should be the same for both.
Using the right options is very hard, I never found a good explanation. The make-file has some defaults. Perhaps the default for the ATmega328p can also be used for the ATmega48PA.
As of 2016 you have optiboot/README.md at master · sleemanj/optiboot · GitHub .
Install this plugin to arduino IDE
Also download this repo and save it to a separate directory. If you have linux, things are easy as follows, there may be similar method for Windows but , don’t have time to test.
sudo apt-get install gcc-avr avr-libc
make (test if make throws any error, if not continue)
Connect 16Mhz crystals and 22pf capaciotrs to your Atmega48PA (if possible solder them on a perfboard, for me serial communications didn’t work without crystal).
Use arduino as ISP,
Edit “Makefile.isp” edit the lines under STK500v2 programmer.
ISPTOOL = stk500v1
ISPPORT = /dev/ttyACM0
ISPSPEED = -b 19200
sudo AVR_FREQ=16000000L BAUD_RATE=57600 LED_START_FLASHES=1 make atmega48pa_isp LFUSE=FF HFUSE=D9
8 .Finished , Disconnect ISP, and use a USB-to-TTL , Try programming using arduino IDE, use the appropriate setting for the board, MCU speed and type, remember that you have to install the plugin from step 1 to arduino IDE.
You may have to manually reset the MCU every time before programming though serial. (not necessary until first successful flash)
If step 7 or 3 show some overlapping address errors, edit
under “TARGET = atmega48pa” section, modify .text and .version, you can use a calculator to convert hex from the error log to decimal , and adjust the address. Just make sure the they don’t overlap.
Or if you don't feel like going through all that just use https://github.com/MCUdude/MiniCore
occupy ~600b of space on a 4096b microcontroller is just silly. The space is already small enough..