2 Replies Latest reply on Jan 14, 2019 9:29 AM by agba_3844561

    usign UART when configuring a Xilinx FPGA Over FX3


      So I have successfully followed the steps on AN84868.


      However I wanted to use TERA TERM to print some messages via UART in order to fully understand the firmware code and do some debugging.

      I opened the code with EZ-USB Suite and to my amusement it seams the code already prints some debug messages. For example it has the following line on CyU3PReturnStatus_t CyFxConfigFpga(uint32_t uiLen) function:


      CyU3PDebugPrint (6, "file length: %d\n", uiLen);


      So I concluded I just needed to connect the the micro USB 2.0 (UART) to the computer and it will print some messages. If I have both cables (USB3 and micro-USB) connected before opening the FPGA Configuration Utility it fails although all the steps seams to work OK:




      If I do everything without connecting the micro USB and then just connect the micro USB cable before hitting configure, a new message of "FX3 - Xilinx Slave Serial Programmer detected" appears and I have to re-select the bin firmware of the FPGA. Needless to say, the programming fails after re-selecting the bin file and hitting configure.




      I believe the FPGA Configuration Utility mixes the micro USB as an equivalent to the USB3 cable and doesn't know which one to use to send the FPGA firmware. In the following image, every red square is printed when I connect the micro-USB.




      Steps to reproduce the image above:

      1. Connect the USB3

      2. Connect micro-USB

      3. Disconnect  USB3.

      4. Disconnect micro-USB

      5. Connect USB3

      6. Connect micro-USB

      7. Program the FX3 device with the "Download Firmware" button

      8. Disconnect micro-USB

      9. Reconnect micro-USB

      10. Repeat from 8.


      Is it a way to do what I want? Program the FPGA via de FX3 and see some UART messages with any program like TERA TERM?


      Thank you very much,

        • 1. Re: usign UART when configuring a Xilinx FPGA Over FX3



          Explanation for why messages pointed in the red square gets printed:

          - The FPGA Configuration Utility has been coded in such a way that any device that is bound to the CYUSB3 driver generates a device attach/detach event.


          /* This statement includes all devices bound to the CYUSB3 driver to the usbDevices list. */

          usbDevices = new USBDeviceList(CyConst.DEVICES_CYUSB); //


          /* This statement registers a device attach event for all devices in 'usbDevices' list */

          usbDevices.DeviceAttached += new EventHandler(usbDevices_DeviceAttached);


          - The USB-Serial device (CY7C65215 on the SuperSpeed Explorer Kit) has got vendor interfaces which binds to the CYUSB3 driver. Also, the FX3 device gets bound to the CYUSB3 driver. Connection of both these devices generate the device attach event.

          - Upon looking into the 'device attach' event code, it can be seen that there are two statements: one to check if the FX3 boot-loader is present and one to check if the Xilinx Slave Serial programmer is present.

          /* To check the presence of Xilinx Slave Serial Programmer */

          myDevice = usbDevices[0x04b4, 0x00F1] as CyUSBDevice;              


          /* To check the presence of FX3 boot-loader */

          myFX3Device = usbDevices[0x04B4, 0x00F3] as CyFX3Device;


          - When the below sequence is followed,

               -> Connect FX3 device          =>     Boot-loader is detected and stored in the variable myFX3Device

               -> Connect USB-Serial device (USB micro-B cable)     =>     myFX3Device still holds the previous device instance

               -> Program FX3 device with the firmware     =>     Xilinx Slave Serial Programmer is detected and stored in the variable myDevice

               -> Subsequent connection of USB-Serial device (USB micro-B cable)     =>     myDevice still holds the previous device instance

          - This the reason why the statements get printed repeatedly on the utility window upon connection of the USB3 and USB micro-B cables.


          Explanation for the failure of FPGA programming:

          - The application note firmware configures the IO matrix such that it uses 16-bit GPIF II along with SPI and UART. For this configuration, the UART lines are available on the pins GPIO[46:49] and SPI is available on pins GPIO[53:56]. But, the on-board USB-Serial device (CY7C65215) UART is connected to the GPIO[53:56] pins of FX3. So, when the configure option is chosen from the utility, FX3 finds the FPGA as well as the USB-Serial device (CY7C65215) connected on the GPIO[53:56] and hence the configuration fails. So, in order to debug the firmware over UART, please use the GPIO[46:49] with a separate UART device and no with the on-board USB-Serial device (CY7C65215).


          Please let me know if you need further clarification.


          Best regards,

          Srinath S

          • 2. Re: usign UART when configuring a Xilinx FPGA Over FX3

            I've tried what you said and using those pins worked. I'm getting the messages over UART now. Thank you.