6 Replies Latest reply on Aug 4, 2013 10:09 AM by anguel.stankov

    USBUART_PutData() does not work with 64 bytes

    anguel.stankov

      Hi!

         

       

         

      I am testing the USB CDC example project and cannot get it to send 64 bytes of data although this equals the max packet size and should be most efficient. Up to 63 bytes can be sent without problems but 64 bytes does not work for some reason.

         

       

         

      Any hints? Thanks in advance.

         

       

         

      Regards,

         

      Anguel

        • 1. Re: USBUART_PutData() does not work with 64 bytes
          junichi.hiraoka
                  Hi Anguel, A difficult problem.   
          Of course separate the text into packet below 64byte.   
          That is a handy way but is not an answer you want.   
          Please ask for Cypress Mycase.   
          • 2. Re: USBUART_PutData() does not work with 64 bytes
            anguel.stankov
                    PSoC73, thank you for the answer. The myCase is open but in the meantime I realized that the problem may be related to this: http://www.cypress.com/?id=4&rID=38107 BTW, to achieve max. efficiency, one must use the full 64 bytes per packet. Actually I expected more info on the APIs from a USB specialist like Cypress. At the time it is more about guessing what the API functions really do... Anguel   
            • 3. Re: USBUART_PutData() does not work with 64 bytes
              junichi.hiraoka
                      Although I think to seem to be able to resolve it because they know the cause.   
              They say "This problem will be fixed in PSD5.0 SP6, which is expected by the end of September 2009" huum...   
              If you need, you can fix by yourself.   
              copy user module program into original name and your directry.   
              and fix the problem.   
              • 4. Re: USBUART_PutData() does not work with 64 bytes
                anguel.stankov

                Well, I think it is possible to send as many 64 byte packets as I like and when I am done just send a zero-length packet as required by the usb standard to make sure that the host acknowledges the last packets, i.e. I do a USBUART_PutData() with length parameter =0.

                   

                 

                   

                Actually I am not sure how efficient the Cypress implementation is, but "fixing the bug" as they say in the defect report would probably make the PSoC send a zero-length packet after each 64 byte backet and this would decrease throughput. By sending 64 byte packets one after the other and just checking if USB can accept more data inbetween I have reached about 590 KBytes per second which is not very bad for USB CDC. This is probably the best one can achieve without completely rewriting the driver...

                   

                 

                   

                Anguel

                • 5. Re: USBUART_PutData() does not work with 64 bytes
                  junichi.hiraoka
                          I see.   
                  590KB/s is a very good performance.   
                  I couldn't never achieve so fast.   
                  My average record is 50KB/s, It is with echo back, loop back transfer, however.   
                  I thought, 60byte packet, or 62, 63 byte is not bad rather than 64byte.   
                  Anyway, you can be find a source file of CyUSB.dll in this site.   
                  When you revise the record, let us know.   
                  • 6. Re: USBUART_PutData() does not work with 64 bytes
                    anguel.stankov

                    To achieve max speed for USB CDC Full Speed you should:

                       

                     

                       

                    1. Put max possible bytes in one packet = 64 bytes for CDC

                       

                     

                       

                    2. Try to send as many packets as possible in a 1ms frame: up to 19 packets is possible but this is only for a free USB bus, in practice you will not reach 19, maybe 16 or so

                       

                     

                       

                    3. Of course the speed also depends on the USB hardware and the driver.

                       

                     

                       

                    See this post for more info: http://www.microchip.com/forums/m450163-print.aspx

                       

                    For a PIC32 they get about 800 KBytes/s. In some Cypress appnote I saw that only 80 KBytes/s were possible for CDC but this is probably not correct.

                       

                     

                       

                    Anguel