cancel
Showing results for 
Search instead for 
Did you mean: 

Knowledge Base Articles

Handling CY_U3P_USB_EVENT_LMP_EXCH_FAIL Event from FX3 SDK during USB Enumeration - KBA225778

chaitanyav_41
Employee

Handling CY_U3P_USB_EVENT_LMP_EXCH_FAIL Event from FX3 SDK during USB Enumeration - KBA225778

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.

Attachments
0 Likes
Version history
Revision #:
1 of 1
Last update:
‎Dec 03, 2018 09:42 PM
Updated by:
 
Contributors