May 12, 2022

EZ USB as a logic analyzer

Much to my surprise, it is possible to use a CY7C68013 development board as a logic analyzer! Hopefully it is as easy as flashing firmware into one of the development boards I just bought and then connecting it to sigrok. It turns out to be even easier than that, see the end of this post.

But first a quick side note. I have a "from china" 24 Mhz, 8 ch logic analyzer. When I pop open the box, what do I find? A cy7c68013a chip, along with a 74LVC245 chip, and a mysterious 8 pin chip (marked ATNHK218). It could be anything. Maybe a power regulator. The LVC245 does make sense to buffer and level shift signals. Using the development board "naked" as we do below may not be a hot idea depending on the signals in the system we connect it to.

Let's do it

Also note that I did all this on linux, with no need to use any of the special Windows based tools for dealing with EZ-USB devices that are mentioned on many posts. The sigrok project makes this all ridiculously easy once you understand things. In fact, it was never necessary to use the "fxload" utility.

I downloaded the latest firmware bundle (version 0.1.7) and unpacked it. It is far from clear which of the many files (there are 13) I want to use or how to use them. Likely candidates are:
fx2lafw-sigrok-fx2-8ch.fw
fx2lafw-sigrok-fx2-16ch.fw
Let's try an experiment. I plug my board into my linux system and it shows up as "idVendor=04b4, idProduct=8613". Then I try this command:
fxload -v -t fx2 -d 04b4:8613 -i fx2lafw-sigrok-fx2-8ch.fw
microcontroller type: fx2
fx2lafw-sigrok-fx2-8ch.fw is not a recognized image type

So much for that. Apparently sigrok itself expects to find and load these ".fw" files.

I see various and conflicting descriptions of what the two jumpers on my board do. My jumpers are labeled J3 and J4, here are two possible descriptions:
J1 is to connect/disconnect 2 LEDs from Vcc - these LEDs are connected to D0 & D1
J2 controls address bit A0 of the EEPROM.
J2 inserted: Comes up within bootloader mode with default USB descriptors.
J2 removed: Comes up with the address 0x51 and can be programmed as a large EEPROM.
(probably J1 on this board serves to enable/disable the LED's)
One description suggests that the board can be used in two ways. One is that it will load ram from the EEPROM, the other is to load ram from the host.

Launch pulseview

This is even more interesting. With the device plugged in, completely stock, and enumerating as "idVendor=04b4, idProduct=8613", pulseview detects it, but announces:
sr: resource: Failed to open resource 'fx2lafw-cypress-fx2.fw' (use loglevel 5/spew for details).
sr: fx2lafw: Firmware upload failed for device 1.9 (logical), name fx2lafw-cypress-fx2.fw.
This is one of the files in my collection of 13. Perhaps if I put them in the "right place", pulseview will find and load the file. A closer look at the first sigrok page makes more sense now. It says that if you build the firmware yourself, it will install to /usr/local/share/sigrok-firmware. So I do this:
su
cd /usr/local/share
mkdir sigrok-firmware
chown tom:tom sigrok-firmware
exit (go back to being "tom")
cd /u1/Projects/EZUSB
tar xzvf sigrok-firmware-fx2lafw-bin-0.1.7.tar.gz
cd sigrok-firmware-fx2lafw-bin-0.1.7
cp * /usr/local/share/sigrok-firmware
Now I launch pulseview and get no error. It comes up showing "Cypress FX2". So there is no need at all for me to flash anything or to use fxload.

It simply works!!
Once again, sigrok is very impressive.

My linux logs show:

May 12 12:11:12 trona kernel: usb 1-1.2: USB disconnect, device number 9
May 12 12:11:13 trona kernel: usb 1-1.2: new high-speed USB device number 10 using ehci-pci
May 12 12:11:13 trona kernel: usb 1-1.2: New USB device found, idVendor=04b4, idProduct=8613, bcdDevice= 0.01
May 12 12:11:13 trona kernel: usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
May 12 12:11:13 trona kernel: usb 1-1.2: Product: fx2lafw
May 12 12:11:13 trona kernel: usb 1-1.2: Manufacturer: sigrok
May 12 12:11:13 trona kernel: usb 1-1.2: SerialNumber: Cypress FX2
So, it kept the same vid:pid but now the manufacturer and product strings have changed. The Pulseview menu shows up to 48 Mhz sample rates, and apparently unlimited numbers of samples. When I power cycle it, it comes up with mfr/product = 0, so nothing got flashed. Apparently pulseview just loads firmware to ram each time it finds this device and starts up.

Also when I look at the big table of gadgets that sigrok lists (see the first link above), I can scan for the 04b4:8613 vid/pid. My board looks similar to the LcSoft Mini Board that they list, but is not exactly the same.


Feedback? Questions? Drop me a line!

Tom's Computer Info / [email protected]