Using CyU3PDebugPrint API to Send Debug Messages over USB-CDC Interface from FX3 Firmware – KBA231478

Version 5

    Author: HemanthR_06           Version: **

     

    Translation - Japanese: CyU3PDebugPrint APIを使用して、FX3ファームウェアからUSB-CDCインターフェースを介してデバッグメッセージを送信する - KBA231478 - Community Translated (JA)

     

    This article is based on the project attached to AN75779 - How to Implement an Image Sensor Interface Using EZ-USB® FX3™ in a USB Video Class (UVC) Framework. To use this article, you should download and extract the ZIP file associated with this article.

    The CyU3PDebugPrint API  can be used to send debug messages to the host over the USB-CDC interface instead of using a dedicated onboard UART-USB bridge device. To do this, the following changes are made to the AN75779 firmware.

     

    1. Added a CDC interface to Hi-Speed and SuperSpeed configuration descriptors in cyfxuvcdscr.c.
    2. Created an RTOS thread (cdcThread).
    3. Added CDC class request handling to CyFxUVCApplnUSBSetupCB().
    4. Defined the DebugInit() function, which does the following:

    a. Configure the endpoints required for the CDC interface.

    b. Call CyU3PDebugInit() by passing the USB consumer socket as argument. Doing this allows the use of the CyU3PDebugPrint API function for sending debug messages over the CDC interface.

    This function is called when the SET_CONFIGURATION event occurs in CyFxUVCApplnUSBEventCB().

    When the firmware with these changes is programmed to the FX3 device, the following devices get enumerated in the host which can be seen in Device Manager as follows:

    The following debug messages appear in the terminal:

     

    The message “cdc-debug-enabled” appears because of the following code in the firmware. You can change this according to your application.

     

     

    Note:

    1. The UART block is initialized in this project, but not used.
    2. If data from the USB Bulk-IN end point of the CDC interface (EP5 in this project) must be sent to the UART block of FX3, enable the ENABLE_CDC_USB_TO_UART_CHANNEL macro in uvc.h. Doing so will configure the USB-to-UART Auto DMA channel.