LPC1343 USB example - release build does not work

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC1343 USB example - release build does not work

628 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tungsys on Tue Nov 15 19:25:34 MST 2011
Hi,

I am testing the USB CDC example of LPC1343 from NXP website.
http://ics.nxp.com/support/lpcxpresso/zip/examples.lpc13xx.zip

I build example with Debug mode in lpcxpresso and the software work fine ; But when i change to build in release mode, I can build successfully but USB device mode does not work. When I plug usb cable to computer (windows 7) , there is a message say USB device is not recognized .

Any help would be appreciated !
Thanks
0 项奖励
4 回复数

449 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Sat Nov 19 03:05:26 MST 2011
It's still hurting ...

I had to read both the lpc134x and 17xx user manual in more detail and still don't have it working yet.

I discovered that besides the changed interrupt structure there are also some changes neede in the end point configuration. Somehow the lpc1768 CDC example uses endpoints 0 (the default control EP), EP1 (interrupt endpoint to configure the serial port), EP2 (bulk in) to transport RxData towards the host) and EP5 (bulk out) for the TxData. Since the (fixed) endpoint configuration in the lpc134x differs from that in the lpc17xx this also has to be changed.
Note that this is a change on application level so this is not something that is done automatically by the LPCUSB stack.

But my problem is in an earlier phase.
On initialization all event handlers are installed andthe interrupt is enabled. After this the application calls USBHwConnect(TRUE); to signal the host that the device is ready.
This all works. I see the pull up being acivated and the PC starts to communicate with the lpc134x device. Frame interrupts are fired and I even see an EP0 interrupt signalling that the host is trying to communicate (i.e: send a packet).
At this point the USB stack waits for the CD_FULL interrupt in the DevIntSt.
I never see this interrupt bit being set...

So I started re-reading the User Manual and I now have to check this with the changes I made to the software.

If you feel like giving it a try yourself, I've uploaded my changes so far to this web page.

Rob
0 项奖励

449 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Wed Nov 16 04:16:28 MST 2011
Tung,

Quote: tungsys

Do you think that the LPCUSB stack is better than the Keil USB stack ? The lpc1343 examples is based on Keil usb stack.


No, I don't think so ... I am sure of it
When we started out with the lpc2148 years ago the Keil USB stack was already available for that MCU. Both Bertrik and I had problems understanding why the Keil stack works the way it does and Bertrik decided to create his own USB stack.
That stack "LPCUSB" is much cleaner than the Keil one - at least I think so. There is no need to change things in the stack itself to get it working for a specific device.

Also, not unimportant to some of us, Keil does not allow you to distribute source code. So if you write software and want to share it with others you cannot share the Keil sources.
The LPCUSB stack has a nicer licensing scheme:
/*
    LPCUSB, an USB device driver for LPC microcontrollers    
    Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl)

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
    2. Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.
    3. The name of the author may not be used to endorse or promote products
       derived from this software without specific prior written permission.
*/


I have not looked at or used the nxpUSBlib before so I cannot comment on the code but after a quick glance I see a lot of nice examples that are worth looking at.

Regards,
[INDENT]Rob
[/INDENT]
0 项奖励

449 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tungsys on Wed Nov 16 02:44:52 MST 2011
Hi Rob,

Thanks for your reply.
Do you think that the LPCUSB stack is better than the Keil USB stack ? The lpc1343 examples is based on Keil usb stack.
Anyways, i will try to fix this bug. If it works fine, I will post my patch on this forum.

Just a question, what is the difference between release build and debug build ? why debug build can work but release build cannot. As what I know the only difference is that release build is smaller than debug build in code size.

Another choice is nxpusblib
http://www.lpcware.com/content/project/nxpusblib,
but unfortunately they did not port this usb stack on lpc1343.


Cheers,
Tung.
0 项奖励

449 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Tue Nov 15 23:41:30 MST 2011
Hi Tungsys,

This has been reported before.
Unfortunately NXP's team can only handle that much work, meaning that there is no urgency on getting these types of errors fixed.

You will however find that the examples delivered with the LPCXpresso tools are maintained/rewritten by Code Red to suit their own RDB1768 board.
With a little help these examples will also work on the lpc1343 since most of the peripherals (a.o. USB) are all the same.

They did a very good job on the USB part by deciding to drop the Keil stack and go for Bertrik's LPCUSB instead. It was originally created for the lpc2148 (link on sourceforge) and later ported to the lpc17xx. Porting it to the lpc1343 should be that simple that I can't remember why I never did this ...

meanwhile I have spent so much time explaining others that it is that simple - I could almost have done it myself in less time writing the emails :eek:
I've still got a few hours until the sun is up and I need to get back to sleep ehh... work ... again - let's give it a try :cool:

Just hang on - or have a go at it yourself.

Edit:
[INDENT]OUCH ... :confused:
[/INDENT] Apparently I was wrong in stating the USB controller is the same. The lpc134x USB controller has a different interrupt structure and fixed endpoints that differ somewhat from the lpc17xx - maybe there are some more changes.
Seems more than just an hour converting/typing ...
Still - I do need a proper (free) USB stack for one of my lpc1343 projects so I'll have to continue ...

Cheers,[INDENT]Rob
[/INDENT]
0 项奖励