Go Down

Topic: Program an Arduino using USBasp (Read 8122 times) previous topic - next topic

vick5821

Hey there, I got an USBasp programmer. I know that to upload sketch to arduino board , not necessary I have to use USB cable. I can also use this USBasp programmer right ? So, if I wanted to use this programmer to program my arduino atmega 328, do I need to do any modiciation ? Or I simply just plug in the 6 pins header and click File--> Upload using programmer ?

This method apply to any AVR chips? with or without bootloader in it ?

Thank you for the help

johnwasser

My USBasp programmer came with a 10-pin ICSP cable.  You'll need a 10-pin to 6-pin adapter.

If you use a factory fresh AVR chip in your Arduino it will, by default, run at 1 MHz instead of 16 MHz.  To set the fuses correctly for the 16 MHz crystal/resonator you will want to burn the bootloader:

Tools->Board->Arduino UNO  (or whatever Arduino board you are programming)
Tools->Programmer->USBasp
Tools->Burn Bootloader

Then you can upload sketches with:

Tools->Board->Arduino UNO  (or whatever Arduino board you are programming)
Tools->Programmer->USBasp
File->Upload Using Programmer
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

vick5821

Yea, I have the 10 pins to 6 pins adapter. So, means every AVR chip that I want to program using arduino IDE I must burn bootloader ? Burning bootlader means that I can program my chip using arduino language and not those from AVR studio ?

vick5821



Hey, help. Suddenly I cant progrram my arduino. Why ??? Please help me.

Thank you

spcomputing



Hey, help. Suddenly I cant progrram my arduino. Why ??? Please help me.

Thank you


Do you remember which direction you hooked the 6-pin cable to the ICSP?  There is a pin 1 designated with a little dot on the UNO.  The colored wire (Red or Black) on the ribbon will tell you which side pin 1 is on the connector.

After that, check if it will upload via programmer (Try a slow clock, if you have a jumper for it).  If not, re-burn your bootloader through the Arduino IDE.
http://www.spcomputing.com

teding

#5
Aug 05, 2012, 08:51 pm Last Edit: Aug 06, 2012, 02:24 pm by teding Reason: 1
I do have the same problem,
If I upload a sketch by Uspasp from the IDE (v1.0.1), the sketchs work fine.
But I can't upload sketches anymore by the arduino ide.
I think the bootloader is over writen.
Burning a new bootloader, solves the problem.
[edit]
If you upload by extrenal programmer, you erase the flash memory, and then uploud the sketch.
(so you loose the bootloader). Is there a option to prevent that ?

johnwasser


I do have the same problem,
If I upload a sketch by Uspasp from the IDE (v1.0.1), the sketchs work fine.
But I can't upload sketches anymore by the arduino ide.
I think the bootloader is over writen.
Burning a new bootloader, solves the problem.
[edit]
If you upload by extrenal programmer, you erase the flash memory, and then uploud the sketch.
(so you loose the bootloader). Is there a option to prevent that ?


It sounds like you are saying:  "When I burn a fresh bootloader it only works once through USB."  That is a symptom of the auto-reset circuit not working.  Fix the auto-reset and you should get the bootloader to work more than once.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

nightcrawler218




Hey, help. Suddenly I cant progrram my arduino. Why ??? Please help me.

Thank you


uhen uploading the program GOTO File>Upload Using Programmer.
"Imagination is more important than knowledge."
-Einstein

mcnobby

Very useful post, my USBasp is now running perfectly after pointers from here. Thanks
Please subscribe to my YouTube Channel : https://www.youtube.com/user/Recovered
Electronic and Software Engineer for e-plex.co
DIY DMX Lighting Group : https://www.facebook.com/groups/584412254990472

camilozk

ey guys!

I am trying a USBasp that I got following the information on this post.


first:

Tools->Board->Arduino Mega
Tools->Programmer->USBasp
Tools->Burn Bootloader

It says "done burning bootloader", but also says "avrdude: warning: cannot set sck period. please check for usbasp firmware update." Arduino´s led start to blink


second, I try to upload "blink":

Tools->Board->Arduino Mega
Tools->Programmer->USBasp
File->Upload Using Programmer


It says "done uploading", and again also says "avrdude: warning: cannot set sck period. please check for usbasp firmware update." There is no blinking in the led, so the sketch is not working.


if after this I connect the arduino again via usb and try again to upload "blink" via AVRISP mkII, it gets stuck in the uploading. "avrdude: stk500v2_getsync(): timeout communicating with programmer"

if I try to burn bootloader, it says "error while trying to burn bootloader" - "avrdude: usbdev_open(): did not find any USB device "usb" Error while burning bootloader."


How can I save my board?
I saw that @johnwasser said "Fix the auto-reset and you should get the bootloader to work more than once." but I dont know what that means...


thanks!

@johnwasser
@vick5821

DrAzzy

ey guys!

I am trying a USBasp that I got following the information on this post.


first:

Tools->Board->Arduino Mega
Tools->Programmer->USBasp
Tools->Burn Bootloader

It says "done burning bootloader", but also says "avrdude: warning: cannot set sck period. please check for usbasp firmware update." Arduino´s led start to blink


second, I try to upload "blink":

Tools->Board->Arduino Mega
Tools->Programmer->USBasp
File->Upload Using Programmer


It says "done uploading", and again also says "avrdude: warning: cannot set sck period. please check for usbasp firmware update." There is no blinking in the led, so the sketch is not working.


if after this I connect the arduino again via usb and try again to upload "blink" via AVRISP mkII, it gets stuck in the uploading. "avrdude: stk500v2_getsync(): timeout communicating with programmer"

if I try to burn bootloader, it says "error while trying to burn bootloader" - "avrdude: usbdev_open(): did not find any USB device "usb" Error while burning bootloader."


How can I save my board?
I saw that @johnwasser said "Fix the auto-reset and you should get the bootloader to work more than once." but I dont know what that means...


Your board is fine, everything you have described is expected.

When you upload a sketch using "upload using programmer", the bootloader is overwritten (this is a limitation imposed by Atmel - you can't erase part of the flash when programming via ISP programmer, erase is all or nothing (unlike via self programming used by the bootloader), so it takes out the bootloader too. This is a feature, it's related to how lockbits work to keep code from being extracted). Thus, after uploading blink using USBAsp, normal upload should fail.

The SCK speed warning should be ignored. There was a project to make a better USBAsp firmware, but it hasn't finished as far as I know - and the other available firmware that does support sck speed setting has problems). I've seen a number of people complain that they tried upgrading it, and it broke all sorts of stuff.

You did not attempt to program it using an AVRISP MKII.  The AVRISP MKII is a physical device, like the USBAsp, only more expensive, it does the same thing.
When you upload normally (by clicking the upload button), the Tools -> Programmer selection is ignored for boards that have a bootloader.

When you attempted to burn bootloader with the other programmer selected, you correctly received an error, since you did not have an AVRISP MKII connected to your computer.

ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

DrAzzy

ey guys!

I am trying a USBasp that I got following the information on this post.


first:

Tools->Board->Arduino Mega
Tools->Programmer->USBasp
Tools->Burn Bootloader

It says "done burning bootloader", but also says "avrdude: warning: cannot set sck period. please check for usbasp firmware update." Arduino´s led start to blink


second, I try to upload "blink":

Tools->Board->Arduino Mega
Tools->Programmer->USBasp
File->Upload Using Programmer


It says "done uploading", and again also says "avrdude: warning: cannot set sck period. please check for usbasp firmware update." There is no blinking in the led, so the sketch is not working.


if after this I connect the arduino again via usb and try again to upload "blink" via AVRISP mkII, it gets stuck in the uploading. "avrdude: stk500v2_getsync(): timeout communicating with programmer"

if I try to burn bootloader, it says "error while trying to burn bootloader" - "avrdude: usbdev_open(): did not find any USB device "usb" Error while burning bootloader."


How can I save my board?
I saw that @johnwasser said "Fix the auto-reset and you should get the bootloader to work more than once." but I dont know what that means...


Your board is fine, everything you have described is expected.

When you upload a sketch using "upload using programmer", the bootloader is overwritten (this is a limitation imposed by Atmel - you can't erase part of the flash when programming via ISP programmer, erase is all or nothing (unlike via self programming used by the bootloader), so it takes out the bootloader too. This is a feature, it's related to how lockbits work to keep code from being extracted). Thus, after uploading blink using USBAsp, normal upload should fail.

The SCK speed warning should be ignored. There was a project to make a better USBAsp firmware, but it hasn't finished as far as I know - and the other available firmware that does support sck speed setting has problems). I've seen a number of people complain that they tried upgrading it, and it broke all sorts of stuff.

You did not attempt to program it using an AVRISP MKII.  The AVRISP MKII is a physical device, like the USBAsp, only more expensive, it does the same thing.
When you upload normally (by clicking the upload button), the Tools -> Programmer selection is ignored for boards that have a bootloader.

When you attempted to burn bootloader with the other programmer selected, you correctly received an error, since you did not have an AVRISP MKII connected to your computer.


To "save" your board, just burn bootloader with USBAsp like you did here, and don't upload a sketch using the USBAsp.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

camilozk

thank you very much for your very precise explanation DrAzzy! very helpful!

just one more note; I saw @ http://www.arduino.cc/en/Hacking/Bootloader?from=Tutorial.Bootloader that the board "must be powered by an external power supply or the USB port." I was also missing that part...



I still cannot upload sketch with the USBasp. After checking that upload via arduino IDE is working normally and that I can restore the bootloader with USBasp, I attempt to upload "blink" via USBasp. What I get still is "done uploading" but no blinking, plus the warning "
avrdude: warning: cannot set sck period. please check for usbasp firmware update."


pert

board "must be powered by an external power supply or the USB port." I was also missing that part...
Shouldn't be necessary with USBasp, it will power the board. That is necessary for the AVRISP MkII programmer though.

I still cannot upload sketch with the USBasp. After checking that upload via arduino IDE is working normally and that I can restore the bootloader with USBasp, I attempt to upload "blink" via USBasp. What I get still is "done uploading" but no blinking
That's a known issue https://github.com/arduino/Arduino/issues/388. So you would either need to change the line in boards.txt:
Code: [Select]
mega.menu.cpu.atmega2560.bootloader.high_fuses=0xD8
to
Code: [Select]
mega.menu.cpu.atmega2560.bootloader.high_fuses=0xD9
However you would need to change it back to D8 if you want to Burn Bootloader. I have had a strange thing happen occasionally after messing with this setting where I get a double bootloader blink on my Mega 2560 that remains even after reburning the bootloader but doesn't appear to cause any problems.

You could also fix this problem(and the avrdude warning) by updating your USBasp firmware to a new, unofficial version but this is a more advanced process and you risk making your programmer unusable. Many of the USBasps come with a locked firmware which prevents you from being able to go back to the original firmware which is better than the standard firmware that is freely available. I would recommend only attempting this if you have a spare USBasp that you will keep the original firmware on in case you have problems with the update. I am using this firmware and have found that it solves your problem and works fine. The instructions are here: https://forum.arduino.cc/index.php?topic=363772.0

camilozk

thanks pert

I tried the first option (mega.menu.cpu.atmega2560.bootloader.high_fuses=0xD8 to mega.menu.cpu.atmega2560.bootloader.high_fuses=0xD9) and it didnt do the job.

the second option looks very complicated so I am not going for it right now... I will study it with time and consider it.

thank you very much for sharing your experience!

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy