Quest
Quest

Reputation: 129

How to program ATmega32 using the USB to serial programmer

I use winxp inside a virtualbox with host as ubuntu. The usb programmer connected to host is routed to the guest. I use WinAVR which uses avrdude; the relevant fields in makefile are given as Atmega32 for processor, port as usb and programmer as stk200. Still it says cannot find device "usb". Please help.

Upvotes: 0

Views: 2578

Answers (1)

Chris Stratton
Chris Stratton

Reputation: 40407

Your error results from the mistaken -P usb in your command:

avrdude -p atmega32 -P usb -c stk500v2 -U flash:w:main.hex

Do not specity "usb" as a port when using a USB-serial connected programmer or bootloader, because downstream of the operating system driver, these are not treated as USB devices but rather as serial ports.

When you use such a device, determine the com port or device node it is connected to (perhaps by seeing which one appears/disappears when you connect and disconnect it), find out the baud rate required by your programmer, and issue a command such as

COM1 or whatever on Windows

avrdude -p atmega32 -P COM1 -b115200 -c stk500v2 -U flash:w:main.hex

Linux or OSX

avrdude -p atmega32 -P /dev/whatever -b115200 -c stk500v2 -U flash:w:main.hex

The device file on Linux would be something like /dev/ttyUSB0 or /dev/ttyACM0, while on OSX it tends to be /dev/tty.usbmodem or similar.


The alternate solution you propose in comments, of using -P avrdoper leverages the fact that your specific programmer offers an alternate interface which is not a USB-serial device in the eyes of the host operating system, but instead a custom USB protocol which at least some versions of avrdude know how to talk.

Upvotes: 1

Related Questions