5 Replies Latest reply on Jul 17, 2013 8:02 AM by alex.gerka

    Streaming SPI data via USB to a PC

    alex.gerka

       Hi,

         

      I´m using the "PSOC 3 Development Kit". In my project I would like to transmit data that has been received by a SPI SLAVE to my PC.

         

      I tried to use USB_UART with Hyperterminal and  I did work, but i was to slow.  I need at least a datarate of  100 kByte/s. Now I'm trying to establish the data transfer with the USBFS in the Bulk mode using USB Suite. With CyConsole I´m able to read out the endpoint, but every time I want to read the data I have to press the button " transfer data" . But i need a continuous stream of data. The programm "streamer" does not work. Does anybody know how its possible to read out an store a continuous stream of USB data?

         

      I attached my project.Pease help me out.

         

      Regards,

         

      Alex

        • 1. Re: Streaming SPI data via USB to a PC
          junichi.hiraoka
                  Hi Alex, CyConsol, CyControl and Streamer is test program for single transaction. How's BulkLoop? When you need proper Host program, have to make own Host program. That using CyUSB.dll or CyAPi, There are C# samples in USB Suit 3.4.7, Of cource sample of BulkLoop and CyControl.   
          • 2. Re: Streaming SPI data via USB to a PC
            alex.gerka

            Thanks for the answer. BulkLoop doesn´t work too. But thats maybe because I dont use the endpoint adresses specified in BulkLoop. Do you know how to change the endpoint adress? 
            I have another question:Is there maybe a possibility to read out the data directly by Matlab?

               

            Thanks a lot for the help,

               

            Alex

            • 3. Re: Streaming SPI data via USB to a PC
              junichi.hiraoka
                      OK, Piece of cake. As you know, Open Configure dialog of USBFS, [Device Descriptor TAB] / Endpoint Descriptor / Endpoint Number - EP1 to EP8 is EP number, Set IN or OUT, Transfer type is BULK, Interval=0, Max Packet=64; When add new EP, Click [+Add Endpoint]. Second question: I'm using another tool, I haven't have MATLAB however. Usually, This kind of tool has Script Language, like VB or Java. If so, Control PSoC USB by those. huh?   
              • 4. Re: Streaming SPI data via USB to a PC
                garima.gupta

                 Hi Alex,

                   

                 

                   

                Here are the answer to your questions:

                   

                 

                   

                1. I´m using the "PSOC 3 Development Kit". In my project I would like to transmit data that has been received by a SPI SLAVE to my PC.

                   

                I tried to use USB_UART with Hyperterminal and  I did work, but i was to slow.  I need at least a datarate of  100 kByte/s. 

                   

                Comment: The data rate can be increased to 115200 bits per second in the hyperterminal. If you are using UART component, then configure it to communicate at a rate of 115200 Bits per second.

                   

                 

                   

                2.Now I'm trying to establish the data transfer with the USBFS in the Bulk mode using USB Suite. With CyConsole I´m able to read out the endpoint, but every time I want to read the data I have to press the button " transfer data" . But i need a continuous stream of data. The programm "streamer" does not work. Does anybody know how its possible to read out an store a continuous stream of USB data?

                   

                Comment: You can use CyConsole for this. After you select your bulk endpoint from the Bulk Transfer drop down list. Write the amount of data you want to receive, and you are sure, you will receive in the length field. Click on File Transfer. A Window appears, store your file in txt format. Later you can view with a hex editor. As soon as you save the file, the file transfer starts. If the File transfer is successful, it will give no extra message other than Bulk Out/IN file Transfer. If it fails you will get Bulk IN File Transfer failed. Take care that it will fail if you sent lesser number of bytes than desired in sometime. I hope this helps you.

                   

                Steamer will not display the data. I believe it is not useful for you.

                   

                 

                   

                3.I attached my project.Pease help me out.

                   

                Comment:No project has been attached here.

                   

                 

                   

                4. Thanks for the answer. BulkLoop doesn´t work too. But thats maybe because I dont use the endpoint adresses specified in BulkLoop. Do you know how to change the endpoint adress?

                   

                I have another question:Is there maybe a possibility to read out the data directly by Matlab?

                   

                Comment:Yes, for that you can use the standard NI-Visa drivers. If you are comfortable with Matlab, probably you can try that too.

                   

                 

                   

                Hope these details help.

                   

                 

                   

                -Garima

                   
                        
                • 5. Re: Streaming SPI data via USB to a PC
                  alex.gerka

                  Hi.

                     

                  thanks for the answers. i tried to use them to solve my problems. Here are the results:

                     

                  1. I`ve already done that, but its still to slow. I need to transfer 16 bit values with a rate of 40 kHz . This means that i need at least 640.000 Bits per second...

                     

                  2. When I press the Transfer File Button I´m able store data to a .txt-file like you said. But in the .txt there´s always only one value. What i need is a continous stream.  I tried to change "length" and "hex bytes" but it doesn´t change anything.

                     

                  I also changed "Control Center" with Visual studio, so when i now press the "data transfer" button I get  100 values from the endpoint. but the values are often in a wrong order and sometimes the software stops the communication completely.(Error code 997)  Do you have an idea how to solve these problems ?

                     

                  Thank you.

                     

                  Alex