Author Topic: How to burn a bootloader on an ATTINY45/85  (Read 12132 times)

0 Members and 1 Guest are viewing this topic.

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
How to burn a bootloader on an ATTINY45/85
« on: August 10, 2014, 01:38:20 am »
I recently got a USBASP v2.0 board from ebay
http://www.ebay.com/itm/1PC-USBasp-USBISP-AVR-Programmer-USB-3-3V-5V-ATMEGA8-for-Arduino-Raspberry-pi-/121405832444?pt=LH_DefaultDomain_0&hash=item1c4459fcfc
And 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 board

so using some pictures like this one i found using google
http://www.arduinodev.com/wp-content/uploads/2012/03/image004.jpg
and
http://www.arduinodev.com/wp-content/uploads/2012/03/usbasp_10pin-300x246.jpg
So i made a board using the diagram for ATTINY85 http://highlowtech.org/wp-content/uploads/2011/10/ATtiny45-85.png
but 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.
 

Offline andrewwong2000

  • Contributor
  • Posts: 36
  • Country: au
Re: How to burn a bootloader on an ATTINY45/85
« Reply #1 on: August 10, 2014, 07:28:18 am »
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 programmers

2. 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 5v

4. 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-bootloader

Google is your new best friend :)
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: How to burn a bootloader on an ATTINY45/85
« Reply #2 on: August 10, 2014, 11:17:54 am »
Thank you very much i'll try and i'll reply :D
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: How to burn a bootloader on an ATTINY45/85
« Reply #3 on: August 10, 2014, 02:06:52 pm »
Quote
How to burn a bootloader on an ATTINY45/85

Usually it involves getting the right bootloader, right fuse settings and then a programmer / programming software to burn it into the chip.

Quote
what is the most efficient way to approach this project???

Showing 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.
================================
https://dannyelectronics.wordpress.com/
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: How to burn a bootloader on an ATTINY45/85
« Reply #4 on: August 10, 2014, 03:14:25 pm »
After i select the programer (USBASP) the board (ATTiny85 20Mhz) and burn bootloader i get this message
avrdude: 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...
 

Offline andrewwong2000

  • Contributor
  • Posts: 36
  • Country: au
Re: How to burn a bootloader on an ATTINY45/85
« Reply #5 on: August 10, 2014, 03:18:56 pm »
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.
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: How to burn a bootloader on an ATTINY45/85
« Reply #6 on: August 10, 2014, 03:29:37 pm »
Thats the thing i think it requires the software to be updated....

i tried a new update and then got this message
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

I am now thinking of remaking the board so i make sure there is not connections node badly.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: How to burn a bootloader on an ATTINY45/85
« Reply #7 on: August 10, 2014, 04:03:44 pm »
Likely incorrect wiring.
================================
https://dannyelectronics.wordpress.com/
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: How to burn a bootloader on an ATTINY45/85
« Reply #8 on: August 10, 2014, 04:32:57 pm »
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?
 

Offline Stonent

  • Super Contributor
  • ***
  • Posts: 3824
  • Country: us
Re: How to burn a bootloader on an ATTINY45/85
« Reply #9 on: August 10, 2014, 04:38:23 pm »
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.
The larger the government, the smaller the citizen.
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: How to burn a bootloader on an ATTINY45/85
« Reply #10 on: August 10, 2014, 05:27:17 pm »
So what would the best solution be ??? getting another programmer or just changing the wiring?
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: How to burn a bootloader on an ATTINY45/85
« Reply #11 on: August 16, 2014, 02:36:37 am »
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 -F

if 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.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: How to burn a bootloader on an ATTINY45/85
« Reply #12 on: August 16, 2014, 05:43:54 pm »
Quote
So what would the best solution be

It 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.
================================
https://dannyelectronics.wordpress.com/
 

Offline m12lrpv

  • Regular Contributor
  • *
  • Posts: 175
  • Country: au
Re: How to burn a bootloader on an ATTINY45/85
« Reply #13 on: August 22, 2014, 02:59:32 am »
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?
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: How to burn a bootloader on an ATTINY45/85
« Reply #14 on: August 22, 2014, 08:26:25 am »
Quote
For ATTINY's the only reason you use the "load bootloader" in the arduino environment is for fuse programming.

Not 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.)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf