Setting up the USB ROM stack to use high speed

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

Setting up the USB ROM stack to use high speed

2,538 Views
jking1
Contributor II

Hi,

There are several LPC54628 example projects using the USB ROM stack.  I'm working with the CDC project "lpcxpresso54628_rom_dev_cdc_bm". 

All the USB ROM examples are configured for full speed operation;  I want to change the CDC example to high speed.

After making what I think are the necessary modifications, the call to the Init function in the ROM api fails with error code 0x4000A (ERR_USBD_BAD_MEM_BUF, /**< Bad alignment of buffer passed. */)

The new HS configuration descriptor is properly word aligned.

Has anyone used the ROM stack in high speed mode?  Any suggestions or maybe a boiler plate example to share? 

Thanks

 

Joe

 

Labels (2)
0 Kudos
13 Replies

1,263 Views
DaGe
Contributor I

Hi all,

I know this is an old topic, but I ran into the same issue. Is there anyone who can share the sources to the solution (or a link to it)?

My final goal is to get the HID based on the ROM stack working for HS USB. Is there anyone who managed to get this up and running?

Thanks in advance.

Daan

0 Kudos

1,254 Views
elijah
Contributor III
The ROM stack *technically* works in high speed mode, however it only supports a maximum report size of 64 bytes (NXP chose not to either fix or record this anywhere). If you try to use a larger report size the ROM stack will throw an error and there is no way around it.

If you actually want to make full use of the High-Speed USB 512 byte report size you will have to use the software stack. I had to go through the painful process of ripping out the ROM stack from a large project and replacing it with the software stack from other examples.
0 Kudos

1,245 Views
DaGe
Contributor I

Hi Elijah,

Thanks for the quick reply. I'm willing to accept the 64 byte report size limitation (although it is a pity that NXP didn't document this any ware). I took the source shared by Joe in this thread and modified the endpoint descriptors to the correct endpoint size, but I still end up with result 0x4000A (ERR_USBD_BAD_MEM_BUF).

I have no idea how to debug this issue, so any working examples would be appreciated.

BR,

Daan

0 Kudos

959 Views
DaGe
Contributor I

Any ideas on how to debug this memory buffer issue? Or is there anyone willing to share a working example (highspeed USB using the ROM stack)?

Thanks in advance.

0 Kudos

2,521 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Joe

To change SDK USB demo from FS USB (USB0) to HS USB (USB1),  we need to change file :usb_device_config.h

--------------------------

/*! @brief LPC USB IP3511 FS instance count */

#define USB_DEVICE_CONFIG_LPCIP3511FS (0U)

 

/*! @brief LPC USB IP3511 HS instance count */

#define USB_DEVICE_CONFIG_LPCIP3511HS (1U)

-----------------------

rebuild the project. USB1 should work.

if this can't meet your requirement, please let us know the steps of how to reproduce your issue based on the SDK demo code.

Thanks,

Jun Zhang

0 Kudos

2,515 Views
jking1
Contributor II

Hi

Thanks for the response.  Your suggested solution only applies when working with SDK examples which use the firmware USB stack.  My issue is with the examples that use the ROM based USB stack.

In particular I tested with the SDK example "lpcxpresso54628_rom_dev_cdc_bm"  This example is written for full speed USB and if compiles and runs correctly on my dev card.

To convert the example to high speed I added an HS device config descriptor, a device qualifier descriptor and set up the appropriate clock source and power control. However I found that the ROM based Init() function failed when setting the USBD_API_INIT_PARAM_ parameter .usb_speed to USB_HIGH_SPEED (i.e. 1) 

I have gone as far as I'm able with the available documentation and have searched on this forum and the wider Web but not found a solution.

I have zipped the source folder and posted it here so you can see the problem.

 

Thanks

 

Joe

0 Kudos

2,460 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

I got your reply.

I will work on it and let you know once I work it out.

Thanks

Jun Zhang

0 Kudos

2,431 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

HI

For all of usb rom demos in the released SDK, only FS is supported now and in the future.

I meant to upload my revised usb rom HS code to you. But I can't upload because of the code restriction.

If you need, please send me your email address. I will send it to you.

Thanks,

Jun Zhang

0 Kudos

1,979 Views
elijah
Contributor III

Hi,

I also need to use the USB ROM for High-Speed USB. Could you make the solution available here for anyone else to use?

Thanks,

Elijah 

0 Kudos

2,424 Views
jking1
Contributor II

Hi Jun Zhang

Thanks very much for this.  I would be grateful if you would send you your solution.  I'll PM you my contact.

 

Kind Regards

Joseph

0 Kudos

1,976 Views
elijah
Contributor III
Hi Joseph,

I am having the exact same issue as you, are you able to advise how to fix the ERR_USBD_BAD_MEM_BUF error and get the USB ROM workign in High-Speed mode?

Thanks,
Elijah
0 Kudos

1,966 Views
jking1
Contributor II

Hi Elijah

Although high speed allows a maximum bulk in/out packet size of 512 bytes, the ROM code only allows the full speed maximum packet size of 64 bytes. I think this was an oversight at the chip design stage which wasn't worth their while to correct (or document). So in the USB descriptor, set wMaxPacketSize to WBVAL(USB_FS_MAX_BULK_PACKET) that is: 64.

Hope this helps.

Joe

2,384 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

I just sent to your email. Please have a look.

Thanks

Jun Zhang

0 Kudos