USBCBErrorHandler Function

Microchip USB Device Library

USB Device Library Help
USBCBErrorHandler Function
C
void USBCBErrorHandler();
Description

This callback is called whenever a USB error occurs. (optional) 

The purpose of this callback is mainly for debugging during development. Check UEIR to see which error causes the interrupt.

Preconditions

None

Remarks

No need to clear UEIR to 0 here. Callback caller is already doing that. 

Typically, user firmware does not need to do anything special if a USB error occurs. For example, if the host sends an OUT packet to your device, but the packet gets corrupted (ex: because of a bad connection, or the user unplugs the USB cable during the transmission) this will typically set one or more USB error interrupt flags. Nothing specific needs to be done however, since the SIE will automatically send a "NAK" packet to the host. In response to this, the host will normally retry to send the packet again, and no data loss occurs. The system will typically recover automatically, without the need for application firmware intervention. 

Nevertheless, this callback function is provided, such as for debugging purposes.

Microchip MCHPFSUSB v2.3 - Sept 20, 2008
Copyright © 2008 Microchip Technology, Inc.  All rights reserved.