Porting nxpUSBlib to Rowley CrossStudio for LPC1788

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

Porting nxpUSBlib to Rowley CrossStudio for LPC1788

1,009 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CarlMle on Thu Mar 22 02:18:39 MST 2012
I'm working on porting the nxpUSBlib to work with Rowley, I thought I would share my experience/pain.

Specifically I need to get USB host working so my device can write to a USB Memory stick.

So I created a new solution, imported the usblib files and latest CMSIS and for now the hosthid example.

I added the preprocessor defines : USB_HOST_ONLY , __LPC17XX__

and hit build.

The first issue is CrossStudio doesn't like the __DATA(USBRAM_SECTION) statement that tells the linker to place the varibles in to AHBSRAM the Peripheral SRAM.

To fix this ....

I looked at the flash_placement.xml file, I couldn't see AHBSRAM but there is a section called

<MemorySegment name="$(RAM2_NAME:RAM2)">

but I could find no mention of RAM2 in the LPC1788_MemoryMap.xml, so I changed that line to :
"<MemorySegment name="AHBSRAM">"

I changed "__DATA(USBRAM_SECTION)" this to : "__attribute__ ((section(".bss2")))";

Hit build and success it links, but examining the varible locations they were not in the correct place, AHBSRAM starts at 0x20000000

Looking at the MemoryMap again the AHBSRAM start location is incorrect for the LPC1788, so I've changed it to :
<MemorySegment size="0x8000" access="Read/Write" start="0x20000000" name="AHBSRAM"/>

Rebuilt and my variables are now correctly located in AHBSRAM.

I still have some work to do though as it hardfaults enabling clocks for the OTG/AHB, some my next job is to fix the peripheral initialisation I think.

Labels (1)
0 Kudos
Reply
6 Replies

939 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by DiBosco on Mon Jun 25 01:25:31 MST 2012
I am trying to get the VCP example working with Crossworks. I have it working on Xpresso, but would really like to use Crossworks for a whole host of reasons. However, I am just getting loads of errors. I created a new project, put VirtualSerial.c and Descriptors.c as the source file and added paths for the headers.

I get errors such as:

unknown type name ‘USB_CDC_Descriptor_FunctionalHeader_t’

Which you'd think would be a header issue, but I am sure the relevant file is in the include path.

Would you mind giving more detail about how you got the projects in to Crossworks please? Would be most grateful for any help.
0 Kudos
Reply

939 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tuong on Tue Apr 10 20:49:17 MST 2012
Dear Cakmakmurat2000,

It seems like you did prepare a control transfer but nothing is sent on USB bus.
Which environment are you running? LPCXpresso or Keil? Can you check the address of:
   - USB_ControlRequest
   - ohci_data
These variables provide the buffer address for the TDs. As I know, the USB core requires
these address located on Peripheral RAM, ex. 0x20000000.

With best regards,
Tuong Nguyen
0 Kudos
Reply

939 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CarlMle on Thu Apr 05 01:25:24 MST 2012
I ran out of time trying to port nxpusblib, instead I used the simple usb host example in the cmsis library. This works and I had FAT16 formatted USB sticks mounted and writing files to them. Also as the name suggests is a lot simpler!

But most USB sticks are FAT32 formatted so I took this example :

http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/arm_memcards/index.html

ported Fatfs, modified the diskio and now have fat32 working with a usb stick.

While porting the key thing to remember was to use the linker command "__attribute__ ((section(".bss2")));" to assign USB buffers to the correct memory space in the AHBSRAM.

Rowley have recently released an update to their "NXP LPC1000 CPU Support Package" that includes the fixed AHBSRAM memory maps I told them about :)
0 Kudos
Reply

939 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cakmakmurat2000 on Wed Apr 04 07:16:44 MST 2012
Hi,

I use nxpUSBLib on HOST HID mode with LPC1768 and its working.
And now I want to use nxpUSBLib with LPC1788 and I modified Register Names and pins etc according to LPC1788.
Library can sense device connection but it cant get Writebackdonehead after Control Transfer.
Is there any sample with 1788 or
what can I do?

Thanks.
0 Kudos
Reply

939 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tuong on Mon Mar 26 21:48:19 MST 2012
Dear CarlMIe,

This is wonderfull!

How is your progress now? Any pain comes? :D

FYI, the LPC1788 and LPC175x_6x have same USB core, but LPC1788 has 2 USB ports, so you may need to modify a bit to be able to switch between them or fixed to 1 port only under the HAL layer.

With best regards,
Tuong Nguyen
0 Kudos
Reply

939 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CarlMle on Thu Mar 22 02:27:47 MST 2012
Hrmm the forum stripped my xml chunks out and I can't see the ability to edit a post,

So heres the important bits, this time using the code tag

flash_placement.xml
<code>
<MemorySegment name="$(RAM2_NAME:RAM2)">
Changed to :
<MemorySegment name="AHBSRAM">
</code>


LPC1788_MemoryMap.xml
<code>
<MemorySegment size="0x8000" access="Read/Write" start="0x2007C000" name="AHBSRAM"/>
Changed to :
<MemorySegment size="0x8000" access="Read/Write" start="0x20000000" name="AHBSRAM"/>
</code>
0 Kudos
Reply