I am working on Cypress FX3 USB3.0.I am using EZ USB FX3 SDK/1.3/Application/cpp/Streamer.Now in streamer.h code ,there is one function called "Xferloop()".In this function I want to collect the data of "buffer" character by character basis and want to st

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

cross mob
shduc_3538066
Level 1
Level 1
First like given

I am working on Cypress FX3 USB3.0.I am using EZ USB FX3 SDK/1.3/Application/cpp/Streamer.Now in streamer.h code ,there is one function called "Xferloop()".In this function I want to collect the data of "buffer" character by character basis and want to store in "myfile.txt".I am only able to store buffer value (between start and stop) but not character by character.Please help.

0 Likes
1 Solution

Hello,

Please use the below code in the Display16Bytes function call.

static void Display16Bytes(PUCHAR data)

        {

            String ^xData = "";

            for (int i=0; i<QueueSize; i++)

                xData = String::Concat(xData,data.ToString("G"), " ");

            String ^filename = "C:\\myfile.txt";

            System::IO::StreamWriter ^sw = gcnew System::IO::StreamWriter(filename, true);

            sw->WriteLine(xData);

            sw->Close();

            //Display(xData);

        }

NOTE:

1. This piece of code does not perform the actual conversion from unsigned char to signed int. It displays a string which is of the integer format.

2. The throughput of the streamer utility decreases because of the processing happening on the host side to save the data onto the disk.

3. The above piece of code gets executed when the "Show Transferred Data" check box is checked.

Best regards,

Srinath S

View solution in original post

0 Likes
7 Replies
alamandaa_16
Moderator
Moderator
Moderator
10 likes received First like received

Hi Shrikant dubey,

1.Streamer.h code:

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

                    {

                        Successes++;

                        BytesXferred += len;

                        if (bShowData)

                            Display16Bytes(buffers);

please go through above code in streamer.h.

There you can collect the data of "buffers"  then store in "myfile.txt"

2.What do you mean by  store buffer value(between start and stop)?

Regards,

Anil Srinivas.

0 Likes

Thanks for your help sir.Now I successfully created a file named myfile.txt & stored the buffer value between the moment we press START an STOP button  in Streamer utility.But what i received in myfile.txt is ASCII value but I want to have this data in SIGNED INTEGER.Plese help.

0 Likes

Hello,

Please use the below code in the Display16Bytes function call.

static void Display16Bytes(PUCHAR data)

        {

            String ^xData = "";

            for (int i=0; i<QueueSize; i++)

                xData = String::Concat(xData,data.ToString("G"), " ");

            String ^filename = "C:\\myfile.txt";

            System::IO::StreamWriter ^sw = gcnew System::IO::StreamWriter(filename, true);

            sw->WriteLine(xData);

            sw->Close();

            //Display(xData);

        }

NOTE:

1. This piece of code does not perform the actual conversion from unsigned char to signed int. It displays a string which is of the integer format.

2. The throughput of the streamer utility decreases because of the processing happening on the host side to save the data onto the disk.

3. The above piece of code gets executed when the "Show Transferred Data" check box is checked.

Best regards,

Srinath S

0 Likes

Dear Srinath S,

Thanks for your help.

I have two problems:-

1) I wrote the above code ,did build and did release,But myfile.txt is not getting created.Please help in this regard.

2)I tried another way by creating "myfile.txt" in xferloop() function and successfully collected buffers value in myfile.txt.But data in myfile.txt is in ASCII code ,but I want in HEX.Please help.

Thanks

0 Likes

Hello,

- Please check if the 'Show Transferred Data' check box is checked.

- Also, let know if there are any other changes that are made to the Streamer utility.

Best regards,

Srinath S

0 Likes

Hi Srinath,

Thanks for your help.After clicking the checkbox i indeed started getting the data.

Sir,My target is to collect all the data of "buffers" . For that i wrote the following code  -

       static void Display16Bytes(PUCHAR data)

{

  ofstream myfile;

  myfile.open("data_collected.txt",ios::out);

          String ^xData = "";

           for (int i=0; i<QueueSize; i++)

   { myfile <<int(data) <<"\n"  ;

             xData = String::Concat(xData,data.ToString("G"), " ");}

         myfile.close();

After clicking the check box "Show transferred data"  i m only getting the 16 bytes not the whole data of the "buffers".How can I get all the data of the "buffers".Kindly help.

Thank you.

0 Likes

Hello,

Please modify the below line of code.

myfile.open("data_collected.txt",ios::out | ios::app);

The addition of "app" appends the data to the file each time the file is opened.

Best regards,

Srinath S

0 Likes