WinAVR: avrdude with USB support?

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

[Moderator note: I've split this off of the old AVRDUDE 5.0 thread
the OP has been following up to, as this is really a new issue.]

hello,
question regarding AVRDUDE, Version 5.1 (winavr version):

is there still no usb support included?

is there any chance to get an avrisp mkii running over usb with avrdude?

many thanks in advance
gerhard

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

> is there still no usb support included?

It appears to me Eric simply ran out of time to also include
libusb-win32 support into WinAVR-20060125.

Basically, I've been testing AVRDUDE pre-5.1 once against
libusb-win32, and while installing the latter took me a while until I
grasped what needed to be done (as I'm really stupid when it comes to
MS Windows, and as it eventually turned out libusb-win32 simply
doesn't work across a RDP session but only works on the console), I
eventually got it to work after fixing a few things in AVRDUDE. It
turned out libusb-win32 is somewhat more picky in many respects than
the original Unix version (and sometimes even incompatible to the
original API, e. g. by requiring the caller to distinguish the IN and
OUT endpoints by the 0x80 flag already from outside), that's the basic
reason why AVRDUDE 5.0 didn't work with libusb-win32 even though it
worked with the Unix version of libusb.

I never tested AVaRICE against libusb-win32, but I merged the fixes
needed for AVRDUDE there as well, so I assume all will work there
similarly.

> is there any chance to get an avrisp mkii running over usb with
> avrdude?

AVRDUDE 5.1 supports it, though my personal impression is the libusb
code needs some tweaks for that device still, as it is rather slow,
compared to both an STK500 (running across its 115200 Bd RS-232) or
the JTAG ICE mkII (running across the same libusb-based USB backend).
It's probably some timeout value that needs to be changed in the code
(just a wild guess, I have to analyze that).

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

dl8dtl wrote:
> > is there any chance to get an avrisp mkii running over usb with
> avrdude?

AVRDUDE 5.1 supports it, though my personal impression is the libusb
code needs some tweaks for that device still, as it is rather slow,
compared to both an STK500 (running across its 115200 Bd RS-232) or
the JTAG ICE mkII (running across the same libusb-based USB backend).
It's probably some timeout value that needs to be changed in the code
(just a wild guess, I have to analyze that).

i always get the following error message when i try to use the avrdude in conjunction with usb:

avrdude: ser_open(): can't open device "usb":

Is there something i have to install additionally?

btw: there seems to be a mistake in the doc file.
this file mentions a programmer-id "avrispmk2" but this id is notsupported by avrdude.

regards
gerhard

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

> avrdude: ser_open(): can't open device "usb":

> Is there something i have to install additionally?

It means your AVRDUDE has not been configured with libusb support.

> btw: there seems to be a mistake in the doc file. this file
> mentions a programmer-id "avrispmk2" but this id is notsupported by
> avrdude.

Yes, it should be "avrisp2". Please write a bug report for this.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

dl8dtl wrote:
> avrdude: ser_open(): can't open device "usb":

> Is there something i have to install additionally?

It means your AVRDUDE has not been configured with libusb support.


I used avrdude which is included in winavr from 20060125.
where can i get a win32 precompiled version with usb support?

dl8dtl wrote:

> btw: there seems to be a mistake in the doc file. this file
> mentions a programmer-id "avrispmk2" but this id is notsupported by
> avrdude.

Yes, it should be "avrisp2". Please write a bug report for this.


Done

regards
gerhard

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

> where can i get a win32 precompiled version with usb support?

Sorry, I don't know.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

dl8dtl wrote:
> where can i get a win32 precompiled version with usb support?

Sorry, I don't know.


i would like to ask if there is any chance in the near future (some weeks or so) that avrdude will support usb on windows

regards
gerhard

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

> i would like to ask if there is any chance in the near future (some
> weeks or so) that avrdude will support usb on windows

It does already today, but to the best of my knowledge, you need to
compile it yourself for that purpose. At least, I don't know of
anyone who made a Win32 binary version publically available.

AFAIK Eric *intends* to have USB support for AVRDUDE and AVaRICE
available in the next WinAVR, and he *intends* to ship out that
version rather quickly (mainly due to a known compiler bug with struct
pointers present in AVR-GCC >= 3.4.4), but as usual, the exact
timeframe when this will happen will only be known once it's really
been shipped out of the door.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Right, and dealing with all the other priorities as well.
It is also intended to have a new release of avr-libc, to fix some obvious bugs in header files. But that also has to be coordinated as well.

Eric

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

bump.. as far as I can see the latest version of WinAVR (20060421) still does not support USB (used USB as the port and it doesn't allow it). However it does allow "avrispmkii" as a programmer type.

Has there been any progress with this issue?

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

hello,
sorry for being impatient but is there any time schedule for an avrdude version for windoz which supports usb?
if not is it possible to get some infoprmation how to build avrdude for windoz. i downloaded the sources but didn't find any infomation how to build it.

many thanks in advance
gerhard

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

> if not is it possible to get some infoprmation how to build avrdude
> for windoz.

You should be able to find it on Kai Klenovsek's website (search for
it).

In short, you need to install MinGW and Msys. Within the Msys shell
(which is basically a bash, a Unix command-line shell), you can then
run configure and make as described in the Unix instructions.

In order to configure avrdude for libusb support, you need the
following:

  • Install libusb-win32 from the respective SourceForge.net project page. Get the "filter" driver, which comes as its own setup.exe
    installer. Once installed, there is a test utility, run it. You
    should be able to see your JTAG ICE. If you don't, AVRDUDE won't
    see it either.
  • Set the environment variables CFLAGS, CPPFLAGS, and LDFLAGS *before* running configure. They need to tell configure and make
    about the location of your installed libusb-win32. Suppose the
    base directory of your libusb-win32 installation were C:/libusb,
    type the following (inside that Msys shell):

    export CPPFLAGS="-IC:/libusb/include"
    export CFLAGS="-g -O -IC:/libusb/include"
    export LDFLAGS="-LC:/libusb/lib"
    

    When running configure, you should see the following messages
    (somewhat hidden behind a number of messages):

    checking usb.h usability... yes
    checking usb.h presence... yes
    checking for usb.h... yes
    

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

hello jörg,
many thanks for your answer. i found kai's homepage and his explanation.

but to be honest for me it seems to be easier to install a whole new windoz pc than to build avrdude with usb support.

has anyone of you already done this job?
and if yes could you please be so kind and post the binaries here or elsewhere?

regards
gerhard

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

> but to be honest for me it seems to be easier to install a whole new
> windoz pc than to build avrdude with usb support.

To me not. ;-) I'd probably be quicker to setup a whole new FreeBSD
PC within that time, but not a Windows one... Seriously, the steps
for compiling avrdude can probably be done within 15 minutes. Most
of the tools needed are already there with WinAVR.

> has anyone of you already done this job?

I did, long since, when I verified the libusb support also works with
libusb-win32.

> and if yes could you please be so kind and post the binaries here or
> elsewhere?

Sorry, I lost them, and I currently don't have a Windows machine at
access to recompile them. Also, it's been an old avrdude version,
long before 5.1.

Also, why would you think it's less work for me (or anyone else) than
it is for you?

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Quote:
but to be honest for me it seems to be easier to install a whole new windoz pc than to build avrdude with usb support

No, it isn't! The setup of the environment variables may look a bit confusing, I tried another way and it worked for me. The idea behind that was that if a program wants to make use of library, it needs (at least) two things:
1.) Include-file with function headers (*.h-file)
2.) Precompiled library in archive suitable for linker (*.a-file in the case of GCC)
I just picked these two files out of the libusb-win32 folder and put them in a place where the MinGW/GCC installation expected them - and voilà: the configure-script of avrdude detected the libusb...
Unfortunately, I do not exactly remember the file or folder names, because that was already some weeks ago.
But instead I'll attach my compiled exe-file. You need to download and install libusb-win32 separately, cause another dll-file and the usb kernel driver are expected.

Regards,

Christian

Attachment(s): 

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

chris73_avr wrote:
Quote:
but to be honest for me it seems to be easier to install a whole new windoz pc than to build avrdude with usb support

But instead I'll attach my compiled exe-file. You need to download and install libusb-win32 separately, cause another dll-file and the usb kernel driver are expected.

Regards,

Christian

hello christian,
many thanks for your efforts.
unfortunately the zip file is corrupted.
any idea why?

regards
gerhard

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

It works for me. Only complains about missing libusb dll file(as expected)

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

dl8dtl wrote:
>
Also, why would you think it's less work for me (or anyone else) than
it is for you?

maybe because i am only a little stupid firmware designer and not a linux/freebsd/gcc guru like you?

regards
gerhard

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

> maybe because i am only a little stupid firmware
> designer and not a linux/freebsd/gcc guru like you?

I'm currently also a stupid little firmware designer...

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

hello again,
download didn't work with opera but with ie (no idea why).

libusb.dll was not the problem.

but avrdude dind't find the avrisp mkii.
here is my command line:

    c:\programme\avrdude\avrdude -p m128 -c avrispv2 -P usb:xx -v

and here the output of avrdude:

    avrdude: Version 5.1
    Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

    System wide configuration file is "c:\programme\avrdude\avrdude.conf"

    Using Port : usb:xx
    Using Programmer : avrispv2
    found 2 busses
    avrdude: usbdev_open(): did not find any (matching) USB device "usb:xx"

avrisp mkii is working fine with avrstudio and has latest firmware (v.105).

any ideas?

regards
gerhard

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

hello,
i found a way to get the avrisp mkii working.
i created a .inf file with and reinstalled the driver for the avrisp mkii.
afterwards the avrisp was shown in the device manager as a libusb device and was working fine with avrdude.
but now avrstudio didn't find avrisp mkii any longer.

any ideas?

regards
gerhard

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

I guess it is possible to use both avrstudio and avrdude with the same usb driver. De-install lib-usb, then re-install the original atmel driver for the avrisp mkii and at last use the *filter* variant of libusb, as this driver can access usb devices *through* their own drivers.
By the way, your commandline is not quite ok, better try only
avrdude .... -P usb instead of
avrdude .... -P usb:xx

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

chris73_avr wrote:
I guess it is possible to use both avrstudio and avrdude with the same usb driver. De-install lib-usb, then re-install the original atmel driver for the avrisp mkii and at last use the *filter* variant of libusb, as this driver can access usb devices *through* their own drivers.

i changed the installation as you recommended.
checking the device list with the command line
    c:\programme\avrdude\avrdude -p m128 -c avrispv2 -P usb:xx
is working fine now.
but when i try to open the terminal mode i get the following output:
    c:\programme\avrdude\avrdude -p m128 -c avrispv2
    -P usb -t
    avrdude: stk500v2_recv_mk2: error in USB receive
    avrdude: stk500v2_recv_mk2: error in USB receive
    avrdude: stk500v2_recv_mk2: error in USB receive
    avrdude: usbdev_send(): wrote -5 out of 1 bytes, err = usb_submit_async: submitt
    ing request failed, win error: Das Gerõt erkennt den Befehl nicht.

    avrdude: stk500_send_mk2(): failed to send command to serial port

any ideas?

chris73_avr wrote:
By the way, your commandline is not quite ok, better try only
avrdude .... -P usb instead of
avrdude .... -P usb:xx

using an invalid serial number (like "xx") brings up a list of all devices (see avrdude manual, page 13). this was done for test purposes only.

regards
gerhard

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

I'm afraid you need to pass this question to the libusb-win32
developers. Obviously, simple configuration space data
transfers are working but bulk transfers aren't.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

I am having trouble with the download file. Winzip claims that the file is corrupted. Could someone re-post it please?

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

Maybe that's a problem which is related to the forum software in combination with certain windows browsers?
I've got that impression because a user said he got the file correctly with IE, but didn't suceed with Opera...
Here it is again in traditional tar.gz format (Hope that helps!)

Regards,

Christian

Attachment(s): 

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

Hi,

This thread seems to have gone quiet. I'm still having similar usb problems with AVRdude 5.1 and winavr release 20060421. If this problem has been solved, please let me know how.

Thanks,

Tom

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

very very noob questions here coz I;m totally lost in Unix.
Can avrdude run on windows?
if yes then how??
by command line??
how to install library, compile, apply patch in windows(XP)....

Coz I'm trying to get thos works
http://www.fischl.de/usbasp
If possible can download the tar file and take a look at the readme file. I just wan it works on WIndows, and i would like to know the steps as i dun really understand after reading it.

Thankx

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

Yes, it can run on Windows, no, the default version doesn't
support USBasp (as I've already explained you), so you have
to compile your own version under Windows.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

i would like to compile my own version, but how???using wat software?it has patch in that file. ANyway???thanx

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

The webpage you're quoting includes a prebuilt version of avrdude for Windows.

1) Download the USBasp software archive from the webpage. (I just chose the most recent version of the file.)

2) Unarchive it. (You'll need software that's able to extract gzip and tar archives. Both these tools come with WinAVR. There are Windows GUI alternatives as well.)

3) Look in the /bin/win-avrdude/ folder for the necessary files avrdude.conf and avrdude.exe.

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

You need a compiler, like MinGW (plus MSys as a shell).

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

...
4) Look in the /bin/win-driver folder for the necessary libusb drivers.

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

Hi morrison, thanks for ur quick reply. I did that b4, and i did found the avrdude.exe and avrdude.conf. But how can i load hex file and download it into the microC?
Wat i do is i dl AVrdude 5.0 from the net. Copy the avrdude.exe and avrdude.conf from fischl.de to the AVRdude5.0 folder, run giveio batch. Then copy avrdude gui to the folder, run avrgui. But which programmer should i choose?? or is it not compatible with avr-gui? If i cant use avr-gui, how can i program the atmel microC?? thanx......

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

Quote:
...Wat i do is i dl AVrdude 5.0 from the net. Copy the avrdude.exe and avrdude.conf from fischl.de to the AVRdude5.0 folder...

I don't think you need anything from the avrdude 5.0 distribution. All you need should be the conf file and the exe file that you download from the USBasp website.

Quote:
Then copy avrdude gui to the folder, run avrgui. But which programmer should i choose??

avrdudegui probably hasn't been updated to work with that programmer. It would need to be recompiled to make it work with that programmer. You probably don't want to go through the trouble of downloading and installing wxwidgets, mingw, etc.

Quote:
If i cant use avr-gui, how can i program the atmel microC??

Your easiest solution is probably to learn how to use avrdude's command line interface.

(BTW: I've never actually used the USBasp programmer before... But I thought that giveio was only needed to gain control over physical ports... Is it needed when you're working with USB bitbangers too?)

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


Your easiest solution is probably to learn how to use avrdude's command line interface.

I'm willing to learn using command line. But when i double click on the avrdude.exe, the command prompt just pop up and closed. How should i start?? DOes it need any other software in WinXP?


(BTW: I've never actually used the USBasp programmer before... But I thought that giveio was only needed to gain control over physical ports... Is it needed when you're working with USB bitbangers too?)

dunno whether its needed or not, just asking......

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

Quote:

But when i double click on the avrdude.exe, the command prompt just pop up and closed.

That's normal behaviour for command-line software in Windows. You would typically invoke it from a DOS prompt. (In Windows XP, you open a command prompt by clicking "Start->Run...", type in "cmd", then click OK. You'll end up with a window containing a traditional DOS command line. Did you ever use MS DOS?)

Try reading the avrdude manual for details on its command line options. (If you have WinAVR installed, then the manual is installed on your hard drive in the c:\WinAVR\doc folder.)

What toolchain (compiler/assembler) are you using to build your software? It may be possible to incorporate avrdude into a "point-and-click" environment by some other means.

For example, in WinAVR, a section of the makefile is already dedicated to programming through avrdude, and a "make program" shortcut can be added to the Programmer's Notepad "Tools" menu. A simple modification of the makefile would cause avrdude to run with the USBasb programmer.

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

i did use dos prompt before....k thankx, will try it out

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

http://www.obdev.at/products/avr...
how aboutthis??it claims tat it can incoporate with STK500. does it means that i can program an AVR microC using this programmer thru AVRStudio which no need command line??
but wat i understand is AVRstudio is a compiler or assembler. Is it also a programmer software?? correct me if i'm wrong, thanx....

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

AVR Studio is an integrated development environment. It includes an assembler, a simulator/emulator for debugging your code, as well as acting as an interface for in-circuit emulation/debugging. In addition, it can act as an IDE front-end for the avr-gcc compiler included with WinAVR.

It also includes a general-purpose programming GUI interface. The preferred hardware for programming are the STK500, the AVRISP (original or mkII), the JTAGICE (original or mkII), and various tools with a compatible communication protocol.

That device claims to be able to communicate via USB, has a driver that makes it look like a serial device to Windows, and communicates using the STK500 communication protocol. If all that is true, then yes, you should be able to use it directly inside AVR Studio, or with any of the huge collection of 3rd party software that is designed to work with the STK500 protocol. (Including avrdude, by the way!)

But if you must have a USB-based programmer, and you're willing to invest a little money, you'll probably find it much simpler to purchase in a programmer that's already assembled and programmed.

It avoids the chicken-and-egg problem of how to get the firmware on the programmer in the first place. You'll face that problem with most USB-based programmers. I've only seen one exception to this rule, and it requires that you must be comfortable with Linux to do the initial programming that overcomes the chicken-and-egg problem. It's the AvrUsb500 from tuxgraphics.org. After that initial firmware load, the AvrUsb500 is also 100% compatible with the GUI AVR programming interface of AVR Studio.

In terms of pre-assembled USB-based programmers, the AVRISP mkII is currently the gold standard. It guarantees support for the latest devices through regular firmware updates bundled with AVR Studio. It can also potentially program AVRs at much higher speeds than the original STK500/AVRSIP (and most clones) are capable of. It sells on DigiKey for US$34. But availability can be a problem.

www.ere.co.th sells an original AVRISP-clone programmer that's been modified to communicate via USB. It sells for US$34 as well. I've used it successfully.

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

wow, nice explainations....Actually i dun mind the chicken and egg problem as i can also build a parallel programmer from www.lancos.com to load the firmware. I just wan to build one usb programmer when i switch from desktop to laptop, haha.....
Since I'm at the starting edge of learning AVR, i prefer to build one. After sometime, then only I'll purchase one.
Thanx for ur help morrison, nice one!!!!

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

Or for $50 you could get an AVR Dragon which does pretty much what the $34 AVRISPmkII does but also includes a JTAG/DebugWire interface (which you are effectively getting for $16 then). The only problem right now is that availability is limited and the range of devices supported is not huge but Atmel habve promised that future upgraded of AVR Studio will add support for all their "current" devices (though debugging is limited up to 32K flash chips)

Cliff