by Oddgit » Sat Sep 24, 2011 2:17 pm
Hi guys,
I'm very new to AVR programming, and my first big project is a midi controller. So I hope it's okay to post my questions in this threat. I've downloaded the latest version of V-USB-MIDI and I'm using an ATmega8 with AVR Studio 5 and AVRISP mkII. At the moment, I've only connected one potentiometer, one LED and one button to the device. But, unfortunately, it doesn't work. Both, Windows 7 and XP can't identify the USB device.
I've connected the USB-jack in this way:

In my case, D- goes to PD0 and D+ to PD2 (INT0). I've also adjusted this by editing "usbconfig.h".
But connecting the 1k5 pull-up resistor confuses me. In the schematic above, it's a pull-up to +5V, isn't it? Because in the comments of "usbdrv.h" I've read the following:
Hardware Prerequisites:
=======================
If you use Zener diodes to limit the voltage on D+ and D-, you MUST use a pull-down resistor, not a pull-up.
So, what to do?!
Anyway, if I don't connect the 1k5 resistor to a port of the microcontroller, how must I handle the "Optional Hardware Config" in "usbconfig.h"? Is it okay, to simply delete "#define USB_CFG_PULLUP_IOPORTNAME D" and "#define USB_CFG_PULLUP_BIT 4"? Do I have to change something else in the source code, if I use this way to connect the USB jack? Btw, I'm using those zener diodes:
http://www.reichelt.de/index.html?;ACTION=7;LA=3;OPEN=0;INDEX=0;FILENAME=A400%252FZF%2523MOT.pdf;SID=13Tmr58n8AAAIAADj1Ejc9346e0fe3139afadbe3f92f875a7f569Next thing is linking the correct files to the project. I've copied all files of the folder "usbdrv-20090415" (except the ones, that don't fit to my 12 MHz clock rate) into my project folder. Then I've included all to my project by adding them to the folder tree in AVR Studio 5, except the files "asmcommon.inc" and "usbdrvasm12.inc". They're only in the project folder, because in the comments I've read:
Do not link this file! Link usbdrvasm.S instead, which includes the appropriate implementation!
I hope, that's correct.
So far, so good. But where do I tell the compiler, which clock rate I've choosen?! Because unlike in "usbconfig-prototype.h" the "#define USB_CFG_CLOCK_KHZ (F_CPU/1000)" is missing in "usbconfig.h" of the V-USB-MIDI sample.
I promise, I didn't change anything in the source code (except the pin assignment)! Has anyone an idea, what I else could do, to get the thing working? Or what I do have to change in the source code when using an ATmega8?
As I said, I'm very new to that stuff, so it would be great if someone could help me.
Best,
Philipp
Hi guys,
I'm very new to AVR programming, and my first big project is a midi controller. So I hope it's okay to post my questions in this threat. I've downloaded the latest version of V-USB-MIDI and I'm using an ATmega8 with AVR Studio 5 and AVRISP mkII. At the moment, I've only connected one potentiometer, one LED and one button to the device. But, unfortunately, it doesn't work. Both, Windows 7 and XP can't identify the USB device.
I've connected the USB-jack in this way:
[img]http://vusb.wikidot.com/local--files/hardware/level-conversion-with-zener.gif[/img]
In my case, D- goes to PD0 and D+ to PD2 (INT0). I've also adjusted this by editing "usbconfig.h".
But connecting the 1k5 pull-up resistor confuses me. In the schematic above, it's a pull-up to +5V, isn't it? Because in the comments of "usbdrv.h" I've read the following:
[quote]
Hardware Prerequisites:
=======================
If you use Zener diodes to limit the voltage on D+ and D-, you MUST use a pull-down resistor, not a pull-up.[/quote]
So, what to do?!
Anyway, if I don't connect the 1k5 resistor to a port of the microcontroller, how must I handle the "Optional Hardware Config" in "usbconfig.h"? Is it okay, to simply delete "#define USB_CFG_PULLUP_IOPORTNAME D" and "#define USB_CFG_PULLUP_BIT 4"? Do I have to change something else in the source code, if I use this way to connect the USB jack? Btw, I'm using those zener diodes:
[url]http://www.reichelt.de/index.html?;ACTION=7;LA=3;OPEN=0;INDEX=0;FILENAME=A400%252FZF%2523MOT.pdf;SID=13Tmr58n8AAAIAADj1Ejc9346e0fe3139afadbe3f92f875a7f569[/url]
Next thing is linking the correct files to the project. I've copied all files of the folder "usbdrv-20090415" (except the ones, that don't fit to my 12 MHz clock rate) into my project folder. Then I've included all to my project by adding them to the folder tree in AVR Studio 5, except the files "asmcommon.inc" and "usbdrvasm12.inc". They're only in the project folder, because in the comments I've read: [quote]Do not link this file! Link usbdrvasm.S instead, which includes the appropriate implementation![/quote] I hope, that's correct.
So far, so good. But where do I tell the compiler, which clock rate I've choosen?! Because unlike in "usbconfig-prototype.h" the "#define USB_CFG_CLOCK_KHZ (F_CPU/1000)" is missing in "usbconfig.h" of the V-USB-MIDI sample.
I promise, I didn't change anything in the source code (except the pin assignment)! Has anyone an idea, what I else could do, to get the thing working? Or what I do have to change in the source code when using an ATmega8?
As I said, I'm very new to that stuff, so it would be great if someone could help me.
Best,
Philipp