LPC55S16 USB1 HS using the USB_RAM USB: 0x4010_0000

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

LPC55S16 USB1 HS using the USB_RAM USB: 0x4010_0000

212 Views
Nico3
Contributor I

 

Hi,

I am trying to use USB1 on an LPC55S16. I can do this easily by changing the following two defines in the SDK example lpcxpresso55s16_dev_cdc_vcom_bm:

#define USB_DEVICE_CONFIG_LPCIP3511FS (1U)
#define USB_DEVICE_CONFIG_LPCIP3511HS (0U)

to:

#define USB_DEVICE_CONFIG_LPCIP3511FS (0U)
#define USB_DEVICE_CONFIG_LPCIP3511HS (1U)

 

However, when I look at the linkerscript, I notice that — regardless of the configuration — the USB always uses the same RAM section:

USB_RAM (rwx) : ORIGIN = 0x20010000, LENGTH = 0x4000 /* 16 KB (alias RAM2) */

But according to Chapter 45 of the UM11295 user manual, the USB1 peripheral has its own dedicated RAM located at address range 0x40100000 to 0x40103FFF.

So, when using the USB1 peripheral, I would expect it to use this dedicated USB1 RAM region rather than the general SRAM.

I also checked the lpcxpresso55s16_dev_cdc_vcom_bm.map file, and found that nothing is allocated at the 0x40100000 region.

On the other hand, if I modify the linkerscript to place USB_RAM at 0x40100000, the application crashes during usb-initialization with a hardfault exception.

So here are my questions:

  1. Do I need to rewrite parts of the USB stack to make this work?

  2. Are there any examples available that demonstrate how to use this memory with USB1?

  3. Would using this dedicated USB RAM result in better performance compared to regular SRAM?

Thanks in advance for your help!

0 Kudos
Reply
1 Reply

154 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @Nico3 

Do I need to rewrite parts of the USB stack to make this work?

I think you can try the following steps.

1. Modify the USB stack initialization to allocate buffers (like endpoint buffers) from the new section at 0x40100000.


2. Update the linker script to define a new memory region for USB1 RAM:

 

USB1_RAM (rwx) : ORIGIN = 0x40100000, LENGTH = 0x4000 /* 16 KB */

3. Add a new section for USB buffers in your .ld file:

 

.usb1_ram (NOLOAD) :
{
. = ALIGN(512); /* Align to match USB controller requirements */
*(.usb1_ram)
} > USB1_RAM

4. Place the USB buffers explicitly into this section using:

 

__attribute__((section(".usb1_ram"))) uint8_t usbBuffer[4096];

Are there any examples available that demonstrate how to use this memory with USB1?

No.

Would using this dedicated USB RAM result in better performance compared to regular SRAM?

In general, yes

 

BR

Harry

0 Kudos
Reply