MembersPage/MattiasSandgren/NickesBMW/AvrBootCode

AVR bootloader replacement

Disclaimer : Using ISP is NOT needed, causes unnecessary complications and inconvenience, it voids warranty and is NOT supported.

The main source of information about the boot loader is here : GenBoard/Firmware/BootLoader.

Due to a failure with the electrical system in the car we had to replace the old AVR, the new chip was missing a boot loader so this page is about what was done to program the AVR.

The tools used to program the AVR is avrdude : [download here]. Or you can use the open source software development tools for the Atmel AVR, [WinAVR] includes avrdude.

As a regular user you can upgrade the bootloader with [VemsTune] by requesting bootloader hex file. Submit your serialnr and original orderID or at least name of customer who purchased assembled controller or board. Without the proper serialnr the software will not work properly.

Either way you go about it, the bootloader can't be upgraded if the correct fuses and lock bits in the AVR chip are not set correctly. If that happens you need an ISP cable and the avrdude software, read on below.

After the bootloader is uploaded


Using avrdude

To burn the fuses and lock bits, use this code:\nÿ1ÿ

Note that lock=3C is recommended (not lock=3F) to allow bootloader-upgrade later.

At this point regular users can use [VemsTune]. If you are an advanced user/developer, then use avrdude for programming the actual bootloader file :\n

D:\VEMS>avrdude -c bsd -p m128 -U flash:w:main.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9702

avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed

         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "main.hex"
avrdude: input file main.hex auto detected as Intel Hex
avrdude: writing flash (131072 bytes):

Writing | ################################################## | 100% 50.61s

avrdude: 131072 bytes of flash written
avrdude: verifying flash memory against main.hex:
avrdude: load data flash data from input file main.hex:
avrdude: input file main.hex auto detected as Intel Hex
avrdude: input file main.hex contains 131072 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 48.36s

avrdude: verifying ...
avrdude: 131072 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.


ISP via AVR Pocket Programmer

This USB programmer can be purchased through the webshop :

vems-genboard-avr-programmer.jpg

The cable that comes with the programmer does not match the pinout. The v3 ISP header pinout (with comments) can be found [here]. Do not connect VCC if the Genboard is powered through EC36-pin25 (+12V).

vems-genboard-isp-header.jpg


See GenBoard/Firmware/BootLoader/BsdCable for Parallel port (printer port) ISP cable that can be made quickly from old PC parts