How to burn a bootloader on an ATTINY45/85 - Page 1
Forum section: electronics / general

author: ChrisGreece52
author_rank: Frequent Contributor
timestamp: August 10, 2014, 01:38:20 am
content: I recently got a USBASP v2.0 board from ebayhttp://www.ebay.com/itm/1PC-USBasp-USBISP-AVR-Programmer-USB-3-3V-5V-ATMEGA8-for-Arduino-Raspberry-pi-/121405832444?pt=LH_DefaultDomain_0&hash=item1c4459fcfcAnd i really have no idea on how to use it .....watching a Ben Heck's episode about AVR chips in which he makes a development boardso using some pictures like this one i found using googlehttp://www.arduinodev.com/wp-content/uploads/2012/03/image004.jpgandhttp://www.arduinodev.com/wp-content/uploads/2012/03/usbasp_10pin-300x246.jpgSo i made a board using the diagram for ATTINY85http://highlowtech.org/wp-content/uploads/2011/10/ATtiny45-85.pngbut i could not get it working when i tried to burn a bootloader on the chip i got errors like OUTPUT was not declared as and input and such .... what is the most efficient way to approach this project???Thank you in advance for your suggestions.

author: andrewwong2000
author_rank: Contributor
timestamp: August 10, 2014, 07:28:18 am
content: I have the exact same USBASP from eBay.1. AVRDUDE (AVRDUDESS is the Windows GUI version) 6.1 has an option for "Any USBASP board" instead of choosing the "USBASP" item - it ignores the USB id which is necessary for all the clone programmers2. Make sure the 10pin header pins match to your chip/board properly. 1-1. MISO-MISO, MOSI-MOSI, CLK-CLK, RESET-RESET. The VCC-VCC, GND-GND also - as the USBASP can provide power to your chip/board for programming.3. Make sure you set the correct voltage 3.3v or 5v4. In AVRDUDESS be careful with fuse/lock bits so you don't brick your AVR ( I'm learning the hard way)( I also learnt that if Erase Chip/EEPROM is ticked.. the programmer will still erase your chip before trying to "READ" it ! )5. Ignore the clk warning from AVRDUDE that tells you to update the firmware. Red Herring.Also read this :https://learn.sparkfun.com/tutorials/installing-an-arduino-bootloaderGoogle is your new best friend

author: ChrisGreece52
author_rank: Frequent Contributor
timestamp: August 10, 2014, 11:17:54 am
content: Thank you very much i'll try and i'll reply

author: dannyf
author_rank: Super Contributor
timestamp: August 10, 2014, 02:06:52 pm
content: QuoteUsually it involves getting the right bootloader, right fuse settings and then a programmer / programming software to burn it into the chip.QuoteShowing a screen show of your error messages would be quite helpful - it tells people exactly what the error messages are, how you got them, etc.

author: ChrisGreece52
author_rank: Frequent Contributor
timestamp: August 10, 2014, 03:14:25 pm
content: After i select the programer (USBASP) the board (ATTiny85 20Mhz) and burn bootloader i get this messageavrdude: warning: cannot set sck period. please check for usbasp firmware update.avrdude: warning: cannot set sck period. please check for usbasp firmware update.Though i searched and installed the latest driver i still get this...

author: andrewwong2000
author_rank: Contributor
timestamp: August 10, 2014, 03:18:56 pm
content: If you really want to upgrade the USBASP firmware.. you need a 2nd programmer (wire up an Arduino etc.)You will need to short the JP2 (either by soldering a header to it, or wire) to program it.Careful.. or you may brick the USBASP.

author: ChrisGreece52
author_rank: Frequent Contributor
timestamp: August 10, 2014, 03:29:37 pm
content: Thats the thing i think it requires the software to be updated....i tried a new update and then got this messageavrdude: warning: cannot set sck period. please check for usbasp firmware update.avrdude: error: programm enable: target doesn't answer. 1avrdude: initialization failed, rc=-1Double check connections and try again, or use -F to overridethis check.I am now thinking of remaking the board so i make sure there is not connections node badly.

author: dannyf
author_rank: Super Contributor
timestamp: August 10, 2014, 04:03:44 pm
content: Likely incorrect wiring.

author: ChrisGreece52
author_rank: Frequent Contributor
timestamp: August 10, 2014, 04:32:57 pm
content: I created a simpler board but i noticed something that made me feel stupid.... at the bottom of the arduino IDE where it says the board selected and the COM port i now saw the external 20Mhz clock.... should i add a crystal on the board .... and where?

author: Stonent
author_rank: Super Contributor
timestamp: August 10, 2014, 04:38:23 pm
content: You don't have to load a bootloader to load HEX files onto other chips. There are different variations of the USBASP.One shows as a USB HID device and one does not.Also they get wired differently on the board. The one that I bought was flashed with some firmware that only worked with some chinese software and not avrdude. I loaded the USBASP firmware and it no longer worked at all. The problem was they wired the USB lines to different pins on the chip and I had to reflash with the modified firmware from the USBASP site and it worked fine after that.In general I don't use it as it ends up being more of a hassle than just rigging up my arduino as a programmer.

author: ChrisGreece52
author_rank: Frequent Contributor
timestamp: August 10, 2014, 05:27:17 pm
content: So what would the best solution begetting another programmer or just changing the wiring?

author: paulie
author_rank: Frequent Contributor
timestamp: August 16, 2014, 02:36:37 am
content: check wiring, besides pwr/gnd there are only 4: miso, mosi, sck, reset. clearly labelled on the usbasp and datasheet.use cmd line: avrdude -pm8 -cusbasp -Ulfuse:r:-:h -Fif this dont work try another chip and if that dont work another usbasp. at $2 each on ebay its silly to buy just one. contrary to popular belief the cheapest ones are the most likely to work.

author: dannyf
author_rank: Super Contributor
timestamp: August 16, 2014, 05:43:54 pm
content: QuoteIt may not be the best solution but I would first figure out what your wiring is.Whatever you think are the least likely to go wrong, start from there.

author: m12lrpv
author_rank: Regular Contributor
timestamp: August 22, 2014, 02:59:32 am
content: The bootloader is for serial programming of Arduino's and clones.For ATTINY's the only reason you use the "load bootloader" in the arduino environment is for fuse programming. It doesn't actually load a bootloader so you will always get errors but as long as the fuses get written correctly you really don't care about the errors.After the fuses are written you just load your code using your icsp programmer.Make sure that your boards.txt is set up correctly for how you want to use the chip.For the attiny85 I deleted all reference to crystal driven configurations and also for the 1MHz internal because I'll never use them. Give me the 8MHz internal and I'm good to go. No way am I going to waste 2 pins on such a small device for a 3x speed gain?

author: westfw
author_rank: Super Contributor
timestamp: August 22, 2014, 08:26:25 am
content: QuoteNot quite true. There are several ATTiny boards that include a SW USB bootloader, enabling them to be loaded from the development environment without separate programmer hardware. (digispark, Gemma, Trinket, for example.) Luminet had a serial bootloader (but I'm not sure that ever made it to "product" status.)