Usb not Recognized: Malfunctioning
Posted: Mon Sep 21, 2009 9:16 pm
Hello all!
I'm trying to get vusb to work. I've dowloaded the following code onto an atmega8 . I've also set the frequency to 16mhz. However, when i plug the usb into the port, it gives me an error 'usb not recognized. Some device has malfunctioned...' I was under the impression that if it was working a message would pop up saying 'found new hardware. ' Not happening, though, its being recognized as an unknown device. I'm on windows vista.
My hardware setup is the one involving 3.6 zener diodes to the ground from the D+ and D-lines. However, i have 360 ohm resistors instead of 68 ohm resistors. This shouldn't make a difference though.
I've measured some voltages:
2.522 V on the D- line
0 V on D+ lines
5.01 V supplied
4.68V supplied to microcontroller.
1.478 K resistor from D- to VCC.
I cannot figure out what would be causing this. Any ideas? Thanks! D4 is the D- line and D2 is the D+ line. Everything else in usbconfig.h is default. I'm using
the winAVR eclipse plugin, so it generates Makefile automatically.
//One of the usb devices attached to this computer has malfunctioned and windows does not
//recognize it.
I'm trying to get vusb to work. I've dowloaded the following code onto an atmega8 . I've also set the frequency to 16mhz. However, when i plug the usb into the port, it gives me an error 'usb not recognized. Some device has malfunctioned...' I was under the impression that if it was working a message would pop up saying 'found new hardware. ' Not happening, though, its being recognized as an unknown device. I'm on windows vista.
My hardware setup is the one involving 3.6 zener diodes to the ground from the D+ and D-lines. However, i have 360 ohm resistors instead of 68 ohm resistors. This shouldn't make a difference though.
I've measured some voltages:
2.522 V on the D- line
0 V on D+ lines
5.01 V supplied
4.68V supplied to microcontroller.
1.478 K resistor from D- to VCC.
I cannot figure out what would be causing this. Any ideas? Thanks! D4 is the D- line and D2 is the D+ line. Everything else in usbconfig.h is default. I'm using
the winAVR eclipse plugin, so it generates Makefile automatically.
//One of the usb devices attached to this computer has malfunctioned and windows does not
//recognize it.
Code: Select all
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <avr/wdt.h>
#define F_CPU 16000000
#include "usbdrv.h"
#include "oddebug.h"
#include <util/delay.h>
usbMsgLen_t usbFunctionSetup(uchar setupData[8])
{
return 0;
}
void setupUSB () {
uchar i;
wdt_enable(WDTO_1S);
odDebugInit();
DDRD=~USBMASK;
PORTD = 0; //no pullups on usb pins
/* We fake an USB disconnect by pulling D+ and D- to 0 during reset. This is
* necessary if we had a watchdog reset or brownout reset to notify the host
* that it should re-enumerate the device. Otherwise the host's and device's
* concept of the device-ID would be out of sync.
*/
usbDeviceDisconnect(); /* enforce re-enumeration, do this while interrupts are disabled! */
i = 0;
while(--i){ /* fake USB disconnect for > 500 ms */
wdt_reset();
_delay_ms(2);
}
usbDeviceConnect();
usbInit();
sei();
}
int main(void)
{
setupUSB();
for(;;) { /* main event loop */
wdt_reset();
usbPoll();
}
return 0;
}