Saturday, June 1, 2013

Installing a bootloader on a Sanguinololu Part 2

I've finally got to the bottom of the issues I was having, and my the FUSE settings on the ATMega1284p where different from the settings I was seeing on a variety of other sources.  I also installed a bootloader that works correctly with the 1284p.

See my first entry on how to setup an Arduino (Mega2560 in my case) as an ISP.  That is still valid.  Do not buy the Sparkfun ISP Pocket Programmer - it cannot handle a chip with more than 64K flash, so it won't work with the 1284p (the bootloader sits in the upper 64k) -- I learnt that when I tried to use it.

I ended up grabbing the bootloader from https://github.com/jmgiacalone/sanguino1284p.  I'm running with the Arduino IDE 1.05 and that bootloader seems to work with it.

I did end up modifying the FUSE settings to match what was on the old ATMega1284p -- in my case, the Sanguinolou board has a 16Mhz crystal on it, and not a Ceramic Resonator.  That's why my FUSE settings are different.  You can see from the pictures below the differences:


Top view of my board - no resonator...
Underside of my board - metal Xtal Oscilator





















From reprap.org - the blue 3 wired part is a ceramic resonator


I ended up with the following values for the fuses:

High Fuse: 0xDC, Low Fuse: 0xD7, Extended Fuse: 0xFD

I modified my boards.txt file and added an entry specifically for my board with the crystal oscillator.


atmega1284.name=Sanguinololu W/ ATmega1284p 16mhz

atmega1284.upload.protocol=stk500v1
atmega1284.upload.maximum_size=129024
atmega1284.upload.speed=57600

atmega1284.bootloader.low_fuses=0xd7
atmega1284.bootloader.high_fuses=0xdc
atmega1284.bootloader.extended_fuses=0xfd
atmega1284.bootloader.path=standard
atmega1284.bootloader.file=ATmegaBOOT_1284P.hex
atmega1284.bootloader.unlock_bits=0x3F
atmega1284.bootloader.lock_bits=0x0F

atmega1284.build.mcu=atmega1284p
atmega1284.build.f_cpu=16000000L
atmega1284.build.core=arduino

I found this FUSE calculator page useful in understanding what the different bit combinations actually mean -- http://www.engbedded.com/fusecalc/  -- the one thing I might go back and work on is the boot time -- right now, the board takes a long time to connect to Repetier Host, and I think that's down to the timeout delays in the Boot Loader I'm using. However, I've other things that need sorting first.





No comments:

Post a Comment