USBasp programmer problem

Go To Last Post
17 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Noob here! Please let me know if this doesn't belong here or something else is wrong with my question.

I have been playing around with arduinos for a few weeks and wanted to try to breadboard micro-controller. I'm trying to burn a bootloader to this one but having problems.

I followed the arduino on a breadboard example exactly (below) (http://arduino.cc/en/Main/Standa...)

The arduino "burn bootloader" function gave me some errors so I tried to burn it from the command line using AVRDUDE and got the same errors (see below).

Is this a problem with me having the wrong chip? Are the ATmega328 and the ATmega328P interchangeable? The ATmega328 is not listed in the AVRDUDE manual
http://www.nongnu.org/avrdude/us...

I bought my programmer on ebay (wrong one?) am running windows 7 (64) and am using these drivers
http://www.protostack.com/downlo...

Any help would be greatly appreciated.

If anyone cares, I eventually want to make something with V-USB from obdev.com

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First off. You have done a brilliant post. Especially you neat breadboard with the wires colour-marked.

The ArduinoISP sketch should work perfectly. Just follow the Arduino tutorial. Especially check all your wires.

avrdude -c stk500v1 -P com1 -b 19200 -p ATmega328P -B5

Change the 'com1' to whichever COM # your Arduino is on.

Your photo shows an usbasp. Install the usbasp driver and everything should work. Go to http://www.fischl.de/usbasp/ for a driver.

It looks as if you have an ATmega328 chip. This is different to a ATmega328P, but only the Signature bytes. In all other respects it will work fine.

Unfortunately the current avrdude has not heard of the ATmega328 yet. All the same:

avrdude -c usbasp -p ATmega328P -B5

You should get an answer. Probably saying the Signature is 1E 95 11 or something.

1. the usbasp should be found.
2. the usbasp should 'connect' ok
3. it should say a correc signature.

If you do do get this working, let us know. WE can show you how to recognise the mega328 chip. And I am expecting some identical usbasp in the post shortly.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
First off. You have done a brilliant post. Especially you neat breadboard with the wires colour-marked.

Thanks! I'm glad I didn't get a LMGTFY or some variation of it.

david.prentice wrote:

The ArduinoISP sketch should work perfectly. Just follow the Arduino tutorial.


I can't follow the tutorial exactly yet because I don't have the sparkfun usb to serial converter (I just ordered one) I didn't think I needed it because I wanted to use v-usb but it will probably be nice to have. I also ordered their breakout board for the 10 pin connector, it was only $1.
david.prentice wrote:

Especially check all your wires.

I found a problem with my meter in "beep mode" (I'm sure that's not the right term but oh well) I had the wire for reset connecting through a switch. the switch was loose and so it didn't actually connect to the pin on the chip. I rerouted the wire so that doesn't happen again. (see below)

david.prentice wrote:

Install the usbasp driver and everything should work. Go to http://www.fischl.de/usbasp/ for a driver.

done thanks

david.prentice wrote:

All the same:

avrdude -c usbasp -p ATmega328P -B5

You should get an answer. Probably saying the Signature is 1E 95 11 or something.


It worked! (see below AVRDUDE_works.png) What does that section mean when it says "cannot set sck period"?

I then tried to burn the bootloader I want to use (see below AVRDUDE_works2.png)but had to force it with -F. I think I had to do this because the ATmega328 was not on the list. I think it worked! I'll let you know, I need to figure out how to test it now.

Thanks for the help David and all those who looked.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
It worked! (see below AVRDUDE_works.png) What does that section mean when it says "cannot set sck period"?

This is fine. Many Chinese usbasp firmwares detect the SCK speed automatically. Hence they do not respond to avrdude setting SCK. This is very handy for you because any virgin AVR needs to be programmed relatively slowly ( 1MHz needs -B5 ). Your usbasp uses the best speed that it thinks is suitable.

Quote:
I then tried to burn the bootloader I want to use (see below AVRDUDE_works2.png)but had to force it with -F. I think I had to do this because the ATmega328 was not on the list. I think it worked! I'll let you know, I need to figure out how to test it now.

I really do not like anyone using -F unless they know what they are doing.
Since you have got a good signature 1E9514 for a mega328 everything will be ok.

The best solution is to edit the "avrdude.conf" file.
1. Identify the "ATmega328P" entry.
2. Copy-paste the complete entry.
3. Change the Chip name to ATmega328
4. Change the short name to m328
5. Change the Signature to 1E9514
6. Save the "avrdude.conf"

You find the avrdude.conf file in the /WinAvr-201001110/bin directory. (or equivalent for Toolchain)

Now you never need to lie ! Use 'avrdude -p ATmega328' in the proper manner.

You deserve a prize for an excellent post. I am not too sure what "LMGTFY" means. But your experience certainly shows that a well presented question gets solved with ONE reply. Your time was very well spent. Sometimes these threads go on for weeks !!

If you have a regular Arduino, you need no extra parts at all to use the ArduinoISP sketch for programming.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I am not too sure what "LMGTFY" means

Let me Google That For You. In fact see this:

http://lmgtfy.com/?q=lmgtfy

(I like the fact that this is recursive ;-))

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah-ha. Perhaps I should have googled that for myself !

I still cannot get over how excellently HyrumF's question was composed. Especially the quality of his photos and the simple things like using coloured wires on a neat breadboard.

If only everyone took such care. Every thread would only be two or three posts in length.

@Cliff,

Incidentally I am still waiting for some identical usbasp boards to arrive from China. Is that the model that you bought?

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't have a USBAsp. Someone else perhaps?

(in fact I only recommend them to others here because of you and the fact that you stamped it with a seal of approval ;-))

PS Agree that OP is a great example of how it should be done!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I compiled one of the latest avrdude (SVN1039) from January 2012, it includes new CPU and various bugfixes, try it!

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:

I really do not like anyone using -F unless they know what they are doing.

I realized I was talking a risk there but I thought it would work after what I read. Also, I kinda expect to screw something up which is why I bought 4 chips instead of just 1.

Magister wrote:
I compiled one of the latest avrdude (SVN1039) from January 2012, it includes new CPU and various bugfixes, try it!

Thanks! This works! Now there is no need to -F to program the ATmega328-PU

As you may have noticed the bootloader I was loading was USBaspLoader. ( from http://www.obdev.at/products/vus... ) I'm trying to use V-USB. Once I had it loaded I re built my board to match the metaboard ( https://metalab.at/wiki/Metaboard ) and grounded PD7 so the bootloader would take over. I then plugged in the usb and it immediately recognized as a USBasp.

This is the one I bought

http://www.ebay.com/itm/37053228...

it was only $4 with free shipping. I don't know how they do it! By the way, could these be reprogrammed into an arduino with 4 I/O?

Thanks again for the help!

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have the same programmer but I think I bought it for $5 shipped, I got ripped off! ;-)

You can reprogram it to do whatever you want with it, check http://jethomson.wordpress.com/2...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My three USBasp boards have just arrived. $3.99 each.

I am just about to 'have a play' e.g. test the supplied firmware, install some different firmware.

You unsolder/solder a 0R resistor to select 3.3V or 5V or no_vcc.
You need to solder a 0.05" header to Self-Program.
The supplied firmware is locked.

As far as I can see, these $3.99 boards do what they say on the tin. After all, most people just want to 'ISP and go'.

My original usbasp cost about $10 but it had regular 0.1" pads so I could solder regular 0.1" headers.
IMHO this makes it worth the $10.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey guys, sorry to re-open this but I'm still having a problem.

The bootloader did upload and the it does recognize as a USBasp but I am having problems getting arduino to upload a sketch. I get this error

"In file included from BareMinimum.cpp:1:
C:\Arduino\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:212:26: error: pins_arduino.h: No such file or directory"

I looked though arduino.h to see if I could find anything. couldnt find pins_arduin.h

I thought this had something to do with arduino not supporting the ATmega328-PU so I bought some Atmega328P-PU and had the same result. I also tried arudino v22 and v23 and got this error

"Binary sketch size: 1018 bytes (of a 30720 byte maximum)
avrdude: error: could not find USB device "USBasp" with vid=0x16c0 pid=0x5dc"

I double checked the device manager and USBasp is there.

Here is my blurb in the boards.txt

#################################

metaboard.name=Metaboard

metaboard.upload.protocol=usbasp
metaboard.upload.maximum_size=30720
metaboard.upload.speed=57600

metaboard.bootloader.low_fuses=0xFF
metaboard.bootloader.high_fuses=0xDA
metaboard.bootloader.extended_fuses=0x05
metaboard.bootloader.path=atmega
metaboard.bootloader.file=mega328p_16mhz.hex
metaboard.bootloader.unlock_bits=0x3F
metaboard.bootloader.lock_bits=0x0F

metaboard.build.mcu=atmega328p
metaboard.build.f_cpu=16000000L
metaboard.build.core=arduino

metaboard.upload.disable_flushing=true

#############################

did I screw something up here?

I was thinking this probably belongs in the arduino forums but since I already had this thread I thought I would try here first.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

"Binary sketch size: 1018 bytes (of a 30720 byte maximum)
avrdude: error: could not find USB device "USBasp" with vid=0x16c0 pid=0x5dc"

I double checked the device manager and USBasp is there.


Yes but with what VID and PID? Either use the properties in Device Manager or perhaps easier get a copy of usbdeview.exe and see what VID and PID it has enumerated as? avrdude has the numbers hard coded in its source yet we've seen previous posts where the device is actually enumerating with a different PID which suggests the producer must have their own variant of avrdude.exe or some other software they use to communicate with it (or they simply screwed up the firmware in the USBAsp!)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Maybe my question wasn't clear. What I am trying to do is build a metaboard on a breadboard. (I purchased a metaboard kit a while ago but it still isn't here) The metaboard uses a bootloader that, when enabled, shows up as a USBasp and allows you to upload sketches to it through vusb.

clawson wrote:

(or they simply screwed up the firmware in the USBAsp!)

When you say "they" you are saying me! LOL and I admit that is likely the case!

So the question is, Where did I screw up? The bootloader I downloaded comes as a .hex file called mega328p_16mhz.hex

http://www.obdev.at/products/vus...

It seemed to upload fine using the programmer I bought from China. When I plug it into my usb port it with PD7 grounded it and then press the reset button it is recognized as a USBasp, just like it should. So I think the bootloader/firmware uploaded correctly so I set my programmer aside and then tried to uses the bootloader to upload a sketch. This is where I had the problem.

clawson wrote:

Yes but with what VID and PID? Either use the properties in Device Manager or perhaps easier get a copy of usbdeview.exe and see what VID and PID it has enumerated as? avrdude has the numbers hard coded in its source yet we've seen previous posts where the device is actually enumerating with a different PID which suggests the producer must have their own variant of avrdude.exe or some other software they use to communicate with it

I downloaded usbdeview and found that the vid=16c0 pid= 05dc (see usbdeview.png)

V23 of Arduino says that it is looking for vid=0x16c0 pid=0x5dc which I think is the same. the only difference is usbdeview shows a zero in front of the 5dc. Are these equivalent?
0x05dc = 0x5dx = 0b1500

If they aren't, is this something I can change? It looks like the source code for the bootloader is there but I looked though it (not knowing what I was looking at) and couldn't find the PID or VID called out.

Thanks for the help! As always I'll keep looking for these answers myself but any tips are appreciated! usbdeview was a great one!

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Are these equivalent?

Yes, should work. 0000003 is the same as 3 after all ;-)

However there's no getting away from the fact that the error reported was:

avrdude: error: could not find USB device "USBasp" with vid=0x16c0 pid=0x5dc" 

So maybe avrdude did locate that vid/pid but it didn't respomd in the way avrdude was expecting it to? If you add -v to the avrdude command line it tells you more about what's going on. If you keep adding v's it keeps telling you more detail. I think the ultimate is -vvvv. Might be worth a try.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Unplug and re-plug the USB cable.

If your fuses are correct i.e. BOOTSZ & BOOTRST then your bootloader should register the 'usbasp' device.

If USBview or Device Manager can see it, so should avrdude.

I have not got the energy to try your bootloader app this evening. If you are still struggling tomorrow, shout, and I will give it a go on a mega168.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guys,

I took a break from this because it was driving me crazy. I emailed a guy tied to the Metaboard project and he told me to check out the MHVboard here

http://www.makehackvoid.com/grou...

Reading though the comments I found this

Quote:

First time, the following message appeared

avrdude: error: could not find USB device "USBasp" with vid=0x16c0 pid=0x5dc

This suggested the contents of the usbasp-windriver.2011-05-28 directory need to be moved

somewhere else so the IDE can find them.

My best guess was:

[5] copy C:\ProgramFiles\arduino-0022\usbasp-windriver.2011-05-28\libusb_0.1.12.1\USBasp.* (i.e. copying rather than moving USBasp setup information and USBasp security catalogue) to
C:\ProgramFiles\arduino-0022\drivers\USBasp.* where setup information for arduino UNO and MEGA 2560 is found.

His problem looked just like mine so I did what he said and it works now.

Thanks again for all the help.