2 Replies Latest reply on Feb 27, 2017 9:11 PM by nguyen.tuan.phuong

    SlaveFifoSync sample,  Ep0x81 can not recieve 1024 byte

    nguyen.tuan.phuong

      Hi

      I am using SlaveFifoSync sample to learn how Fx3 working. I made an USB loopback firm (EP0x01 for procedure, EP0x81 for consumer) and use Control Center applicaton to send and get data. This is my problem

      Ep0x81 can not recieved data when EPpx01 send 1024 byte. It 's OK when i sent 1023 byte or 1025 byte.

      Below is my firm configuration infomation

      epCfg.burstLen = 16;
      dmaCfg.size = size * 16;
      dmaCfg.count = 2;

         

       

         

      please show me how to get exactly 1024 byte without sent more 1 byte of dummy data?

        • 1. Re: SlaveFifoSync sample,  Ep0x81 can not recieve 1024 byte
          nisa

          Please try either 1

             

          1) You can send 1024 from the control center + a transfer out of zero lenght (ZLP)

             

          2) Please change the dmaCfg.size =1024 and see the result. 

             

          This is beacuse the Endpoint Max packet size is 1024. When the host or the device sends 1024 (or any multiple of 1024), the device will not know that the transfer from the host has ended. The device will asssume that one packet is complete, and the next is about to arrive. But here, there is no next packet. So, the device keeps on waiting. For this, you need to indicate the device that the transfer ended by sending a ZLP (as mentioned in step 1).

             

          If you change the buffer size to 1024, only one packet is suffcient to fill the FX3 DMA buffer, after which the buffer will be committed to the producer. So, here the device although keeps, waiting, but commits the previous data (so, you will get the data at the consumer). As per USB, when the data is a multiple of EP max packet size, you need to send a ZLP at the end. 

             

          This issue does not happen with 1023 or 1025 becasue, when the device/hist recives data (not a multiple of EP max size), it becomes aware that this is the end as the data is less that 1 packet. (1025 will be sent to device as 1024 +1 , i.e: 1 packet +1 short packet).

          • 2. Re: SlaveFifoSync sample,  Ep0x81 can not recieve 1024 byte
            nguyen.tuan.phuong

            Hi Nishant,

               

            Thank you for your advice. It's very helpful for next my application.

               

            Best Regards,
            Phuong