usign UART when configuring a Xilinx FPGA Over FX3

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
agba_3844561
Level 3
Level 3
5 likes given First like given

So I have successfully followed the steps on AN84868.

Image7.png

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:

Image3.png

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.

Image1.png

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.

Image2.png

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,

0 Likes
1 Solution
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello,

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

View solution in original post

0 Likes
2 Replies
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello,

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

0 Likes

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

Result:

2019-01-14.png

0 Likes