i try to get AVR USB Work with an Atmega32 and uses the Software from PowerSwitch
Example with modified usbconfig.h
My Circuit is:
When i connect to Windows Vista nothing happens. When i connect it to my Linux PC i mostly get:
[14632.335397] usb 1-7: new low speed USB device using ohci_hcd and address 6
[14632.519367] usb 1-7: device descriptor read/64, error -62
[14632.807387] usb 1-7: device descriptor read/64, error -62
But every fourth or third connection my linux get it:
[14320.700161] usb 1-7: new low speed USB device using ohci_hcd and address 114
[14320.916267] usb 1-7: configuration #1 chosen from 1 choice
And lsusb gives me than:
Bus 001 Device 009: ID 16c0:05dc
The correct device and vendor id but no description seems to be available.
My only idea is to connect an pull down resistor to D+ with 1M. Ordered the 1M and some other parts today. But propably one of you have some more ideas, why it gets not every time a connection.
For the completion my main function is:
Code: Select all
usbMsgLen_t usbFunctionSetup(uchar data[8])
{
usbRequest_t *rq = (void *)data;
static uchar dataBuffer[4]; /* buffer must stay valid when usbFunctionSetup returns */
return 0; /* default for not implemented requests: return no data back to host */
}
int main(void)
{
uint8_t i;
// Init Seriellen Schnittstelle
//initSerial();
wdt_enable(WDTO_1S);
DDRD = ~(1 << 2);
PORTD = 0;
usbDeviceDisconnect(); /* enforce re-enumeration, do this while interrupts are disabled! */
i = 150;
while(--i){ /* fake USB disconnect for > 250 ms */
wdt_reset();
_delay_ms(1);
}
usbDeviceConnect();
usbInit();
sei();
serial_puts("connected");
serial_return();
for(;;){ /* main event loop */
wdt_reset();
usbPoll();
}
}
For what is the usbFunctionSetup ?
Will have more looks into the documentation but happy about every hint.
Greetings
Krieger