Go Down

Topic: 32U4 bootloader getting corrupted (Read 912 times) previous topic - next topic

BrotherTheo

Hi,

We have a custom board with a 32U4. The bootloader keeps getting trashed. I am using an AVRISP II and Studio 4 to program. A verify confirmed the bootloader was corrupted. It is happening during routine Arduino downloads.

Bootloader: Leonardo-prod-firmware-2012-12-10.hex
Fuse Bits:  BOD 4.3V, HWBE, SPIEN, Boot Size 2048, BOOTRST

Any ideas?

--TimR

BrotherTheo

Question: should I be setting the BLB lock bits?  What values should I use?

--TImR

BrotherTheo

I tried setting the BLB lock bits but the board has failed again. I have not checked out yet so I don't know if the bootloader is trashed again.

--TimR

westfw

#3
Dec 11, 2015, 01:44 am Last Edit: Dec 11, 2015, 01:45 am by westfw
How are you setting the fuses?
Are you sure the bootloader is getting corrupted?  Or could it just be non-operational.  It is a common problem (if you don't set the fuses right) that the first attempted use of a new bootloader works OK, but it doesn't work the second time you use it.  This happens if you fail to set the BOOTRST or BOOTSZ correctly; on a blank arduino the unprogrammed memory at other flash locations is (more or less) no-ops, and you get to the bootloader eventually no matter where RESET takes you.   But after you have a sketch in there, it can prevent the bootloader from starting.

(Note that AS4 will NOT program the fuses based on the .hex or .elf file contents, and I don't think the Arduino bootloaders put the fuses into the binaries, anyway.)

BrotherTheo

I am setting the fuses using AS4 and an AVRISP II.  I know the loader got corrupted the first time as I did a verify and the bits did no match. I haven't gotten the hardware back you so I don't know what happened this time.  The board and boot loader have been working fine for a while. The code has been growing, so it may be a size related issue. As for the boot fuses, I have BOOTRST on, and BOOTSZ set to 2K. Gleaning the correct fuse settings has been a struggle. Any help would be appreciated.

--TimR

westfw

In general, you can get the fuses from boards.txt for a "similar" board.  For example, Leonardo has:
leonardo.bootloader.low_fuses=0xff
leonardo.bootloader.high_fuses=0xd8
leonardo.bootloader.extended_fuses=0xcb
(I think that matches what you have...)
Sanity check with http://www.engbedded.com/fusecalc


Go Up