I am using USB driver stack code (open source) for LPC 2148 chip.
When i run it , and plug in then USB LINK led lights up and when unplugged goes off.
But my linux machine is not able to detect any USB device when plugged in where on windows machine it shows “Unknown USB device attached.”
Even i tried to understand the execution flow of driver by putting DBG prints but i don’t see any further prints on terminal , it shows prints uptill calling “USBConnect” then shows nothing.
Am i missing with anything ? is there anything i need to do?
The driver stack expects some circuitry on VBUS to sense the USB supply voltage and also some circuitry on the CONNECT pin to attach a 1.5kohm resistor from Vcc to D+ when CONNECT is low. But I think you have both things right, judging from your description of the LED behaviour.
I got a report from someone using a Keil board that the USB stack is not working properly. Unfortunately we have not found out why. There could be a common cause ((like a software bug in the USB stack) between your case and the problem with the Keil board.
I had the same problem when trying to use the stack in the build environment supplied by embeddedartists , however the sample code runs fine so i figure it’s something in the startup code thats not setting things up correctly but haven’t taken the time to figure out what.
I put print after USBHwConnect and getting that print on console that means it is getting out of it.
Then control enters into while loop continuously seeking for interrupts, it only goes into HandleUsbReset for 4-5 times consecutively and then no further action :roll:
Last night, I experimented a bit with the error interrupt. I am seeing it too. In my case it seems to happen after a couple of minutes with the USB cable disconnected. I don’t think this is the real cause of the problem.
A couple of other things:
What version of the toolchain are you using? I found out that with arm-elf-gcc 3.4.3 the alignment/structure packing is different than with version 4.x. I have not tested the stack with any other toolchain version than 3.4.3 so it is possible that there are still some bugs in this area. Can you send me your .map file?
The user manual mentions a minimum peripheral clock frequency when using the USB controller (around 18 MHz IIRC). Make sure that the peripheral is above this minimum.
Yep, i was wrong , i had set VPBDIV register to 0x00. So peripheral clock frequency was 15MHz. I set it to 1 so peripheral clock frequency is now 60MHz.
But then also i am facing the same problem. I even try out with VPBDIV = 0x02 (i.e. half of processor clock)
What i tried is , i did reset(again doing initializations i.e. clearing interrupts , enabling them , initializing control end points) when i receive error interrupt but then also things doesn’t seem to work.
what i am doing, is it right? or should i give reset command and then follow initialization.
There was a problem in my hardware connection , the D+ pin of USB connector is connected to D- pin of controller. and D- of USB connector to D+ pin of controller. Differential
pin connectios got swapped.
This was the problem preventing me form getting any packets and continuously i was getting error interrupt.
Now i changed that and everything is working fine.