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:
to:
However, when I look at the linkerscript, I notice that — regardless of the configuration — the USB always uses the same RAM section:
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:
Do I need to rewrite parts of the USB stack to make this work?
Are there any examples available that demonstrate how to use this memory with USB1?
Would using this dedicated USB RAM result in better performance compared to regular SRAM?
Thanks in advance for your help!
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