GECKO3COM defines the communication between the GECKO3main and a USB Master e.g. a computer.
The USB master communicates over the EZ-USB with the FPGA or the flash. This is used to configure the FPGA (download your project into the FPGA) or download your project into the flash (to use the GECKO3main stand-alone without a USB connection). It allows you further to exchange data between the FPGA and any master USB.
GECKO3COM uses a USB standard class, USBTMC, this makes is easy to send and receive data from the FPGA to Matlab or Labview!
Firmware EEPROM file: gecko3com_1.0.zip
The aim of this kind of communication is to use standard commands for different products based on GECKO3 modules.
When you for example develop a function generator on the GECKO3main, it would implement the standard commands for a function generator referring to SCPI. You don't have to reinvent the wheel every time and it makes it easier to learn how to use your function generator or to use it in combination with other devices.
Matlab and Labview can use GECKO3COM functionality over the VISA (Virtual Instrument Software Architecture) API.
VISA is a part of the Agilent IO Libraries Suite (E2094P) that comes with NI LabVIEW.
The VISA API is optimized for use from C and C++ and can also be used from Visual Basic and other environments that can call arbitrary Windows DLLs.
Agilent provides header files to facilitate the use of VISA in Microsoft Visual Basic 6, Visual Basic .NET and C#. Agilent VISA User’s Guide (pdf)
Matlab offers the Instrument Control Toolbox to communicate with the GECKO3COM.
On Linux you can use the VISA API or normal file I/O (echo, cat in a shell or fopen(), fprintf() in C) with the USB-TMC driver.
Read the installation manual for your operating system:
All commands understood by the GECKO3COM are listed in the Command reference
The Standard Commands for Programmable Instruments defines a standard set of commands to control programmable test and measurement devices. The physical communication link is not defined by SCPI. In our case this is USBTMC. SCPI commands are ASCII textual strings as defined by IEEE488. SCPI 99 Standard
This standard was defined for communicating with devices and is also known as GPIB or HP-IB. This original standard defines the protocol, the physical layer as well the connector. In the GECKO3COM system we use USBTMC instead of the GPIB physical layer, other modern interfaces are LXI (Ethernet) and PXI (PCI). The higher level protocol definition of IEEE 488 is used on these interfaces, this includes structure of a message, number and unit representation error handling and other essentials.
Test and Measurement Class is the IEEE 488 (General Purpose Interface Bus) protocol built on top of the USB protocol.
From the user's point of view, the USB device behaves just like an older GPIB device but with the full speed of USB. The ASCII based message communication still remains IEEE 488 and SCPI.
The exchange interaction is Host to Slave, the computer is always the host and the GECKO3main the slave.
The GECKO3main module contains a EZ-USB processor to control the USB traffic. The EZ-USB acts as a command splitter.
After the start up of a GECKO3main, the system is by default in the state where it listens on the USB port for TMC (see USBTMC) or DFU commands. The EZ-USB interprets and executes the commands. Since the FPGA is in this case empty no commands or data are forwarded from the USB to the FPGA.
fpga:data switches the context from the EZ-USB to the FPGA.
The FPGA should be programmed at this time to be able to interpret IEE488 commands.
The DFU (Device Firmware Upgrade Class) protocol allows to update the firmware stored in the EZ-USB EEPROM on the GECKO3main.
The firmware is a part of GECKO3COM which is a subproject of the GECKO3 project, you can find it inside our opencores.org repository (GECKO3COM/gecko3com-fw). The communication module compose several elements. One part is the firmware for the EZ-USB and an other part are IP-Cores which provide the user with a communication interface for transferring data the PC and the FPGA over USB by using the USBTMC protocol.
On a Linux based OS the tool called
dfu-util is available that can be used for this purpose. If you have only one DFU capable device connected (e.g. one GECKO3main) use the following command for upgrading the firmware.
The command required for upgrading the firmware is the following, in case the “*.iic” file is named “gecko3com”.
sudo dfu-util -R -D <path to new firmware>/gecko3com.iic
Follow these steps to update the Firmware in the EZ-USB EEPROM: First, find the ID of the FX2 using lsusb.
Bus 002 Device 007: ID 4705:0002 or
Bus 002 Device 013: ID 04b4:8613 Cypress Semiconductor Corp. CY7C68013 EZ-USB FX2 USB 2.0 Development Kit
If you are unsure which of the devices is the FX2 try, to unplug and replug the Gecko and check which Device appears / disappears in the list.
Find out whether the firmware of the Gecko already allows for firmware update.
sudo dfu-util -l
Check if the list returned contains the ID of the FX2 that you have found before with lsusb. If so, you can proceed to Firmwaredownload using th dfu-util. If not, you have to load an initial firmware with fxload first.
sudo fxload -t fx2 -s /usr/share/usb/a3load.hex -I <path_to_firmware_hex>gecko3com_0_31.hex -D /dev/bus/usb/002/013
Note: Use the bus and device number you've found before with lsusb instead of the example given above.
Now, use the dfu-util to download the firmware to the Gecko:
sudo dfu-util --device 4705:0002 -R -D <path_to_firmware>/<firmware>.iic
Note: Enter the ID you found in the preceding step as it may be different from the example above. Most probably you will now see an error stating the connection to the USB-Device was lost:
Opening USB Device 0×4705:0×0002… Claiming USB DFU Runtime Interface… Determining device status: state = appIDLE, status = 0 Device really in Runtime Mode, send DFU detach request… Resetting USB… Lost device after RESET?
However, the FX2 is now connected with the id 4705:0003. Run DFU-Util again using this ID and the firmware download will suceed:
sudo dfu-util --device 4705:0003 -R -D <path_to_firmware>/<firmware>.iic
If you like to get an idea about the USB DFU specification you are advised to read the document USB Device Firmware Upgrade Specification, Revision 1.0