Reply by "Bal...@foo.is [lpc2000]" November 26, 20142014-11-26
I ended up porting that example code anyway and I got it working, LPCOpen/NXPUSBlib don't appear to support LPC2000 but only the newer devices.
Now my only problem is that the example code breaks if I try to make it transfer messages longer than one byte.

Baldur

On Wed, Oct 08, 2014 at 09:14:21AM +0000, Tim Mitchell t...@sabretechnology.co.uk [lpc2000] wrote:
> l... wrote:
> > Thanks, I'll have a look.
> > Yes I know what the packed keyword does but GCC doesn't like it inside
> > type casts the same way as the Keil compiler does (and it's plastered
> > all over the code,
> > even in locations where it really wouldn't be necessary), and there
> > are various
> > other uglies in the MCB2300 USBHID example making it a poor base to
> > work from such as putting the device name and serial number inside a
> > static array interleaved with null bytes instead
> > of using a function to construct the array.
> I agree a lot of the example code is horrible.
>
> Nxpusblib is based on LUFA by Dean Camera which is a USB library for the Atmel AVR.
> The NXP website tries to send you to LPCOpen instead but that's just an even bigger library with more stuff in it. If you just want the usb bit then the usblib is easier to implement.
> --
> Tim Mitchell

Posted by: Baldur Gislason



An Engineer's Guide to the LPC2100 Series

Reply by "Tim...@sabretechnology.co.uk [lpc2000]" October 8, 20142014-10-08
l... wrote:
> Thanks, I'll have a look.
> Yes I know what the packed keyword does but GCC doesn't like it inside
> type casts the same way as the Keil compiler does (and it's plastered
> all over the code,
> even in locations where it really wouldn't be necessary), and there
> are various
> other uglies in the MCB2300 USBHID example making it a poor base to
> work from such as putting the device name and serial number inside a
> static array interleaved with null bytes instead
> of using a function to construct the array.
I agree a lot of the example code is horrible.

Nxpusblib is based on LUFA by Dean Camera which is a USB library for the Atmel AVR.
The NXP website tries to send you to LPCOpen instead but that's just an even bigger library with more stuff in it. If you just want the usb bit then the usblib is easier to implement.
--
Tim Mitchell

Posted by: Tim Mitchell



Reply by "Bal...@foo.is [lpc2000]" October 7, 20142014-10-07
On Mon, Oct 06, 2014 at 03:36:33PM +0000, Tim Mitchell t...@sabretechnology.co.uk [lpc2000] wrote:
> l... wrote:
> > I'm looking for some example USB HID device code for LPC2387 that
> > compiles with GCC.
> >
> > The Keil example USBHID is horribly written, uses a lot of tricks
> > with the _packed keyword inside type casts and such that breaks it
> > when compiled with a different compiler.
> > Aside from that the Keil example is also so ugly that even though it
> > works fine in uVision it's just not very good code to base a project
> > on.
>
> Nxpusblib is good and fairly easy to implement.
> GCC has _packed though - and you'll need to keep structures packed or it won't work
>
> --
> Tim Mitchell

Thanks, I'll have a look.
Yes I know what the packed keyword does but GCC doesn't like it inside
type casts the same way as the Keil compiler does (and it's plastered all over the code,
even in locations where it really wouldn't be necessary), and there are various
other uglies in the MCB2300 USBHID example making it a poor base to work from such as putting the device
name and serial number inside a static array interleaved with null bytes instead
of using a function to construct the array.

Baldur

Posted by: Baldur Gislason



Reply by "Tim...@sabretechnology.co.uk [lpc2000]" October 6, 20142014-10-06
l... wrote:
> I'm looking for some example USB HID device code for LPC2387 that
> compiles with GCC.
>
> The Keil example USBHID is horribly written, uses a lot of tricks
> with the _packed keyword inside type casts and such that breaks it
> when compiled with a different compiler.
> Aside from that the Keil example is also so ugly that even though it
> works fine in uVision it's just not very good code to base a project
> on.

Nxpusblib is good and fairly easy to implement.
GCC has _packed though - and you'll need to keep structures packed or it won't work

--
Tim Mitchell

Posted by: Tim Mitchell



Reply by "Bal...@foo.is [lpc2000]" October 6, 20142014-10-06
I'm looking for some example USB HID device code for LPC2387 that compiles with GCC.

The Keil example USBHID is horribly written, uses a lot of tricks with the _packed keyword
inside type casts and such that breaks it when compiled with a different compiler.
Aside from that the Keil example is also so ugly that even though it works fine in uVision
it's just not very good code to base a project on.

Baldur

Posted by: Baldur Gislason