4 Replies Latest reply on Sep 3, 2010 6:59 PM by daniel.schoch

    determining buffer level of IN endpoint

    daniel.schoch

      Hi,

         

      Is it possible to find out how many bytes are available for pick-up from an IN endpoint using XferData() ?

         

      Thank you

        • 1. Re: determining buffer level of IN endpoint
          daniel.schoch

          I would like to add that I have a device which is sending an unknown amount of data to the host. The device is also using PKTEND (in SlaveFIFO mode) to send partial packets. It might also send partial packets intermixed with full packets.

             

          How can the host determine how much data needs to be read from the endpoint?

          • 2. Re: determining buffer level of IN endpoint
            daniel.schoch

             The more I think about it the less I understand how USB and CyUSB.NET works. (I'm brand new to USB, so please go easy).

               

            I'm trying to have a device use BULK transfer to the PC. I imagine this is what's happening:

               

            1. The device sends full or partial packets across the USB to the PC

               

            2. On the PC side some FIFO buffer (call it PCbuf) gets slowly filled with the data.

               

            3. XferData() is used to grab the data from PCbuf and transfer it to the application.

               

            Is that what's happening? If so I have a question. How big is this PC side buffer PCbuf? And how does one know if it overflows? And how does the USB device know it can't send more data because the PCbuf is full?

               

            Or do I have that all wrong? Is there in fact no PC side buffer at all. And whenever I execute XferData() a USB request is direclty dispatched to the device asking for a specific amount of data? That would actually make more sense I guess, because it would explain why there is no function to tell me how much data is availabe for pick-up. Because the PC simply doesn't know.

               

            So the other question then becomes. Is it possible to tell XferData() to just give me all the data available in the buffer without any timout. Something like this:

               

            XferLen = 512;

               

            bResult = inEndpoint.XferData(ref inData, ref xferLen);

               


               

            But I don't want to wait for timeout, just give me what you got available, but give it to me now.

               

            Thank you for any helpful insight.
             

            • 3. Re: determining buffer level of IN endpoint
              daniel.schoch

              Bumping the thread.

                 

              Anybody?

                 

              Is there some architectural documentation of the CyUSB drivers available? What do I have to read to actually understand how to use this driver efficiently?