Handling CY_U3P_USB_EVENT_LMP_EXCH_FAIL Event from FX3 SDK during USB Enumeration - KBA225778
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Version: **
Translation - Japanese: USBエニュメレート中のFX3 SDKからのCY_U3P_USB_EVENT_LMP_EXCH_FAILイベントの処理 - KBA225778 - Community Translated (JA)
Question:
How to handle CY_U3P_USB_EVENT_LMP_EXCH_FAIL event during USB enumeration from the FX3 SDK?
Answer:
FX3 SDK signals the CY_U3P_USB_EVENT_LMP_EXCH_FAIL event to the user application when either of Port Capability Request or Port Configuration Request from the host is timed out. Cypress recommends a USB Interface Block restart in the user application while handling this event.
The following steps show how to handle the event for a sample application project:
1.Configure the USB Event callback to set a custom flag CY_FX_USB_RESTART_EVT_FLAG to the main application event on receiving the CY_U3P_USB_EVENT_LMP_EXCH_FAIL event.
case CY_U3P_USB_EVENT_LMP_EXCH_FAIL:
CyU3PEventSet (&glApplnEvent, CY_FX_USB_RESTART_EVT_FLAG, CYU3P_EVENT_OR);
break;
2. Use the CyU3PEventGet API to receive the custom event flag (CY_FX_USB_RESTART_EVT_FLAG) in the application thread entry function. Note that the event mask (evMask) should be configured to receive the CY_FX_USB_RESTART_EVT_FLAG. The CyFxAppUsbRestart() function reinitializes the USB Interface Block. The source code of CyFxAppUsbRestart() is included in the attached sample project.
/* USB block restart request */
#define CY_FX_USB_RESTART_EVT_FLAG (1 << 3)
.
.
.
/* Event Mask configuration */
uint32_t evMask = CY_FX_SETCONF_EVENT_FLAG | CY_FX_RESET_EVENT_FLAG | CY_FX_USB_RESTART_EVT_FLAG;
.
.
.
.
/* Handling the custom event in application thread */
for (;;)
{
status = CyU3PEventGet (&glApplnEvent, evMask, CYU3P_EVENT_OR_CLEAR, &evStat, CYU3P_WAIT_FOREVER);
if (status == CY_U3P_SUCCESS)
{
if (evStat & CY_FX_USB_RESTART_EVT_FLAG)
{
CyFxAppUsbRestart ();
}
.
.
.
Note:
These steps are applicable to FX3, FX3S, CX3 and SD3.
The attachment, USBBulkLoopAuto.zip, is the modified version of the USBBulkLoopAuto FX3 SDK example project. Search for HANDLE_LMP_EXCH_FAIL_EVT in the cyfxbulklpauto.c file for the relevant modifications.
- Tags:
- cy_u3p_usb_event_lmp_exch_fail
- cyusb301x
- cyusb302x
- cyusb303x
- cyusb306x
- enumeration
- errata
- firmware
- fx3
- fx3 sdk
- fx3s
- port capability timeout
- port configuration timeout
- sdk 1.3.4
- usb 3.0