Problem with bringing up USB driver stack on LPC 2148

Hi everybody,

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?

Please help me.

Which USB stack are you using?

What kind of hardware?

I am using proprietary ARM board with LPC 2148 microcontroller chip.

I am using a USB driver stack released by bertrik.

I found it under topic “USB Mass Storage demo on LPC-P2148”

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.

You think it never returns from USBHwConnect?

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 did indeed find a bug in the startup code: the MAM was not initialised properly, although I doubt that this was causing the problem.

Other things I can think of:

  • on boards with a permanent pullup on D+: code takes too long to initialise

  • misconfigured CONNECT and VBUS pin. The user manual is not very clear on how these pins should be configured exactly.

The code returns from USBHwConnect

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:

Hi

After debug the results i am getting are as follows

In USBHwISR routine which is checking the USB device interrupt status, i put prints

as soon as i plug the device I am getting error interrupt . i did get error code after that

and it is saying “end of packet error”

so what might be the problem?

Plz help me

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.

Hi,

Thanks for looking into my problem.

  1. The tool chain version I am using is 3.4.3

  2. 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.

Hi,

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.

Thanks for your support and help.