Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for Cypress FX3 device to libsigrok #148

Closed
wants to merge 8 commits into from

Conversation

ashwinnaircy
Copy link

EZ-USB FX3 is a USB 3.0 peripheral controller that comes from the EZ-USB family of products (USB 3.0 version of the FX2 series used in fx2lafw). Addition of FX3 support to sigrok can help developers to use any FX3 kit as a USB 3.0 logic analyzer.

@jevinskie
Copy link

Where is the source of the firmware? This is neat!

@ashwinnaircy
Copy link
Author

Thanks for your comment.

The firmware will actually fall under "Getting non-distributable firmware files" section of the firmware wiki (https://sigrok.org/wiki/Firmware). We are planning to release the binary (cypress-fx3.fw) and the firmware example project source through the Cypress webpage as a Knowledge Base Article. We cannot add the source or the binary to the sigrok-firmware project due to licensing issues.

@ashwinnaircy
Copy link
Author

The firmware source is online at EZ-USB™ FX3 Explorer kit as 16-channel 100 MHz logic analyzer with sigrok PulseView - KBA233652.

@abraxa
Copy link
Member

abraxa commented Oct 2, 2021

For transparency purposes, here's the email I sent the author of this PR:

Thanks for contributing, it is much appreciated!

Before I dive into this more deeply, I'd like to discuss the state of the firmware, as this is a critical piece of the system.

From my understanding, the sigrok project can neither distribute your firmware binary nor the complete source code to the firmware as it contains an OS that requires developers to agree to a license agreement before downloading the FX3 SDK. Is my understanding correct?

A sigrok user developed an alternative firmware that is completely open source which doesn't have these issues. As of now, however, the driver has issues with USB 2 -> 3 enumeration and acquisition is unstable at higher data rates. From our perspective, it is preferable to be able to have both the driver and the firmware under an open source license, so ideally we'd like to see this fully open firmware being polished and made usable.

While adding your driver certainly would be a step forward to users, it is somewhat unfortunate that the closed-source nature of the SDK counteracts the OSS benefits that sigrok aims to provide.

Hence, what I also would like to know is whether we could either interest you in helping out with our OSS FX3 driver/firmware or whether there is any possibility to get your FX3 firmware into a redistributable and/or user-buildable state without having to agree to additional license terms.

For these reasons, as much as I am happy to see Infineon step up and contribute, #154 is currently the preferred way forward. I'd be happy if we could somehow merge these efforts and get something that works better than each individual solution.

@linuxguy123
Copy link

linuxguy123 commented Sep 1, 2022

Someone should ask Cypress (Infineon) for permission to use their firmware blob.

They've given permission to use other software:

https://community.infineon.com/t5/USB-superspeed-peripherals/How-to-flash-from-command-line-CYUSB3KIT-003/m-p/244878#M24662

In the absence of their permission, here is an open source firmware:

https://github.com/zeldin/fx3lafw

BTW, here is a KBA from Infineon telling users to use the FX3 with Sigrok:
https://community.infineon.com/t5/Knowledge-Base-Articles/EZ-USB-FX3-Explorer-kit-as-16-channel-100-MHz-logic-analyzer-with-sigrok/ta-p/283993

I posted an issue on their forum.

https://community.infineon.com/t5/USB-superspeed-peripherals/Sigrok-needs-authorization-to-use-the-Logic-Analyzer-firmware-blob/m-p/367526#M31973

I also PM'd rajagopaln and Chelladurai

@kosma
Copy link

kosma commented Feb 24, 2023

Is there any chance we can get a prebuilt installer in the KB article? The compilation process, while doable, is quite time-consuming.

@endjuser
Copy link

endjuser commented Mar 1, 2023

I see Infineon responded on their forum (per the post above, asking permission to use their firmware blob) but no one has followed up with them. It sounds like they may be amenable to Sigrok distributing their blob.

It would be great to be able to use Sigrok with the FX3 firmware provided by the device manufacturer for this specific application, without having to set up a Sigrok build environment.

@LeisureLadi
Copy link

LeisureLadi commented Aug 12, 2023

Since merging the here described Cypress-FX3 driver into sigrok is not likely to happen I grabbed the bull by the horns and set up a fresh Ubuntu-20.04 system on windows wsl2 to build sigrok-cli and pulseview from scratch. It took me about 2 weeks to get everything up and running, but now it is done and I thought it may be good to share the work to enable others to build this nice little piece of software themselves.

You can download the wsl image of Ubuntu-20.04 with all required libraries included, except for the 'cypress-fx3.fw' firmware due to the fact that it is covered by a different licensing scheme. You need to download it separately from infineon's web-site (link was provided by infineon earlier here).

You can copy the firmware to '~/sigrok-src/sigrok-firmware-fx3/', from where it will then be included in the windows installer. But you can add it later to the installed software as well like it is described in infineon's blog.

These are the links to the image:

Image Part 0
Image Part 1
Image Part 2

Total size of the image is about 11 GB, so I had to split the ".tar" file into 3 parts, since the daily download limit at the hoster is 5 GB on a free plan.

  1. Download and merge all 3 files into a single one by using the linux' "cat" command.

  2. Import the image into wsl and start it. The user password is "CypressFX3".

I'm using a static source for compiling sigrok, since I needed to manually integrate the FX3 driver modifications into 'libsigrok'. The build scripts located in '/sigrok-utils/cross-compile/...' directories are modified to copy the source files from '/sigrok-src' rather than "wget" them from git. If you want to use the latest git version, you should either "wget" them into '/sigrok-src' or change the build scripts again, i.e. uncomment the "wget" commands and comment the following "mkdir" and "cp" commands.

If you use the git versions, you will, however, lose the modifications required for integration of the FX3 driver!

If you are up for cross compiling for mingw, you may want to download the FX3 firmware provided by infineon before compiling. Extract the 'cypress-fx3.fw' file and copy it to '/sigrok-src/sigrok-firmware-fx3' directory. It will then be included in your personal windows installer.

  1. Before compiling sigrok, you should check the available memory. You will need at least 4 GB available for linux. I had to increase virtual memory, which you can do as well by running "sudo bash make_vm". That increases VM by another 8GB.

  2. Finally you can start compiling by changing to the corresponding subdirectory, where the build scripts are located (typ. '/sigrok-util/cross-compile/linux' or '/sigrok-util/cross-compile/mingw').

If you cross-compile for windows, please adjust the build script to compile for either 32 or 64 bits. The image's default is 64 bits.

Good luck and have fun!

@mrv96
Copy link

mrv96 commented Aug 12, 2023

@LeisureLadi thank you for your work! I've just taken a look to it.

I think that it would be great if you create a repository with modified scripts and provide a Dockerfile instead of the WSL image.

@nick-kraus
Copy link

Is the current concern blocking this PR from being merged the issue of permission from Infineon to redistribute the FX3 firmware found in the KBA by the sigrok project?

If so, I'm happy to attempt chasing an answer from Infineon on this, I just want to make sure that all is needed is for explicit permission of the sigrok project to redistribute the firmware files found on the KBA, and what form that permission can come in (whether a post on the Infineon forum, or something else).

I would love to see this get merged since the process of building from source for a windows installer seems rather arduous, and it will open up a great option for a cheap performant logic analyzer platform.

@abraxa
Copy link
Member

abraxa commented Feb 14, 2024

Is the current concern blocking this PR from being merged the issue of permission from Infineon to redistribute the FX3 firmware found in the KBA by the sigrok project?

I quote Cypress:

"We cannot add the source or the binary to the sigrok-firmware project due to licensing issues."

This is as big of a showstopper as it gets. Closing the PR as we're not interested in drivers whose firmware we can't redistribute.

I suggest further developments happens as part of #154.

@abraxa abraxa closed this Feb 14, 2024
@shabaz123
Copy link

Hello @LeisureLadi
Many thanks for the WSL image.
I had a question, are you able to capture at 100 MHz for any reasonable number of samples (e.g. 100M samples)?
I've built the MinGW version using the WSL image, and it seems the sample drop-down at the top gets ignored, or is incorrectly used. For instance, if the sample rate is 100 MHz, and the number of samples is set to 100 M samples, if I click run, it only captures for 5 usec (see screenshot below). Really bizarre.
Unfortunately I'm not familiar enough with the Pulseview source code to know where to even look to see what the issue could be.
pulseview-issue

@LeisureLadi
Copy link

Hi @shabaz123,

I'm too not familiar with the internal details of sigrok, but from recent bug reports I understand, that pulseview currently is broken on Windows due to an issue with libusb (see here: #235).

I guess, there is no simple solution for the problem in the near future.

@LeisureLadi
Copy link

Hi @shabaz123,

a small, but important correction: with the modifications described here: #242 it is possible to record with fx3 at 100MHz and long sampling times.

Thanks to @multiplemonomials to provide the fix.

I'm not sure, if the timing is always correct, but at least recording is possible.

@yokrysty
Copy link

yokrysty commented Jul 22, 2024

Hey guys
here is my take on building this
https://github.com/yokrysty/docker-pulseview-cc-mingw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.