Building Example Applications with Visual Studio 2017

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

cross mob
FrZa_2625781
Level 4
Level 4
First solution authored 25 replies posted 10 replies posted

Hi,

I tried to build the Streamer example application from the USB Suite 3.4.7 with VS 2017 Community, but I get a lot of errors.

It does not recognize the System::Windows namespaces, expects or misses tons of declarations and so on.

Can anyone point me to a walk through guide for building these examples with VS 2017 Community?

I don't know if they are buildable with any other VS version, because I only have that one.

Thanks in advance

0 Likes
1 Solution

Hello John Cunningham,

Please download the latest FX3 SDK from the below link.

http://www.cypress.com/documentation/software-and-drivers/ez-usb-fx3-software-development-kit

The C++ streamer and bulkloop applications present in this SDK has been modified to successfully build on VS2017.

Best regards,

Srinath S

View solution in original post

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

Hello Frank Zander,

- Please use the Streamer application that comes with the EZ-USB FX3 Software Development Kit.

- Also, let us know if you are using the C++ version or the C# version of the streamer application.

Best regards,

Srinath S

0 Likes

Hi,

Thanks for the quick reply.

Does the Streamer application from the FX3 DVK really work with the FX2LP?

Anyways, I installed VS 2010 and got the Streamer application from the USB Suite 3.4.7 built with success.

I did a little modification, because I wanted to store the transferred data into a file instead of displaying it, so where the code usually callls the display function I added this:

   //Display16Bytes(buffers);

   std::ofstream outfile;
   outfile.open("test.dat",ios::binary|ios::out|ios::app);
   outfile.write(reinterpret_cast<const char *>(buffers),sizeof(buffers));
   outfile.close();

This code works and I get a file with data in ist, but it makes the application go soooooo slooooow.

I think this is (at least partly) because I open and close the file again for each transfer. I tried to move the

   std::ofstream outfile;
   outfile.open("versuch.dat",ios::binary|ios::out|ios::app);

to where the start button is pressend, and the

   outfile.close();

to where the stop button is pressed, but then I get errors at the outfile.write command, because my outfile object seem not to be known where i do the write.

I am very new to C++, so that might be obvious to someone being familiar with it.

Could anyone help me and tell me how I have to program this in order to get the streamed data written to a file without sacrificing too much bandwidth. I need about 6MB/s whule the ISOC IN with 3072 Bytes gives me 24MBs with just skipping the data and about 50kB/s with wrinting the data to the file.

0 Likes

Hi,

after i moved the std::ofstream outfile; towards the beginning of streamer.h, directly after the includes, I could move the open to Form1_Load and the close to Form1_Closed, and now I get 24MB/s also with writing the data to a file.

I moved the write upwards from the package to the transfer level and now the code looks like this:

if (EndPt->FinishDataXfer(buffers, rLen, &inOvLap, contexts, isoPktInfos))

{           

    if (bShowData)//modified: insertion

        outfile.write(reinterpret_cast<const char *>(buffers),rLen);//modified: insertion

    CCyIsoPktInfo *pkts = isoPktInfos;

...

Unfortunately, rLen seems to be 48986 all the time, instead of 49152 (16*3072).

Any idea, why the FX2LP does not send 16 times 3 packages of 1024 bytes each with the alternate 3 setting of the streamer firmware?

0 Likes

Hi,

can someone comment on the missing bytes?

Unfortunately, rLen seems to be 48986 all the time, instead of 49152 (16*3072).

Any idea, why the FX2LP does not send 16 times 3 packages of 1024 bytes each with the alternate 3 setting of the streamer firmware?

Either the FX2LP does not send 49152 bytes or the Streamer application does not receive all the sent bytes.

Is there any flaw in the Streamer code or did I mess up with it due to my changes?

0 Likes
Anonymous
Not applicable

I have the same issue.  Just purchased Visual Studio 2017 running C++.  Neither the streamer or bulk app will build.

When I compile the project as is, I get these messages:

1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Common.props(144,5): warning MSB4211: The property "WindowsTargetPlatformVersion" is being set to a value for the first time, but it was already consumed at "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.WindowsSDK.props (29,5)".

1>cl : Command line warning D9002: ignoring unknown option '/clr:oldSyntax'

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(13): warning C4467: usage of ATL attributes is deprecated

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(5): error C2653: 'System': is not a class or namespace name

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(5): error C2871: 'Reflection': a namespace with this name does not exist

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(6): error C2653: 'System': is not a class or namespace name

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(6): error C2871: 'CompilerServices': a namespace with this name does not exist

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(13): error C2337: 'AssemblyTitleAttribute': attribute not found

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(14): error C2337: 'AssemblyDescriptionAttribute': attribute not found

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(15): error C2337: 'AssemblyConfigurationAttribute': attribute not found

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(16): error C2337: 'AssemblyCompanyAttribute': attribute not found

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(17): error C2337: 'AssemblyProductAttribute': attribute not found

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(18): error C2337: 'AssemblyCopyrightAttribute': attribute not found

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(19): error C2337: 'AssemblyTrademarkAttribute': attribute not found

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(20): error C2337: 'AssemblyCultureAttribute': attribute not found

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(33): error C2337: 'AssemblyVersionAttribute': attribute not found

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(57): error C2337: 'AssemblyDelaySignAttribute': attribute not found

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(58): error C2337: 'AssemblyKeyFileAttribute': attribute not found

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\assemblyinfo.cpp(59): error C2337: 'AssemblyKeyNameAttribute': attribute not found

1>d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\streamer.h(2): fatal error C1083: Cannot open include file: 'CyAPI.h': No such file or directory

A forum post suggested going into Project -> Porperties -> General and changing the "Common Language Runtime Support" from OldSyntax to Common Language Runtime Support.  When I did that, I get these errors instead:

1>  d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\streamer.h(19): error C2059: syntax error: 'public'

1>  d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\streamer.h(20): error C2143: syntax error: missing ';' before '{'

1>  d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\streamer.h(20): error C2447: '{': missing function header (old-style formal list?)

1>  d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\streamer.cpp(26): error C2061: syntax error: identifier 'Form1'

1>  d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\streamer.cpp(28): error C3699: '*': cannot use this indirection on type 'System::Exception'

1>  d:\3axixdata\cyclonev_brutus_bringup\cypress\application\cpp\streamer\streamer.cpp(28): note: compiler replacing '*' with '^' to continue parsing

1>Done building target "ClCompile" in project "Streamer.vcxproj" -- FAILED.

Any ideas on getting this fixed?

0 Likes

Hello John Cunningham,

Please download the latest FX3 SDK from the below link.

http://www.cypress.com/documentation/software-and-drivers/ez-usb-fx3-software-development-kit

The C++ streamer and bulkloop applications present in this SDK has been modified to successfully build on VS2017.

Best regards,

Srinath S

0 Likes
Anonymous
Not applicable

Screen Shot 2018-06-19 at 11.24.25 .pngJust an FYI... The update process is broken for the new release above.  Please see attached screen shot.

0 Likes
Anonymous
Not applicable

You can just use CyUSB.dll here is example codes for C#:

        USBDeviceList usbDevices;

        CyUSBDevice myDevice;

        public FormMain()

        {

            InitializeComponent();

            usbDevices = new USBDeviceList(CyConst.DEVICES_CYUSB);

            usbDevices.DeviceAttached += new EventHandler(usbDevices_DeviceAttached);

            usbDevices.DeviceRemoved += new EventHandler(usbDevices_DeviceRemoved);

            // Get the first device having VendorID == 0x04B4 and ProductID == 0x8613

            myDevice = usbDevices[0x04B4, 0x8613] as CyUSBDevice;

            if (myDevice != null)

                labelStatus.Text = "Device Attached";

        }

        void usbDevices_DeviceRemoved(object sender, EventArgs e)

        {

            USBEventArgs usbEvent = e as USBEventArgs;

            labelStatus.Text = "Device Removed";

        }

        void usbDevices_DeviceAttached(object sender, EventArgs e)

        {

            USBEventArgs usbEvent = e as USBEventArgs;

            labelStatus.Text = "Device Attached";

        }

Also check Migration of an EZ-USB® FX2LP™ Driver from CyUSB.sys to CyUSB3.sys – KBA92893

0 Likes