## ### ## ## ####
## ## #### ## #### ## ##
___ ( _`\ | (_(_) | _) | | (_)
# # # ### ## # # # # # # #
___ / _ \ | | | | | |_| | \___/
IMPORTANT: enter the case-INsensitive alphabetic (no numbers) code AND WRITE SOME SHORT summary of changes (below) if you are saving changes. (not required for previewing changes). Wiki-spamming is not tolerated, will be removed, so it does NOT even show up in history. Spammers go away now. Visit Preferences to set your user name Summary of change: '''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''' : [http://savannah.nongnu.org/projects/avrdude/ download here]. \ Or you can use the open source software development tools for the Atmel AVR, [http://sourceforge.net/projects/winavr/ WinAVR] includes avrdude. As a regular user you can upgrade the bootloader with [http://www.vems.hu/vt/help/v3/general/bootloader_upgrade.html 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''' * Upload firmware with VemsTune (Tools / Firmware upload) * See File / firmware info ** Check your serialnr and firmware version ---- '''Using avrdude''' To burn the fuses and lock bits, use this code: <code> avrdude -V -c bsd -p m128 -U flash:w:main.hex avrdude -c bsd -p m128 -U lfuse:w:0x2f:m -U hfuse:w:0xc4:m -U efuse:w:0xff:m -U lock:w:0x3c:m </code> Note that lock=3C is recommended (not lock=3F) to allow bootloader-upgrade later. At this point regular users can use [http://www.vems.hu/vt/help/v3/general/bootloader_upgrade.html VemsTune]. If you are an advanced user/developer, then use avrdude for programming the actual bootloader file : <code> 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. </code> ---- ISP via AVR Pocket Programmer This USB programmer can be purchased through the webshop : * [https://shop.vems.hu/catalog/cable-p-165.html AVR ISP cable USB] in the adapter cables category. * Command syntax : avrdude -c '''usbtiny''' -p m128 ... http://www.vems.hu/files/MembersPage/MattiasSandgren/ISP/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 [http://vems.hu/download/v3/doc/assembly/cable.txt here]. Do not connect VCC if the Genboard is powered through EC36-pin25 (+12V). http://www.vems.hu/files/MembersPage/MattiasSandgren/ISP/vems-genboard-isp-header.jpg ---- '''ISP via Parallel port''' * You may have to install giveIO usually found in c:/winavr/bin/install_giveio.bat to enable direct access to the parallel port. * Command syntax : avrdude -c '''bsd''' -p m128 ... ||AVR pin command||ISP header #||Parallel port pin||Notes|| ||AVR /RESET||5||7||Yellow|| ||AVR SCK (clock input)||3||8||Black|| ||AVR PDI (RXD) (instruction in)||4||9||Red|| ||AVR PDO (TXD) (data out)||1||10||Orange|| ||Signal Ground||6||18||Brown|| * MOSI and MISO are not used. Correct pins from the schematics AVR pin 2 = RXD/PDI -> ISP header Pin4, AVR Pin3 = TXD/PDO -> ISP header pin 1 This is what it looked like: http://www.vems.hu/files/MembersPage/MattiasSandgren/avr_isp_cable/avr_isp_cable_attached.jpg http://www.vems.hu/files/MembersPage/MattiasSandgren/avr_isp_cable/avr_isp_cable_ends.jpg ---- Optional: Add document to category: Wiki formatting: * is Bullet list ** Bullet list subentry ... '''Bold''', ---- is horizontal ruler, <code> preformatted text... </code> See wiki editing HELP for tables and other formatting tips and tricks.