LPC5528 FS USB Throughput

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

LPC5528 FS USB Throughput

1,010 Views
juan_guzman
Contributor I

LPC5528 USB Full Speed throughput

Hello All,

I'm working on a project using the LPC5528. It's a printer application were the LCP5528 is used perform print jobs.

The print job data is transferred from a Host processor to the LPC5528 via FS USB0 interface using a Bulk type Endpoint. We are using NXP MCUXpresso SDK USB Stack implementation.

The problem we're seeing is that we're not getting efficient throughput on the USB Bulk transfers. Every other Bulk transfer is being NAKED by the LPC5528.

juan_guzman_0-1762459983572.png

 

I timed the execution of the USB ISR handler on the LPC5528 from the point the interrupt fires to the point were the USB stack calls the Callback function and re-activates the Bulk Endpoint. This takes about 40uS. It is my guess that the latency in in the USB Stack is causing the inefficient throughput.

Can someone confirm if this is a reasonable conclusion? If so, is there a way to optimize the USB Stack or what other means are possible to achieve efficient throughput through the Bulk Endpoint? 

0 Kudos
Reply
7 Replies

945 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @juan_guzman 

 

Thanks for your question.

Could you please first test using the SDK demo printer_virtual_plain_text? Also, please measure the execution time.

If the issue can be reproduced with the SDK demo, I’ll help check it on my side.

Thank you.

 

BR

Alice

0 Kudos
Reply

911 Views
juan_guzman
Contributor I

Hello Alice,

I was able to recreate the same issue using the SDK demo you suggested.

I continue to see the same pattern of one transfer is ACKed and the next is NAKed.

juan_guzman_0-1762879713110.png

 

I measured the execution time from the entry into the USB ISR to the USB Stack callback function USB_DevicePrinterAppCallback(). This time is 13.2 uS

juan_guzman_1-1762880137210.png

juan_guzman_2-1762880258513.png

 

 

I also measured the execution of the USB_DevicePrinterRecv(), this time is 16.0 uS

juan_guzman_3-1762880620465.png

 

So the entire time for the USB Stack to handle a Bulk frame and reactivate the Endpoint is 13.2uS + 16uS =  29.2 uS.  This is pretty much in line to what I'm seeing on my project.

Please let me know if the Stack can be optimized to achieve a better USB transfer efficiency.

Attached is the USB Analyzer trace and also the test file I used.

Thank You,

0 Kudos
Reply

896 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @juan_guzman 

Thanks for your reply. Which tool did you use for the view below? I will debug and check on my side.

Alice_Yang_0-1762919390308.png

 

Thank you.

BR

Alice

0 Kudos
Reply

875 Views
juan_guzman
Contributor I

Hello Alice,

I used Ellisys Visual USB Analyzer to capture the USB trace.

 

Thanks,

0 Kudos
Reply

850 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @juan_guzman 

Thanks for your reply. I tested with a Teledyne USB analyzer, and the results are almost the same as yours. A Bulk endpoint will NAK when it’s not ready to accept data. I confirmed with internal,  for the MCUXpresso USB stack, a delay of about 30–50 µs from interrupt to re-arming is typical because:

The stack runs in interrupt context but still performs buffer management and callback dispatch.

 

 BR

Alice

 

 

0 Kudos
Reply

841 Views
juan_guzman
Contributor I

Alice,

Thank you for confirming the issue.

 

What would be the recommended method of ensuring efficient Bulk transfers with No NAKs?

Writing my own USB handler?

Does NXP have a USB driver that I can implement with less overhead compared to the MCUXpresso USB stack?

Do you know of any third party software solution I can use?

 

0 Kudos
Reply

650 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @juan_guzman 

Thanks for your reply.

NXP only provides the MCUXpresso USB stack. For third-party options, you can test with TinyUSB. You might also consider using HS-USB instead of FS USB.

Thank you.

 

BR

Alice

Alice

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2200311%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ELPC5528%20FS%20USB%20Throughput%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2200311%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSTRONG%3ELPC5528%20USB%20Full%20Speed%20throughput%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EHello%20All%2C%3C%2FP%3E%3CP%3EI'm%20working%20on%20a%20project%20using%20the%20LPC5528.%20It's%20a%20printer%20application%20were%20the%20LCP5528%20is%20used%20perform%20print%20jobs.%3C%2FP%3E%3CP%3EThe%20print%20job%20data%20is%20transferred%20from%20a%20Host%20processor%20to%20the%20LPC5528%20via%20FS%20USB0%20interface%20using%20a%20Bulk%20type%20Endpoint.%20We%20are%20using%20NXP%20MCUXpresso%20SDK%20USB%20Stack%20implementation.%3C%2FP%3E%3CP%3EThe%20problem%20we're%20seeing%20is%20that%20we're%20not%20getting%20efficient%20throughput%20on%20the%20USB%20Bulk%20transfers.%20Every%20other%20Bulk%20transfer%20is%20being%20NAKED%20by%20the%20LPC5528.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22juan_guzman_0-1762459983572.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22juan_guzman_0-1762459983572.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F364316i4D8719BC7088F94E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22juan_guzman_0-1762459983572.png%22%20alt%3D%22juan_guzman_0-1762459983572.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20timed%20the%20execution%20of%20the%20USB%20ISR%20handler%26nbsp%3Bon%20the%20LPC5528%20from%20the%20point%20the%20interrupt%20fires%20to%20the%20point%20were%20the%20USB%20stack%20calls%20the%20Callback%20function%20and%20re-activates%20the%20Bulk%20Endpoint.%20This%20takes%20about%26nbsp%3B%3CSTRONG%3E40uS%3C%2FSTRONG%3E.%20It%20is%20my%20guess%20that%20the%20latency%20in%20in%20the%20USB%20Stack%20is%20causing%20the%20inefficient%20throughput.%3C%2FP%3E%3CP%3ECan%20someone%20confirm%20if%20this%20is%20a%20reasonable%20conclusion%3F%20If%20so%2C%20is%20there%20a%20way%20to%20optimize%20the%20USB%20Stack%20or%20what%20other%20means%20are%20possible%20to%20achieve%20efficient%20throughput%20through%20the%20Bulk%20Endpoint%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2206752%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20LPC5528%20FS%20USB%20Throughput%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2206752%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F12027%22%20target%3D%22_blank%22%3E%40juan_guzman%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks%20for%20your%20reply.%3C%2FP%3E%0A%3CP%3ENXP%20only%20provides%20the%20MCUXpresso%20USB%20stack.%20For%20third-party%20options%2C%20you%20can%20test%20with%20TinyUSB.%20You%20might%20also%20consider%20using%20HS-USB%20instead%20of%20FS%20USB.%3C%2FP%3E%0A%3CP%3EThank%20you.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EAlice%3C%2FP%3E%0A%3CP%3EAlice%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2204529%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20LPC5528%20FS%20USB%20Throughput%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2204529%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EAlice%2C%3C%2FP%3E%3CP%3EThank%20you%20for%20confirming%20the%20issue.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EWhat%20would%20be%20the%20recommended%20method%20of%20ensuring%20efficient%20Bulk%20transfers%20with%20No%20NAKs%3F%3C%2FP%3E%3CP%3EWriting%20my%20own%20USB%20handler%3F%3C%2FP%3E%3CP%3EDoes%20NXP%20have%20a%20USB%20driver%20that%20I%20can%20implement%20with%20less%20overhead%20compared%20to%20the%20MCUXpresso%20USB%20stack%3F%3C%2FP%3E%3CP%3EDo%20you%20know%20of%20any%20third%20party%20software%20solution%20I%20can%20use%3F%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2204406%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20LPC5528%20FS%20USB%20Throughput%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2204406%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F12027%22%20target%3D%22_blank%22%3E%40juan_guzman%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks%20for%20your%20reply.%20I%20tested%20with%20a%20Teledyne%20USB%20analyzer%2C%20and%20the%20results%20are%20almost%20the%20same%20as%20yours.%20A%20Bulk%20endpoint%20will%20NAK%20when%20it%E2%80%99s%20not%20ready%20to%20accept%20data.%20I%20confirmed%20with%20internal%2C%26nbsp%3B%20for%20the%20MCUXpresso%20USB%20stack%2C%20a%20delay%20of%20about%2030%E2%80%9350%E2%80%AF%C2%B5s%20from%20interrupt%20to%20re-arming%20is%20typical%20because%3A%3C%2FP%3E%0A%3CP%3EThe%20stack%20runs%20in%20interrupt%20context%20but%20still%20performs%20buffer%20management%20and%20callback%20dispatch.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%26nbsp%3BBR%3C%2FP%3E%0A%3CP%3EAlice%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2203666%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20LPC5528%20FS%20USB%20Throughput%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2203666%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20Alice%2C%3C%2FP%3E%3CP%3EI%20used%20Ellisys%20Visual%20USB%20Analyzer%20to%20capture%20the%20USB%20trace.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThanks%2C%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2203157%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20LPC5528%20FS%20USB%20Throughput%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2203157%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F12027%22%20target%3D%22_blank%22%3E%40juan_guzman%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks%20for%20your%20reply.%20Which%20tool%20did%20you%20use%20for%20the%20view%20below%3F%20I%20will%20debug%20and%20check%20on%20my%20side.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Alice_Yang_0-1762919390308.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Alice_Yang_0-1762919390308.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F365087iBB9A2A1425213DE2%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Alice_Yang_0-1762919390308.png%22%20alt%3D%22Alice_Yang_0-1762919390308.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EThank%20you.%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EAlice%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2202907%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20LPC5528%20FS%20USB%20Throughput%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2202907%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20Alice%2C%3C%2FP%3E%3CP%3EI%20was%20able%20to%20recreate%20the%20same%20issue%20using%20the%20SDK%20demo%20you%20suggested.%3C%2FP%3E%3CP%3EI%20continue%20to%20see%20the%20same%20pattern%20of%20one%20transfer%20is%20ACKed%20and%20the%20next%20is%20NAKed.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22juan_guzman_0-1762879713110.png%22%20style%3D%22width%3A%20750px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22juan_guzman_0-1762879713110.png%22%20style%3D%22width%3A%20750px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F364993iB2DA41F269AF23FE%2Fimage-dimensions%2F750x162%3Fv%3Dv2%22%20width%3D%22750%22%20height%3D%22162%22%20role%3D%22button%22%20title%3D%22juan_guzman_0-1762879713110.png%22%20alt%3D%22juan_guzman_0-1762879713110.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20measured%20the%20execution%20time%20from%20the%20entry%20into%20the%20USB%20ISR%20to%20the%20USB%20Stack%20callback%20function%20%3CEM%3EUSB_DevicePrinterAppCallback()%3C%2FEM%3E.%20This%20time%20is%3CSTRONG%3E%2013.2%20uS%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22juan_guzman_1-1762880137210.png%22%20style%3D%22width%3A%20659px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22juan_guzman_1-1762880137210.png%22%20style%3D%22width%3A%20659px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F364998iCE1EB961B8B3C113%2Fimage-dimensions%2F659x101%3Fv%3Dv2%22%20width%3D%22659%22%20height%3D%22101%22%20role%3D%22button%22%20title%3D%22juan_guzman_1-1762880137210.png%22%20alt%3D%22juan_guzman_1-1762880137210.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22juan_guzman_2-1762880258513.png%22%20style%3D%22width%3A%20658px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22juan_guzman_2-1762880258513.png%22%20style%3D%22width%3A%20658px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F365000iBFF5387F7BA396FB%2Fimage-dimensions%2F658x122%3Fv%3Dv2%22%20width%3D%22658%22%20height%3D%22122%22%20role%3D%22button%22%20title%3D%22juan_guzman_2-1762880258513.png%22%20alt%3D%22juan_guzman_2-1762880258513.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CP%3EI%20also%20measured%20the%20execution%20of%20the%26nbsp%3B%3CEM%3EUSB_DevicePrinterRecv()%3C%2FEM%3E%2C%20this%20time%20is%26nbsp%3B%3CSTRONG%3E16.0%20uS%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22juan_guzman_3-1762880620465.png%22%20style%3D%22width%3A%20632px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22juan_guzman_3-1762880620465.png%22%20style%3D%22width%3A%20632px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F365003i9BBA75B93C420EFD%2Fimage-dimensions%2F632x147%3Fv%3Dv2%22%20width%3D%22632%22%20height%3D%22147%22%20role%3D%22button%22%20title%3D%22juan_guzman_3-1762880620465.png%22%20alt%3D%22juan_guzman_3-1762880620465.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ESo%20the%20entire%20time%20for%20the%20USB%20Stack%20to%20handle%20a%20Bulk%20frame%20and%20reactivate%20the%20Endpoint%20is%2013.2uS%20%2B%2016uS%20%3D%26nbsp%3B%20%3CSTRONG%3E29.2%20uS.%26nbsp%3B%26nbsp%3B%3C%2FSTRONG%3EThis%20is%20pretty%20much%20in%20line%20to%20what%20I'm%20seeing%20on%20my%20project.%3C%2FP%3E%3CP%3EPlease%20let%20me%20know%20if%20the%20Stack%20can%20be%20optimized%20to%20achieve%20a%20better%20USB%20transfer%20efficiency.%3C%2FP%3E%3CP%3EAttached%20is%20the%20USB%20Analyzer%20trace%20and%20also%20the%20test%20file%20I%20used.%3C%2FP%3E%3CP%3EThank%20You%2C%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2201565%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20LPC5528%20FS%20USB%20Throughput%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2201565%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F12027%22%20target%3D%22_blank%22%3E%40juan_guzman%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EThanks%20for%20your%20question.%3C%2FP%3E%0A%3CP%3ECould%20you%20please%20first%20test%20using%20the%20SDK%20demo%20%3CCODE%3Eprinter_virtual_plain_text%3C%2FCODE%3E%3F%20Also%2C%20please%20measure%20the%20execution%20time.%3C%2FP%3E%0A%3CP%3EIf%20the%20issue%20can%20be%20reproduced%20with%20the%20SDK%20demo%2C%20I%E2%80%99ll%20help%20check%20it%20on%20my%20side.%3C%2FP%3E%0A%3CP%3EThank%20you.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EAlice%3C%2FP%3E%3C%2FLINGO-BODY%3E