Bug in Cy_USBFS_Dev_Drv_Disable() Function of USBFS v1.0 Driver - KBA225989

Version 5

    Author: SergiiV_71         Version: **


    Translation - Japanese: USBFS v1.0 ドライバ Cy_USBFS_Dev_Drv_Disable() 関数のバグ - KBA225989 - Community Translated (JA)


    Question: Why fault occurs when Cy_USBFS_Dev_Drv_Disable() is called with USBFS driver endpoint management mode configured to CPU Manual?



    the Cy_USBFS_Dev_Drv_Disable() calls an internal function to disable all DMA channels without checking endpoint management mode. For CPU Manual mode, the DMA channels are not allocated and DMA function is called with incorrect arguments, which causes a fault. To work-around this issue, implement disable function as provided below:

    void Cy_USBFS_Dev_Drv_Disable_CpuMode(USBFS_Type *base, cy_stc_usbfs_dev_drv_context_t *context)


        /* Suppress a compiler warning about unused variables */

        (void) context;


        /* Disable D+ pull-up */


        (void) USBFS_DEV_LPM_POWER_CTL(base);


        /* Disable device to respond to usb traffic */



    This issue in the USBFS driver also has impact on the USB Device middleware, because Cy_USB_Dev_Disconnect() function calls Cy_USBFS_Dev_Drv_Disable() function. To work-around this issue, implement disconnect function as provided below:

    void Cy_USB_Dev_Disconnect_CpuMode(cy_stc_usb_dev_context_t *context)


        /* Disable D+ pull-up */


        (void) USBFS_DEV_LPM_POWER_CTL(context->drvBase);


        /* Disable device to respond to usb traffic */

        USBFS_DEV_CR0(context->drvBase) &= ~USBFS_USBDEV_CR0_USB_ENABLE_Msk;


        /* Set device in the default state */

        context->state   = CY_USB_DEV_DISABLED;

        context->address = 0U;

        context->configuration  = 0U;



    The defect in the Cy_USBFS_Dev_Drv_Disable() function will be fixed in the next release of the Peripheral Driver Library.