LPC4330-Xplorer UsbDevice Sample Code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC4330-Xplorer UsbDevice Sample Code

532 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ericgorr on Wed Jun 27 10:44:26 MST 2012
I have starting working with the Xplorer board have had success in getting most of the sample projects up and running from within Ubuntu running within VirtualBox on OS X 10.7, but I am having trouble with the UsbDevice project. I am able to build, load, and run the code on the board. Using USB Prober on OS X, I even see the device show up as a Composite device with a Mass Storage device. However, the mass storage device does not show up in Disk Utility as a mountable device. I do see an error message in the console which says that converting Bulk MPS 224 to 512 (USB 2.0 Spec section 5.8.3). I do see in mscuser.h that MSC_HS_MAX_PACKET is set to 224 and a comment says this value must be < 256, but the USB 2.0 spec says this value must be 512.

Is there a reason why it is 224 and not 512?

I did try changing it to 512, but it just appears to crash or hang.

Any thoughts or comments on how to get it to work and comply with the USB 2.0 Spec?

Thank you.


Labels (1)
0 Kudos
6 Replies

462 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by roboknight on Tue Dec 16 11:17:21 MST 2014
You actually don't need JTAG.  You can pretty much use the standard DFU utilities, however, you need to add the LPC prefix to the binary (dfu-prefix -a filename -L should do it).  I use the following:

dfu-suffix -a binfile -v 0x1fc9 -p 0x000c
dfu-prefix -a binfile -L
dfu-util -D binfile

NOTE:  THIS ONLY RUNS FROM RAM... In order to run from flash you need to do the following:

dfu-util -d 0x1fc9:0x000c -t 2048 -R -D iram_dfu_util_spiflash.bin.hdr
lpcdfu -d 3 -e -D "filename" -U -L "logfile name" -C /dev/null -A 0x14000000

The second method has 2 components:
1) iram_dfu_util_spiflash.bin.hdr
    This is a file that is part of lpc_dfu (I could only locate 1.02)  It was written to talk to the SPIflash file that gets sent over in the first stage.
2) lpcdfu
    This is an open source tool I found that replaces the Windows based flashing tool.

Setup has worked well to get me both writing to RAM and writing to FLASH.

In order to use EITHER method, you must first change the dip switch to 1-on, 2-off, 3-on, 4-off  (Basically, if 1 is on your left, 1-down, 2-up, 3-down, 4-up).

Here's some info:
http://blog.technical.io/post/66686276686/reverse-engineering-lpcs-device-firmware-upgrade

http://www.lancos.com/lpc_dfu-1.02.tar.gz

Again, it works well.
0 Kudos

462 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ericgorr on Mon Jul 02 06:48:21 MST 2012
Well, I am just running the code out of ram and am using an Olimex ARM-USB-OCD-H box.

I haven't looked at whether or not the packets are being broken to fit into the odd size.
0 Kudos

462 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bobjones on Fri Jun 29 19:20:35 MST 2012
>Would you agree that the 224 value is incorrect and that it should be 512? Or, have I misread the USB 2.0 spec?

It looks like you are right. For HS operation, the max packet size in configuration descriptor must be 512. Do you see packets being broken to fit into this rather odd size ? That would be your proof.

Re your setup, I would like to know what JTAG/Programmer are you using, because I have a sort of working setup on Windows but I am hitting the 32k limit of uVision so I am unable to reset to factory settings.
0 Kudos

462 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ericgorr on Fri Jun 29 10:15:29 MST 2012
Thanks for the reply Bob. Hopefully you'll be able to help with this.

Would you agree that the 224 value is incorrect and that it should be 512? Or, have I misread the USB 2.0 spec?

As for my setup, I am not sure what details you are looking for. I am using version 12.04 of Ubuntu. I am also using LPC Xpresso 4.2.3 to build.

As for uploading and debugging, I am using OpenOCD on the Mac and from within Ubuntu, I use GDB and set GDBs remote target to the OpenOCD debug server. This allows me to use 'mon halt', load the code, etc. I know that this part of the setup is not a problem because I can get the code to run and have successfully modified other same code to do some simple serial communication. I believe the problem is with not following the USB 2.0 Spec and not my setup.

If you need anything further, please let me know.

0 Kudos

462 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bobjones on Fri Jun 29 07:33:53 MST 2012
Interesting finding. Btw, what is your setup like ? What are you using for build/upload/debug from Ubuntu ? 10.04, 12.04 ?
0 Kudos

462 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ericgorr on Thu Jun 28 04:01:24 MST 2012
With more patience, I did notice the mass storage device will eventually show up in Disk Utility, but it takes a good 10 - 15 minutes for this to happen. I still suspect that the problem is with not following the USB 2.0 spec by using a value of 224 for MSC_HS_MAX_PACKET instead of 512.
0 Kudos