Error Codes and Solutions

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.

Categories

Value

Error Code

Potential Cause(s)

Solution(s)

Generic Errors

0

USBD_ERR_NONE

No error, nothing to do.

None.

1

USBD_ERR_FAIL

Generic error occurred.

Varies depending where the error occurred.

2

USBD_ERR_RX

Generic error occurred during a 'Rx' transfer.

Varies depending where the error occurred.

3

USBD_ERR_TX

Generic error occurred during a 'Tx' transfer.

Varies depending where the error occurred.

4

USBD_ERR_ALLOC

Generic 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.

5

USBD_ERR_NULL_PTR

Null pointer passed as an argument.

See where error occurred and what was the parameter checked.

6

USBD_ERR_INVALID_ARG

An invalid argument has been passed to the function.

See where error occurred and what was the parameter checked.

7

USBD_ERR_INVALID_CLASS_STATE

The class is in an invalid state.

See where error occurred and what is the current state of the class.

Device Errors

100

USBD_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.

101

USBD_ERR_DEV_INVALID_NBR

Unable to obtain device or driver reference based on specified dev_nbr.

Make sure dev_nbr is correct.

102

USBD_ERR_DEV_INVALID_STATE

Device 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.

103

USBD_ERR_DEV_INVALID_SPD

High-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.

104

USBD_ERR_DEV_UNAVAIL_FEAT

The feature requested is unavailable in the module used.

See where/why the error occurred.

Configuration Errors

200

USBD_ERR_CFG_ALLOC

Tried 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.

201

USBD_ERR_CFG_INVALID_NBR

Unable to obtain configuration reference based on cfg_nbr or cfg_nbr passed is invalid.

Make sure cfg_nbr is correct.

202

USBD_ERR_CFG_INVALID_MAX_PWR

max_pwr parameter is invalid.

Adjust max_pwr value.

203

USBD_ERR_CFG_SET_FAIL

Call to driver's CfgSet failed.

See each driver's CfgSet() function for more details.

Interface Errors

300

USBD_ERR_IF_ALLOC

Tried 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.

301

USBD_ERR_IF_INVALID_NBR

Unable to obtain interface reference based on if_nbr.

Make sure if_nbr is correct.

302

USBD_ERR_IF_ALT_ALLOC

Tried 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.

303

USBD_ERR_IF_ALT_INVALID_NBR

Unable to obtain interface reference based on if_alt_nbr.

Make sure if_alt_nbr is correct.

304

USBD_ERR_IF_GRP_ALLOC

Tried 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.

305

USBD_ERR_IF_GRP_NBR_IN_USE

Interface is already associated with an interface group.

Cannot associate an interface to more than one group.

Endpoint Errors

400

USBD_ERR_EP_ALLOC

Tried 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.

401

USBD_ERR_EP_INVALID_ADDR

Unable to obtain endpoint reference based on ep_addr.

Make sure ep_addr and dev_nbr are correct.

402

USBD_ERR_EP_INVALID_STATE

Endpoint 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.

403

USBD_ERR_EP_INVALID_TYPE

Endpoint type (Control, Bulk, Interrupt, Isochronous) is invalid.

Make sure the endpoint type matches the type of endpoint of the function called.

404

USBD_ERR_EP_NONE_AVAIL

Requested 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.

405

USBD_ERR_EP_ABORT

Transfer has been aborted, or error when aborting.

 

406

USBD_ERR_EP_STALL

Unable to execute correctly the stall operation requested.

See driver's EP_Stall() function for more details.

407

USBD_ERR_EP_IO_PENDING

A 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.

408

USBD_ERR_EP_QUEUING

Unable 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 Errors

500

USBD_ERR_OS_INIT_FAIL

OS layer initialization failed.

See OS User's Manual and OS layer where error occurred for more details.

501

USBD_ERR_OS_SIGNAL_CREATE

OS signal creation failed.

See OS User's Manual and OS layer where error occurred for more details.

502

USBD_ERR_OS_FAIL

OS layer operation failed.

See OS User's Manual and OS layer where error occurred for more details.

503

USBD_ERR_OS_TIMEOUT

OS pend/lock operation timed-out.

See OS User's Manual and OS layer where error occurred for more details.

504

USBD_ERR_OS_ABORT

OS pend/lock operation was aborted.

See OS User's Manual and OS layer where error occurred for more details.

505

USBD_ERR_OS_DEL

OS layer deletion failed.

See OS User's Manual and OS layer where error occurred for more details.

Device Driver Errors

700

USBD_ERR_DRV_BUF_OVERFLOW

Driver indicated that buffer overflowed.

See device driver for more details.

701

USBD_ERR_DRV_INVALID_PKT

Driver indicated an invalid packet has been received.

See device driver for more details.

Generic Class Errors

1000

USBD_ERR_CLASS_INVALID_NBR

class_nbr or sublcass_nbr parameter is invalid.

Check the value of class_nbr or subclass_nbr where the error occurred.

1001

USBD_ERR_CLASS_XFER_IN_PROGRESS

A transfer is already in progress on the endpoint used by the class.

Wait for the transfer to completed before executing another one.

Audio Class Errors

1100

USBD_ERR_AUDIO_INSTANCE_ALLOC

Tried 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.

1101

USBD_ERR_AUDIO_AS_IF_ALLOC

Tried 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.

1102

USBD_ERR_AUDIO_IT_ALLOC

Tried 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.

1103

USBD_ERR_AUDIO_OT_ALLOC

Tried 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.

1104

USBD_ERR_AUDIO_FU_ALLOC

Tried 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.

1105

USBD_ERR_AUDIO_MU_ALLOC

Tried 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.

1106

USBD_ERR_AUDIO_SU_ALLOC

Tried 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.

1107

USBD_ERR_AUDIO_REQ_INVALID_CTRL

Unable 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.

1108

USBD_ERR_AUDIO_REQ_INVALID_ATTRIB

Unable 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.

1109

USBD_ERR_AUDIO_REQ_INVALID_RECIPIENT

Unable 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.

1110

USBD_ERR_AUDIO_REQ

Unable 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.

1111

USBD_ERR_AUDIO_INVALID_SAMPLING_FRQ

The requested sampling frequency is not supported.

See specific audio codec's code for setting sampling frequency.

1112

USBD_ERR_AUDIO_CODEC_INIT_FAILED

Audio codec initialization failed.

See specific audio codec's code for initialization.

CDC Errors

1200

USBD_ERR_CDC_INSTANCE_ALLOC

Tried 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.

1201

USBD_ERR_CDC_DATA_IF_ALLOC

Tried 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.

1250

USBD_ERR_CDC_SUBCLASS_INSTANCE_ALLOC

Tried 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 Errors

1300

USBD_ERR_HID_INSTANCE_ALLOC

Tried 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.

1301

USBD_ERR_HID_REPORT_INVALID

The 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.

1302

USBD_ERR_HID_REPORT_ALLOC

Failed 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().

1303

USBD_ERR_HID_REPORT_PUSH_POP_ALLOC

Failed 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 Errors

1400

USBD_ERR_MSC_INSTANCE_ALLOC

Tried 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.

1401

USBD_ERR_MSC_INVALID_CBW

Command 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.

1402

USBD_ERR_MSC_INVALID_DIR

Mismatch 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.

1403

USBD_ERR_MSC_MAX_LUN_EXCEED

No 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 .

1404

USBD_ERR_MSC_MAX_VEN_ID_LEN_EXCEED

Vendor ID string associated to a logical unit is too long.

Shorten your vendor string to be less than or equal to 8 characters.

1405

USBD_ERR_MSC_MAX_PROD_ID_LEN_EXCEED

Product ID string associated to a logical unit is too long.

Shorten your vendor string to be less than or equal to 16 characters.

1406

USBD_ERR_SCSI_UNSUPPORTED_CMD

SCSI 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.

1407

USBD_ERR_SCSI_MORE_DATA

Read 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.

1408

USBD_ERR_SCSI_LU_NOTRDY

Logical 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.

1409

USBD_ERR_SCSI_LU_NOTSUPPORTED

Logical 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.

1410

USBD_ERR_SCSI_LU_BUSY

Logical 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.

1411

USBD_ERR_SCSI_LOG_BLOCK_ADDR

Logical 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.

1412

USBD_ERR_SCSI_MEDIUM_NOTPRESENT

Removable 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.

1413

USBD_ERR_SCSI_MEDIUM_NOT_RDY_TO_RDY

The 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.

1414

USBD_ERR_SCSI_MEDIUM_RDY_TO_NOT_RDY

The 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.

1415

USBD_ERR_SCSI_LOCK

Locking 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.

1416

USBD_ERR_SCSI_LOCK_TIMEOUT

Locking 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.

1417

USBD_ERR_SCSI_UNLOCK

Unlocking 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 Errors

1500

USBD_ERR_PHDC_INSTANCE_ALLOC

Tried 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 Errors

1600

USBD_ERR_VENDOR_INSTANCE_ALLOC

Tried 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.