USB_DeviceCdcAcmEndpointsInit() ignores failures

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

USB_DeviceCdcAcmEndpointsInit() ignores failures

643 次查看
scottm
Senior Contributor II

This could be considered both a documentation issue and a programming deficiency.  I've got a composite CDC + MSD device that was failing because the endpoint callback array wasn't large enough.  The configuration macro USB_DEVICE_CONFIG_ENDPOINTS sets the number of endpoints supported, but what's not mentioned directly in the docs is that it also determines the maximum endpoint number.  In this case there were 5 endpoints configured with the highest being numbered 5.

The USB_DeviceInitEndpoint() function does check for this condition at runtime, and returns an error.  The documentation is not right (emphasis mine):

kStatus_USB_Invalid-Parameter: The epInit or epCallback is NULL pointer. Or the endpoint number is more
than USB_DEVICE_CONFIG_ENDPOINTS

...but the code is, and it returns an error if the endpoint number is not less than the configured maximum.  The coding issue is in usb_device_cdc_acm.c:  USB_DeviceCdcAcmEndpointsInit() takes the error code but doesn't check it, doesn't stop processing endpoints, and then overwrites the error code when it moves on to the interface initialization.

Not a biggie, but if anyone's taking bug reports, there you go.

Regards,

Scott

标签 (1)
0 项奖励
回复
1 回复

529 次查看
AldoG
NXP TechSupport
NXP TechSupport

Hello Scott,

 

Thank you for the report,

I'll inform the SDK team about this.

 

Best Regards,

Aldo.

0 项奖励
回复