## ## ## # ## ####### ####### ## ##
____ / __ \ | | | | | | | | | |__| | \____/
### ## ### ## ## ## ## ## ## ## #### ###
#### ## ## ###### ## #####
/\ / \ / /\ \ / ____ \ /_/ \_\
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 boot code how to''' Due to a failure with the electrical system in the car last year, we had to replace the AVR, the new chip was missing a boot loader so this page is about what I did to program the AVR. The main source of information about the boot loader is here : GenBoard/Firmware/BootLoader. The command line for the most recent avrdude is a bit different to the advice given there, but it's easy to figure out (don't use ''-c stk200'', use ''-c bsd''). Use my command line for the actual upload of the boot loader, see below. * Download '''avrdude''' [http://savannah.nongnu.org/projects/avrdude/ here]. * Download the [http://www.vems.hu/files/MembersPage/MattiasSandgren/main.hex Boot loader hex file]. ** You'll need to request boot loader hex file from the shop '''for your serialnr''' (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. First I followed the advice about the fuses and then went on to program the AVR boot code. * In avrdude for windows (winAVR) you need to install giveIO in the c:/winavr/bin/install_giveio.bat * Burning the fuses use this code: avrdude -v -c bsd -p m128 -U flash:w:main.hex -U lfuse:w:0x0f:m -U hfuse:w:c4:m -U efuse:w:ff:m -U lock:w:3c:m Note that lock=3C is recommended (not lock=3F) to allow bootloader-upgrade later. ---- <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> ---- This cable is to be used togheter with the "-C bsd" command in AVRDUDE ||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 ---- '''After the bootloader is uploaded''' * upload firmware with VemsTune (Tools / Firmware upload) * see File / firmware info ** check your serialnr and firmware version 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.