Technical Document #55

Technical Document #55        [Product Version: 6.0.0 and above]
Buffer Overrun Error: WDU_Transfer() sometimes returns the 0xC000000C error code. What does this error code mean? How do I solve this problem?

The 0xC000000C error code, is defined in windrvr.h as WD_USBD_STATUS_BUFFER_OVERRUN.

The WD_USBD_XXX status codes returned by WinDriver (see windrvr.h) comply with the URB status codes returned by the low-level USB stack driver (e.g., URB code 0XC000000CL — WD_USBD_STATUS_BUFFER_OVERRUN).
You can refer to the Debug Monitor log to see the URB and IRP values returned from the stack drivers.

For Windows, the URB and IRP codes can be found in the Windows Driver Kit (WDK) under the inc\ directory. The URB status codes can be found in the usbdi.h file or the usb.h file (depending on th e OS). The IRP status codes can be found in the ntstatus.h file. Similar Microsoft documentation exists for Windows CE (a.k.a. Windows Embedded Compact).
For Linux, WinDriver translates the error codes returned from the stack driver into equivalent USBD errors.

For information regarding the specific error you received and when it might occur, review the operating system's documentation.

The USBD_STATUS_BUFFER_OVERRUN error code (0xC000000C) is set by the USB stack drivers when the device transfers more data than requested by the host.

There are two possible solutions for this buffer overrun problem:

  1. Try setting the buffer sizes in the calls to WDU_Transfer in your code to multiples of the maximum packet size. For example, if the maximum packet size is 64 bytes, use buffer sizes that are multiples of 64 (64 bytes, 128 bytes, etc.).

  2. Define a protocol between the device and device driver, making sure that the device does not transfer more data than requested. When you have access to the device firmware code, this solution is recommended.

Notes:

  1. Recheck your firmware and the hardware specification to verify that you are implementing the communication with the device correctly.

  2. It is also recommended to use a USB bus analyzer to determine what is happening on the bus.