Error Codes and Solutions

This page lists the various error codes present in µC/USB-Device, their potential causes and some tips to solve the issues they are indicating.

CategoriesValueError CodePotential Cause(s)

Solution(s)

Generic Errors0USBD_ERR_NONENo error, nothing to do.None.
1USBD_ERR_FAILGeneric error occurred.Varies depending where the error occurred.
2USBD_ERR_RX

Generic error occurred during a 'Rx' transfer.

Varies depending where the error occurred.
3USBD_ERR_TXGeneric error occurred during a 'Tx' transfer.Varies depending where the error occurred.
4USBD_ERR_ALLOCGeneric allocation error.The memory segment (or the heap, from uC/LIB) from which the memory is allocated does not have enough space remaining. Try increasing the size of the memory segment or the heap, if possible. If not, try adjusting the configuration values in usbd_cfg.h or app_usbd_cfg.h to better fit the needs of the application.
5USBD_ERR_NULL_PTRNull pointer passed as an argument.See where error occurred and what was the parameter checked.
6USBD_ERR_INVALID_ARGAn invalid argument has been passed to the function.See where error occurred and what was the parameter checked.
7USBD_ERR_INVALID_CLASS_STATEThe class is in an invalid state.See where error occurred and what is the current state of the class.
Device Errors100USBD_ERR_DEV_ALLOC

Tried to allocate more devices than the configured value allows.

USBD_CFG_MAX_NBR_DEV must be increased. This define can be found in usbd_cfg.h.
101USBD_ERR_DEV_INVALID_NBRUnable to obtain device or driver reference based on specified dev_nbr.Make sure dev_nbr is correct.
102USBD_ERR_DEV_INVALID_STATEDevice is in an incorrect state (None, Init, Attached, Default, Addressed, Configured or Suspended) to execute the requested operation.Verify what state the device is currently in and see why it cannot execute the requested operation or why it is in this state.
103USBD_ERR_DEV_INVALID_SPDHigh-speed operation attempted on a driver/controller that does not support high-speed operations.If the controller used support high-speed operations, make sure the speed declared in the driver configuration (USBD_DrvCfg_xxxx) is correct. If the controller used does not support high-speed operations, high-speed operations cannot be executed.
104USBD_ERR_DEV_UNAVAIL_FEATThe feature requested is unavailable in the module used.See where/why the error occurred.
Configuration Errors200USBD_ERR_CFG_ALLOCTried to allocate more USB configuration than the configured value allows.USBD_CFG_MAX_NBR_CFG must be increased. This define can be found in usbd_cfg.h.
201USBD_ERR_CFG_INVALID_NBRUnable to obtain configuration reference based on cfg_nbr or cfg_nbr passed is invalid.Make sure cfg_nbr is correct.
202USBD_ERR_CFG_INVALID_MAX_PWRmax_pwr parameter is invalid.Adjust max_pwr value.
203USBD_ERR_CFG_SET_FAILCall to driver's CfgSet failed.See each driver's CfgSet() function for more details.
Interface Errors300USBD_ERR_IF_ALLOCTried to allocate more USB interfaces than the configured value allows.USBD_CFG_MAX_NBR_IF must be increased. This define can be found in usbd_cfg.h.
301USBD_ERR_IF_INVALID_NBRUnable to obtain interface reference based on if_nbr.Make sure if_nbr is correct.
302USBD_ERR_IF_ALT_ALLOCTried to allocate more USB alternate interfaces than the configured value allows.USBD_CFG_MAX_NBR_IF_ALT must be increased. This define can be found in usbd_cfg.h.
303USBD_ERR_IF_ALT_INVALID_NBRUnable to obtain interface reference based on if_alt_nbr.Make sure if_alt_nbr is correct.
304USBD_ERR_IF_GRP_ALLOCTried to allocate more interface groups than the configured value allows.USBD_CFG_MAX_NBR_IF_GRP must be increased. This define can be found in usbd_cfg.h.
305USBD_ERR_IF_GRP_NBR_IN_USEInterface is already associated with an interface group.Cannot associate an interface to more than one group.
Endpoint Errors400USBD_ERR_EP_ALLOCTried to allocate more endpoints than the configured value allows.USBD_CFG_MAX_NBR_EP_DESC must be increased. This define can be found in usbd_cfg.h.
401USBD_ERR_EP_INVALID_ADDRUnable to obtain endpoint reference based on ep_addr.Make sure ep_addr and dev_nbr are correct.
402USBD_ERR_EP_INVALID_STATEEndpoint is in an invalid state (Close, Open, Stall) to execute requested operation.Verify what state the endpoint is currently in and see why it cannot execute the requested operation or why it is in this state.
403USBD_ERR_EP_INVALID_TYPEEndpoint type (Control, Bulk, Interrupt, Isochronous) is invalid.Make sure the endpoint type matches the type of endpoint of the function called.
404USBD_ERR_EP_NONE_AVAILRequested endpoint is unavailable.Try to adjust the USBD_CFG_MAX_NBR_EP_OPEN (in usbd_cfg.h) constant or see if the driver used supports the endpoint type requested and/or has enough endpoints to open the requested one.
405USBD_ERR_EP_ABORTTransfer has been aborted, or error when aborting.
406USBD_ERR_EP_STALLUnable to execute correctly the stall operation requested.See driver's EP_Stall() function for more details.
407USBD_ERR_EP_IO_PENDINGA transfer is already in progress on the specified endpoint and the core cannot queue the next transfer after it.Avoid executing synchronous transfers on busy endpoints or trying to queue asynchronous transfers after synchronous ones.
408USBD_ERR_EP_QUEUINGUnable to queue URB.Too much asynchronous transfers are queued at the same time, wait for a transfer to finish before submitting another one.
OS Layer Errors500USBD_ERR_OS_INIT_FAILOS layer initialization failed.See OS User's Manual and OS layer where error occurred for more details.
501USBD_ERR_OS_SIGNAL_CREATEOS signal creation failed.See OS User's Manual and OS layer where error occurred for more details.
502USBD_ERR_OS_FAILOS layer operation failed.See OS User's Manual and OS layer where error occurred for more details.
503USBD_ERR_OS_TIMEOUTOS pend/lock operation timed-out.See OS User's Manual and OS layer where error occurred for more details.
504USBD_ERR_OS_ABORTOS pend/lock operation was aborted.See OS User's Manual and OS layer where error occurred for more details.
505USBD_ERR_OS_DELOS layer deletion failed.See OS User's Manual and OS layer where error occurred for more details.
Device Driver Errors700USBD_ERR_DRV_BUF_OVERFLOWDriver indicated that buffer overflowed.See device driver for more details.
701USBD_ERR_DRV_INVALID_PKTDriver indicated an invalid packet has been received.See device driver for more details.
Generic Class Errors1000USBD_ERR_CLASS_INVALID_NBRclass_nbr or sublcass_nbr parameter is invalid.Check the value of class_nbr or subclass_nbr where the error occurred.
1001USBD_ERR_CLASS_XFER_IN_PROGRESSA transfer is already in progress on the endpoint used by the class.Wait for the transfer to completed before executing another one.
Audio Class Errors1100USBD_ERR_AUDIO_INSTANCE_ALLOCTried to allocate more audio class instances than configured values allow.Depending on where the error occurred, either USBD_AUDIO_CFG_MAX_NBR_CFG or USBD_AUDIO_CFG_MAX_NBR_AIC must be increased. These defines can be found in usbd_cfg.h.
1101USBD_ERR_AUDIO_AS_IF_ALLOCTried to allocate more audio streaming interfaces than configured values allow.Depending on where the error occurred, either USBD_AUDIO_CFG_MAX_NBR_CFG, USBD_AUDIO_CFG_MAX_NBR_AICUSBD_AUDIO_CFG_MAX_NBR_AS_IF or USBD_AUDIO_CFG_MAX_NBR_IF_ALT must be increased. These defines can be found in usbd_cfg.h.
1102USBD_ERR_AUDIO_IT_ALLOCTried to allocate more input terminals than configured value allows.USBD_AUDIO_CFG_MAX_NBR_IT must be increased. This define can be found usbd_cfg.h.
1103USBD_ERR_AUDIO_OT_ALLOCTried to allocate more output terminals than configured value allows.USBD_AUDIO_CFG_MAX_NBR_OT must be increased. This define can be found usbd_cfg.h.
1104USBD_ERR_AUDIO_FU_ALLOCTried to allocate more feature units than configured value allows.USBD_AUDIO_CFG_MAX_NBR_FU must be increased. This define can be found usbd_cfg.h.
1105USBD_ERR_AUDIO_MU_ALLOCTried to allocate more mixing units than configured value allows.USBD_AUDIO_CFG_MAX_NBR_MU must be increased. This define can be found usbd_cfg.h.
1106USBD_ERR_AUDIO_SU_ALLOCTried to allocate more selector units than configured value allows.USBD_AUDIO_CFG_MAX_NBR_SU must be increased. This define can be found usbd_cfg.h.
1107USBD_ERR_AUDIO_REQ_INVALID_CTRLUnable to process class request, the ctrl field is invalid/not supported.The audio class will stall the control endpoint to indicate to the host that the device does not support this type of request.
1108USBD_ERR_AUDIO_REQ_INVALID_ATTRIBUnable to process class request, the attrib field is invalid/not supported.The audio class will stall the control endpoint to indicate to the host that the device does not support this type of request.
1109USBD_ERR_AUDIO_REQ_INVALID_RECIPIENTUnable to process class request, the recipient field is invalid/not supported.The audio class will stall the control endpoint to indicate to the host that the device does not support this type of request.
1110USBD_ERR_AUDIO_REQUnable to process class request for any other reason.The audio class will stall the control endpoint to indicate to the host that the device does not support this type of request.
1111USBD_ERR_AUDIO_INVALID_SAMPLING_FRQThe requested sampling frequency is not supported.See specific audio codec's code for setting sampling frequency.
1112USBD_ERR_AUDIO_CODEC_INIT_FAILEDAudio codec initialization failed.See specific audio codec's code for initialization.
CDC Errors1200USBD_ERR_CDC_INSTANCE_ALLOCTried to allocate more CDC instances than configured values allow.Depending on where the error occurred, either USBD_CDC_CFG_MAX_NBR_DEV, USBD_CDC_CFG_MAX_NBR_CFG or USBD_CDC_CFG_MAX_NBR_DATA_IF must be increased. These defines can be found in usbd_cfg.h.
1201USBD_ERR_CDC_DATA_IF_ALLOCTried to allocate more CDC data interfaces than configured values allow.USBD_CDC_CFG_MAX_NBR_DATA_IF must be increased. This define can be found in usbd_cfg.h.
1250USBD_ERR_CDC_SUBCLASS_INSTANCE_ALLOCTried to allocate more instances of a given CDC subclass than configured values allow.USBD_ACM_SERIAL_CFG_MAX_NBR_DEV must be increased. This define can be found in usbd_cfg.h.
HID Class Errors1300USBD_ERR_HID_INSTANCE_ALLOCTried to allocate more HID class instances than configured values allow.Depending on where the error occurred, either USBD_HID_CFG_MAX_NBR_DEV or USBD_HID_CFG_MAX_NBR_CFG must be increased. These defines can be found in usbd_cfg.h.
1301USBD_ERR_HID_REPORT_INVALIDThe format of the report descriptor given as parameter to  USBD_HID_Add() is invalid.See where exactly the error occurred in USBD_HID_Report_Parse() to have more details about the reason the parsing failed.
1302USBD_ERR_HID_REPORT_ALLOCFailed to allocate internal data structure for report descriptor.There can be a few reasons why this failed. You can try increasing USBD_HID_CFG_MAX_NBR_REPORT_ID in usbd_cfg.h, or see if an invalid parameter has been passed to function USBD_HID_ReportID_Get().
1303USBD_ERR_HID_REPORT_PUSH_POP_ALLOCFailed to allocate internal data structure for push-pop item.USBD_HID_CFG_MAX_NBR_REPORT_PUSHPOP must be increased. This define can be found in usbd_cfg.h.
MSC Errors1400USBD_ERR_MSC_INSTANCE_ALLOCTried to allocate more MSC instances than configured values allow.Depending on where the error occurred, either USBD_MSC_CFG_MAX_NBR_DEV or USBD_MSC_CFG_MAX_NBR_CFG must be increased. These defines can be found in usbd_cfg.h.
1401USBD_ERR_MSC_INVALID_CBWCommand Block Wrapper (CBW) received by the internal MSC task is invalid.The CBW content contains an error or its length is incorrect. The MSC class will report to the host through the CSW that the SCSI command has failed and the host will take the proper action to continue.
1402USBD_ERR_MSC_INVALID_DIRMismatch between direction indicated by CBW and the SCSI command.The MSC class will report to the host through the CSW that the SCSI command has failed and the host will take the proper recovery action.
1403USBD_ERR_MSC_MAX_LUN_EXCEEDNo more logical unit can be added to the MSC class.USBD_MSC_CFG_MAX_LUN must be increased. This define can be found in  usbd_cfg.h .
1404USBD_ERR_MSC_MAX_VEN_ID_LEN_EXCEEDVendor ID string associated to a logical unit is too long.Shorten your vendor string to be less than or equal to 8 characters.
1405USBD_ERR_MSC_MAX_PROD_ID_LEN_EXCEEDProduct ID string associated to a logical unit is too long.Shorten your vendor string to be less than or equal to 16 characters.
1406USBD_ERR_SCSI_UNSUPPORTED_CMDSCSI command not recognized.The host has sent a SCSI command not supported by MSC (Refer to section SCSI Commands for supported SCSI commands). The MSC class will report to the host through the CSW that the SCSI command has failed. The host will take the proper action.
1407USBD_ERR_SCSI_MORE_DATARead or write SCSI command requires more data to be read or written.The MSC class will read more data from the storage medium to send it to the host or will wait for data from host to write it to the storage medium.
1408USBD_ERR_SCSI_LU_NOTRDYLogical unit not ready to perform any operations.For any reason, the storage layer has returned that the logical unit is not ready to be accessed. The MSC class will report to the host through the CSW that the SCSI command has failed. The host may send periodically the TEST_UNIT_READY SCSI command until the logical unit is ready to be accessed.
1409USBD_ERR_SCSI_LU_NOTSUPPORTEDLogical unit number not supported.The storage layer reports that the logical unit number does not exist. The MSC class will report to the host through the CSW that the SCSI command has failed. The host should stop trying to access the logical unit number.
1410USBD_ERR_SCSI_LU_BUSYLogical unit number is busy with other operations.For any reason, the storage layer has returned that the logical unit is occupied with an operation in progress. The MSC class will report to the host through the CSW that the SCSI command has failed. The host may send periodically the TEST_UNIT_READY SCSI command until the logical unit has finished its ongoing operation.
1411USBD_ERR_SCSI_LOG_BLOCK_ADDRLogical block address out of range when host asks the device to test one or more sectors.The MSC class will report to the host through the CSW that the SCSI command has failed. The host should not try to access again this sector.
1412USBD_ERR_SCSI_MEDIUM_NOTPRESENTRemovable storage medium is not present.When an MSC device has a fixed storage medium, this one is always present. For MSC devices with a removable storage medium, upon connection to the PC, the medium may not be present. In that case, the MSC class will report to the host through the CSW that the SCSI command has failed. The host may send periodically the TEST_UNIT_READY SCSI command until the storage medium is inserted.
1413USBD_ERR_SCSI_MEDIUM_NOT_RDY_TO_RDYThe storage medium is transitioning to the ready state.The storage medium cannot accept yet to be accessed by the host because it changes its internal state. In that case, the storage layer returns this error code. The MSC class will report to the host through the CSW that the SCSI command has failed. The host may send periodically the TEST_UNIT_READY SCSI command until the storage medium has completed its transition to the ready state.
1414USBD_ERR_SCSI_MEDIUM_RDY_TO_NOT_RDYThe storage medium is transitioning to the not ready state.The storage medium won't accept anymore to be accessed by the host because it changes its internal state. In that case, the storage layer returns this error code. T he MSC class will report to the host through the CSW that the SCSI command has failed. The host may send periodically the TEST_UNIT_READY SCSI command until the storage medium is afresh in the ready state.
1415USBD_ERR_SCSI_LOCKLocking a storage medium has failed.

When the host accesses a storage medium, it becomes the only owner of this storage. No embedded file system application can access this storage. The ownership is guaranteed with a lock system. If the lock cannot be acquired, it means that an embedded file system application has the storage ownership. The MSC will report to the host through the CSW that the SCSI command has failed. The host should attempt again the SCSI command until the lock can be acquired.

1416USBD_ERR_SCSI_LOCK_TIMEOUTLocking a storage medium has timeout.If the lock is acquired, an embedded file system application has the storage ownership. The MSC class attempts acquiring the lock during a certain period of time. When this time period has elapsed, the lock attempt timeouts. The MSC will report to the host through the CSW that the SCSI command has failed. The host should attempt again the SCSI command until the lock can be acquired.
1417USBD_ERR_SCSI_UNLOCKUnlocking the medium storage has failed.The MSC class was not able to release the storage ownership. The MSC will report to the host through the CSW that the SCSI command has failed. The host should attempt again the SCSI command until the lock release succeeds.
PHDC Errors1500USBD_ERR_PHDC_INSTANCE_ALLOCTried to allocate more PHDC instances than configured values allow.Depending on where the error occurred, either USBD_PHDC_CFG_MAX_NBR_DEV or USBD_PHDC_CFG_MAX_NBR_CFG must be increased. These defines can be found in usbd_cfg.h.
Vendor Errors1600USBD_ERR_VENDOR_INSTANCE_ALLOCTried to allocate more Vendor class instances than configured values allow.Depending on where the error occurred, either USBD_VENDOR_CFG_MAX_NBR_DEV or USBD_VENDOR_CFG_MAX_NBR_CFG must be increased. These defines can be found in usbd_cfg.h.