USB CDC VCOM User defined device example consecutive RX fail

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

USB CDC VCOM User defined device example consecutive RX fail

Jump to solution
1,322 Views
akspurr
Contributor II

Hello,

Recently I worked through your very useful user defined device class application note, based on the cdc_vcom example: https://www.nxp.com/docs/en/application-note/AN14169.pdf


The code is functioning as I would expect, except for when I modify the AppTask to receive multiple packets prior to sending a response back to the host.


It seems that the USB stack forces a Send for every Recv, something which other users have noted (e.g https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/ESC-character-in-virtual-com-port-example/m-p/11...).

Is there a way to modify the stack to allow for multiple consecutive Recv?

Thanks,

Alex 

Labels (1)
0 Kudos
Reply
1 Solution
1,302 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @akspurr,

Unfortunately, the stack is designed to do a send after every receive by design, so no modifications should be made to the USB stack to prevent this behavior.

BR,
Edwin.

View solution in original post

0 Kudos
Reply
2 Replies
1,303 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @akspurr,

Unfortunately, the stack is designed to do a send after every receive by design, so no modifications should be made to the USB stack to prevent this behavior.

BR,
Edwin.

0 Kudos
Reply
1,287 Views
akspurr
Contributor II

Hi @EdwinHz,

Ah, I see, in that case I'll keep a workaround in place.

Thanks for the fast reply, you've saved me a lot of debugging time!.

Cheers,

Alex 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2028230%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EUSB%20CDC%20VCOM%20User%20defined%20device%20example%20consecutive%20RX%20fail%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2028230%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3ERecently%20I%20worked%20through%20your%20very%20useful%20user%20defined%20device%20class%20application%20note%2C%20based%20on%20the%20cdc_vcom%20example%3A%20%3CA%20href%3D%22https%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fapplication-note%2FAN14169.pdf%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fapplication-note%2FAN14169.pdf%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EThe%20code%20is%20functioning%20as%20I%20would%20expect%2C%20except%20for%20when%20I%20modify%20the%20AppTask%20to%20receive%20multiple%20packets%20prior%20to%20sending%20a%20response%20back%20to%20the%20host.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EIt%20seems%20that%20the%20USB%20stack%20forces%20a%20Send%20for%20every%20Recv%2C%20something%20which%20other%20users%20have%20noted%20(e.g%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fi-MX-RT-Crossover-MCUs%2FESC-character-in-virtual-com-port-example%2Fm-p%2F1154247%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fi-MX-RT-Crossover-MCUs%2FESC-character-in-virtual-com-port-example%2Fm-p%2F1154247%3C%2FA%3E).%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20there%20a%20way%20to%20modify%20the%20stack%20to%20allow%20for%20multiple%20consecutive%20Recv%3F%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%2C%3C%2FP%3E%3CP%3EAlex%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2028230%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3Ei.MXRT%20105x%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2029041%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20USB%20CDC%20VCOM%20User%20defined%20device%20example%20consecutive%20RX%20fail%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2029041%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F186731%22%20target%3D%22_blank%22%3E%40EdwinHz%3C%2FA%3E%2C%3C%2FP%3E%3CP%3EAh%2C%20I%20see%2C%20in%20that%20case%20I'll%20keep%20a%20workaround%20in%20place.%3C%2FP%3E%3CP%3EThanks%20for%20the%20fast%20reply%2C%20you've%20saved%20me%20a%20lot%20of%20debugging%20time!.%3C%2FP%3E%3CP%3E%3CSPAN%3ECheers%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EAlex%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2028513%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20USB%20CDC%20VCOM%20User%20defined%20device%20example%20consecutive%20RX%20fail%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2028513%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F245587%22%20target%3D%22_blank%22%3E%40akspurr%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EUnfortunately%2C%20the%20stack%20is%20designed%20to%20do%20a%20send%20after%20every%20receive%20by%20design%2C%20so%20no%20modifications%20should%20be%20made%20to%20the%20USB%20stack%20to%20prevent%20this%20behavior.%3C%2FP%3E%0A%3CP%3EBR%2C%3CBR%20%2F%3EEdwin.%3C%2FP%3E%3C%2FLINGO-BODY%3E