USB with atmega 32
USB with atmega 32
Hi,
First of al sorry for the bad English, I'm Dutch.
I'm trying to make a controller that works with USB and a atmega 32
But I'm not an expert in C++ and other langues.
I tried this software/hardware
http://www.obdev.at/products/avrusb/index.html
http://www.obdev.at/products/avrusb/bootloadhid.html
But I can't make it work.
So I'm asking for help with my project.
Crystal = 12 Mhz
What really helps me is that somebody tells me what as have te ajust and with witch programs because I find the readme file to basic and don't what that they mean.
First of al sorry for the bad English, I'm Dutch.
I'm trying to make a controller that works with USB and a atmega 32
But I'm not an expert in C++ and other langues.
I tried this software/hardware
http://www.obdev.at/products/avrusb/index.html
http://www.obdev.at/products/avrusb/bootloadhid.html
But I can't make it work.
So I'm asking for help with my project.
Crystal = 12 Mhz
What really helps me is that somebody tells me what as have te ajust and with witch programs because I find the readme file to basic and don't what that they mean.
Last edited by Phoenix on Thu Jan 03, 2008 2:39 pm, edited 1 time in total.
Your link referred to AVR-USB's index page, not a particular project. As far as I know, there is no project on our site (or linked form our site) which uses the ATMega32. If you use the Mega32, you need to update some configurations and probably fuse values.
For a beginner, I would recommend that you use the same chip as your reference project, make this reference project work and then modify it according to your needs.
For a beginner, I would recommend that you use the same chip as your reference project, make this reference project work and then modify it according to your needs.
I don't really have choise I have to make it work with the Mega32.
But I ajust it everyting. But when I compile it I get errors in WinAVR
This error I get when I compile the commandoline software
And when I compile the firmware I get.
But I ajust it everyting. But when I compile it I get errors in WinAVR
This error I get when I compile the commandoline software
Code: Select all
gcc -O2 -Wall -c main.c -o main.o
process_begin: CreateProcess(NULL, gcc -O2 -Wall -c main.c -o main.o, ...) failed.
make (e=2): Het systeem kan het opgegeven bestand niet vinden.
make.exe: *** [main.o] Error 2
And when I compile the firmware I get.
Code: Select all
usbdrv/usbdrv.h:185: warning: 'usbFunctionDescriptor' used but never defined
usbdrv/usbdrv.c:213: warning: 'usbSetInterrupt' defined but not used
The first error message mentioned, when you compile the command line tool, is a misconfiguration of your gcc. The message says that it fails to execute gcc.
Regarding the firmware: You include usbdrv.c in your main code and define USB_PUBLIC to static, right? I'm not sure about the first message since usbFunctionDiscriptor() is not used in usbdrv.h. It might tell you that you have configured the driver to call your own function usbFunctionDescriptor() in order to read particular USB descriptors and you have not implemented this function.
The second message is harmless. It tells you that you don't send data through the interrupt endpoint.
Since both these messages are warnings only, you should still get an executable to flash into the chip. If not, there must be an error during linking. That error message would be interesting, too.
Regarding the firmware: You include usbdrv.c in your main code and define USB_PUBLIC to static, right? I'm not sure about the first message since usbFunctionDiscriptor() is not used in usbdrv.h. It might tell you that you have configured the driver to call your own function usbFunctionDescriptor() in order to read particular USB descriptors and you have not implemented this function.
The second message is harmless. It tells you that you don't send data through the interrupt endpoint.
Since both these messages are warnings only, you should still get an executable to flash into the chip. If not, there must be an error during linking. That error message would be interesting, too.
I re-installed MinGW but it didn't do a thing.
So I put gcc.exe and g++ in the Bin directory of WinAVR.
And then I got thes errors
So I put gcc.exe and g++ in the Bin directory of WinAVR.
And then I got thes errors
Code: Select all
gcc -O2 -Wall -c main.c -o main.o
gcc -O2 -Wall -c usbcalls.c -o usbcalls.o
gcc -O2 -Wall -o bootloadHID.exe main.o usbcalls.o -lhid -lusb -lsetupapi
\mingw\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lusb
collect2: ld returned 1 exit status
make.exe: *** [bootloadHID.exe] Error 1
This is when I write it to the chip
So I can't write the .HEX file to the MCU
Code: Select all
$ make flash
avrdude -c stk200 -p atmega32 -U flash:w:main.hex:i
avrdude.exe: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude.exe: Device signature = 0x1e9502
avrdude.exe: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude.exe: erasing chip
avrdude.exe: reading input file "main.hex"
avrdude.exe: writing flash (17404 bytes):
Writing | ################################################## | 100% 6.34s
avrdude.exe: 17404 bytes of flash written
avrdude.exe: verifying flash memory against main.hex:
avrdude.exe: load data flash data from input file main.hex:
avrdude.exe: input file main.hex contains 17404 bytes
avrdude.exe: reading on-chip flash data:
Reading | ################################################## | 100% 5.48s
avrdude.exe: verifying ...
avrdude.exe: verification error, first mismatch at byte 0x3c00
0x0c != 0xff
avrdude.exe: verification error; content mismatch
avrdude.exe done. Thank you.
make: *** [flash] Error 1
So I can't write the .HEX file to the MCU
OK. One thing after the other. Please make sure that the device is recognized by Windows. I don't know how you can distinguish a broken device from a device without drivers on Windows, but there should be a way to do that.
Regarding the host application: Please make sure you can compile a simple "Hello World!" example. If that does not work, something is wrong with your compiler installation and you should fix that first.
Regarding the host application: Please make sure you can compile a simple "Hello World!" example. If that does not work, something is wrong with your compiler installation and you should fix that first.
I would recommend that you start analytically: Use one of the reference projects on an ATMega8 and get it running. Then move this same project over to the ATMega32, updating the usbconfig.h and other pin assignments as well as fuse values accordingly. Then bring in your firmware code, taking care that you don't break anything.
That's the procedure I would recommend for the firmware. Once you have a working example, change only one thing at a time.
When you have the firmware running, we can talk about the host software.
That's the procedure I would recommend for the firmware. Once you have a working example, change only one thing at a time.
When you have the firmware running, we can talk about the host software.
Oke I will do that but I think I already have firmware running on my atmega32.
But the host software doesn't work because when I compile he doesn't find -lusb and I don't know what it is or where I can find it.
But the host software doesn't work because when I compile he doesn't find -lusb and I don't know what it is or where I can find it.
Last edited by Phoenix on Sat Jan 05, 2008 3:47 pm, edited 1 time in total.