Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: LPC2148 USB samples (not working)

2006-01-13 by Carsten Grøn

Thanks for the comments Bertrik !

I'm currently using Keil and their ULINK JTAG, and the sample from 
their own website USBHID (also tried the USBMEM, same result). I 
_think_ that the hw of the embedded artists board and the keil board 
are more or less the same (P0.23 and P0.31), but still no success.
The packed "stuff" should be ok (I guess) as they must have it 
running on their own board/using their own compiler.

(I got some of the "packing" trouble when I ported the uIP to the 
keil :o)

Carsten




--- In lpc2000@yahoogroups.com, Bertrik Sikken <bertrik@z...> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Carsten Grøn wrote:
> > Hello,
> > 
> > I have been playing around with some of the USB samples from Keil
> > etc, and been trying to get just one of them to run on a LPC2148
> > board from www.embeddedartists.com (very nice boards btw) but I'm
> > having some problems. Well, actually it's the sam eproblem no 
matter
> > which sample I try, I always get a message from Win2K "Unknown
> > device....."....
> > Now, before I bury myself deeeeeep into the "unknown of USB", is
> > there something I need to be aware of when running some of these
> > samples ? The LPC2148 board has P0.31 switching the USB+ to 3V3, 
and
> > P0.23 senses Vcc from the USB host, which should be the same as 
the
> > Keil MC2140 board......
> > The same thing happens with the Keil usbmem, usbhid and the 
philips
> > vcom sample (the keil audio reports an internal linker error 
when I
> > try to build that....)
> > 
> > So, something I must be doing wrong, any leads ???
> > 
> > (PS: I have ported uIP to a LPC2138 Ethernet board from
> > embeddedartists running with the Keil RTX RTOS, working very 
nicely)
> 
> I too have an LP2148 from embedded artists and I just got the 
usbmem
> example working with gcc to the point that windows recognises my
> board as a mass-storage device with the proper USB device 
descriptors
> (product/vendor id, strings descriptor, etc.)
> 
> USB mass storage itself is not quite working yet, although windows
> properly recognises the size of the disk (at 16 kB).
> 
> I think the relevant steps to make it work were:
> * the P0.31 pin should be configured for the USB 'CONNECT' function
> * aggressive packing of all USB related structs by means of
>   '__attribute ((packed))' and of every 'sub-struct' within those
>   structs.
> * aligning several structures to 32-bit boundaries, using
>   '__attribute ((aligned(4)))'
> * replacing __irq by '__attribute__ ((interrupt))'
> * (I just removed some of the '__at' directives)
> * Modifying the for-loop in USB_ReadEP into
>   for (n = 0; n < (cnt + 3) / 4; n++) {
> 	dw = RX_DATA;
> 	*pData++ = dw >> 0;
> 	*pData++ = dw >> 8;
> 	*pData++ = dw >> 16;
> 	*pData++ = dw >> 24;
>   }
> * Modifying the for-loop in USB_WriteEP into
>   for (n = 0; n < (cnt + 3) / 4; n++) {
>     TX_DATA = (pData[3] << 24) | (pData[2] << 16) | (pData[1] << 
8) |
> pData[0];
>     pData += 4;
>   }
> (there used to be some __packed directive in these parts in the
> Keil code)
> 
> I may have changed some other stuff, but I think the list above
> are the most significant changes.
> 
> Some very useful tools in making it work so far, were:
> * OpenOCD in combination with a wiggler clone and arm-elf-insight.
>   OpenOCD is similar to what OCDRemote does, except this is open-
source
>   http://developer.berlios.de/projects/openocd
> * "usb in a nutshell", a really good document describing the 
essence
>   of USB, at
>   http://www.beyondlogic.org/usbnutshell/usb-in-a-nutshell.pdf
> * usbsnoop, a windows USB packet sniffer, see:
>   http://benoit.papillault.free.fr/usbsnoop
> 
> Kind regards,
> Bertrik
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (MingW32)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
> 
> iD8DBQFDx/4iETD6mlrWxPURAnaXAJ46r76Yzi/5+YR16aypISUGCIC3fQCgl1HE
> Dss2pAvZbJVHFWL2KAZQevc=
> =XTft
> -----END PGP SIGNATURE-----
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.