HIDKeys with mega168
-
- Posts: 7
- Joined: Fri Jul 10, 2009 2:08 am
HIDKeys with mega168
Has anyone successfully used HIDKeys example with a mega168?
I copied the exact schematic, except of course with the mega168 instead of the mega8.
To fix compile errors, I changed TCCR0 to TCCR0B, and two instances of TIFR to TIFR0. That is all I changed, and now everything compiles perfectly.
However, the computer says the device can not be recognized.
Any ideas? Thanks.
Additionally, has anyone gotten V-USB software to work with AVR Studio 4? It is very picky, and therefore not able to use the included makefile, which may have something to do with my problems
I copied the exact schematic, except of course with the mega168 instead of the mega8.
To fix compile errors, I changed TCCR0 to TCCR0B, and two instances of TIFR to TIFR0. That is all I changed, and now everything compiles perfectly.
However, the computer says the device can not be recognized.
Any ideas? Thanks.
Additionally, has anyone gotten V-USB software to work with AVR Studio 4? It is very picky, and therefore not able to use the included makefile, which may have something to do with my problems
Re: HIDKeys with mega168
Yup, done many projects with 168's The biggest mistake is using the whole watt diodes.. You need to use the 1/2 watt with 168's
Re: HIDKeys with mega168
RazorConcepts wrote:Additionally, has anyone gotten V-USB software to work with AVR Studio 4? It is very picky, and therefore not able to use the included makefile, which may have something to do with my problems
Used AVRS4 many times w/ V-USB. Just set up the project from scratch and ignore the makefile.
-
- Posts: 7
- Joined: Fri Jul 10, 2009 2:08 am
Re: HIDKeys with mega168
I am using half-watt diodes (the standard kind), but why would 1 watt diodes not work?
Also, if anyone has a working AVR Studio Project for the mega168 of any kind, I would greatly appreciate if you zip it up and post it. Thanks!
Also, if anyone has a working AVR Studio Project for the mega168 of any kind, I would greatly appreciate if you zip it up and post it. Thanks!
Re: HIDKeys with mega168
IIRC the electrical specs for the I/O pins are different between the 8 and 88. If you use Z-diodes on D+/D-, they HAVE to be 3V6/<= 500mW.
If I take one of my atmega projects and put 1 watt's on there, it will not enumerate. However on the atmega8 it works just fine. The atmega 8 projects should run just fine. Ever single one does for me. In some case I needed to rename the registers to match the atmega168, but if that were the case it woudl not compile. So it its compiling your code is good unless you changed something.
If you still have troubles, Check out
Replacing ATmega8 by ATmega88 http://www.atmel.com/dyn/resources/prod ... oc2553.pdf
Migrating between ATmega48, ATmega88 and ATmega168 http://www.atmel.com/dyn/resources/prod ... oc2554.pdf
Migrating from ATmega48/88 and ATmega48P/88P to ATmega48PA/88PA http://www.atmel.com/dyn/resources/prod ... oc8196.pdf
I also had an old usbdrvasm.o cause issues for the 168's I had to re download the latest, but I'm guessing you have the latest code an examples?
one other thing I remember is pd2 has an int on it, so if you use that pin make sure its disabled. I dont think any of the examples have the int enabled though.
If I take one of my atmega projects and put 1 watt's on there, it will not enumerate. However on the atmega8 it works just fine. The atmega 8 projects should run just fine. Ever single one does for me. In some case I needed to rename the registers to match the atmega168, but if that were the case it woudl not compile. So it its compiling your code is good unless you changed something.
If you still have troubles, Check out
Replacing ATmega8 by ATmega88 http://www.atmel.com/dyn/resources/prod ... oc2553.pdf
Migrating between ATmega48, ATmega88 and ATmega168 http://www.atmel.com/dyn/resources/prod ... oc2554.pdf
Migrating from ATmega48/88 and ATmega48P/88P to ATmega48PA/88PA http://www.atmel.com/dyn/resources/prod ... oc8196.pdf
I also had an old usbdrvasm.o cause issues for the 168's I had to re download the latest, but I'm guessing you have the latest code an examples?
one other thing I remember is pd2 has an int on it, so if you use that pin make sure its disabled. I dont think any of the examples have the int enabled though.
-
- Posts: 7
- Joined: Fri Jul 10, 2009 2:08 am
Re: HIDKeys with mega168
Alright, so I decided to start fresh with HID-mouse. I copied the contents of the library into the same folder as the main.c (to ease AVR studio in finding these files). I got everything to compile except for the F_CPU part. I added the following at the top of main.c:
But I get a ../usbdrvasm.S:383:9: error: #error "USB_CFG_CLOCK_KHZ is not one of the supported non-crc-rates!" error.
Tracing this back, usbconfig.h converts F_CPU to USB_CFG_CLOCK_KHZ by dividing F_CPU by 1000. So, with a 16000000khz F_CPU, I should get a 16000KHZ USB_CFG_CLOCK, which is in range of the acceptible values - but for some reason, it thinks it is wrong. Any ideas?
Code: Select all
#define F_CPU 16000000UL
But I get a ../usbdrvasm.S:383:9: error: #error "USB_CFG_CLOCK_KHZ is not one of the supported non-crc-rates!" error.
Tracing this back, usbconfig.h converts F_CPU to USB_CFG_CLOCK_KHZ by dividing F_CPU by 1000. So, with a 16000000khz F_CPU, I should get a 16000KHZ USB_CFG_CLOCK, which is in range of the acceptible values - but for some reason, it thinks it is wrong. Any ideas?
Re: HIDKeys with mega168
Remove the F_CPU definition from main.c, the definition needs to be global. One way of adding it: in AVRS, load your project then open the menu "Project", select "Configuration Options". In that dialog under "General" fill out the "Frequency:" field w/ 16000000 . Click Ok and recompile.
-
- Posts: 7
- Joined: Fri Jul 10, 2009 2:08 am
Re: HIDKeys with mega168
Thank you, it works properly. I have attached a zip file of the complete AVR studio 4 project if people would like it as a starting point.
ATmega168 (not P or PA version) at 16mhz using the 2 4148 diodes in series circuit.
http://www.4shared.com/file/230550081/5 ... se168.html
ATmega168 (not P or PA version) at 16mhz using the 2 4148 diodes in series circuit.
http://www.4shared.com/file/230550081/5 ... se168.html
-
- Posts: 7
- Joined: Fri Jul 10, 2009 2:08 am
Re: HIDKeys with mega168
Finally got a PCB made
This is the zener version with blue LEDs instead of zeners.
This is the zener version with blue LEDs instead of zeners.
Re: HIDKeys with mega168
could you post a schematic please?
I have also been trying to get a ATMega 168 working with V USB
Thanks,
Ilia
I have also been trying to get a ATMega 168 working with V USB
Thanks,
Ilia