1 2 Previous Next 21 Replies Latest reply on Nov 25, 2018 7:58 PM by AnkitaS_51 Go to original post
      • 15. Re: USB_FS with Auto-DMA / API handling: HowTo?
        AnkitaS_51

        I think you are choosing DMA with Automatic Buffer Management in the project.

        Please check the reference project attached in previous interaction which is using EP2 ISR.

        USBFS_EP_DMA_DONE_ISR is  intended for internal Component use only.

        • 16. Re: USB_FS with Auto-DMA / API handling: HowTo?
          raal_264636

          Hi anks,

           

          >>> I think you are choosing DMA with Automatic Buffer Management in the project.

          Yes, that's what I stated in the first posting As a base I used AN56377 example #1, because I want to see the difference in speed for all endpoint types.

           

          What I don't understand is why it's so hard to modify the example so that it works with auto-DMA mode. According to the documentation and your help, it should run. I'm still investigating. I'll remove the USBFS_EP_DMA_DONE_ISR callback.

           

          Regards

          • 17. Re: USB_FS with Auto-DMA / API handling: HowTo?
            raal_264636

            Hi anks,

             

            I'm getting first results based on your last example provided. Many thanks for that. I reconfigured that example for interrupt endpoints and additionally call USBFS_EnableOutEP() function in the main application after copying the OUT buffer to the IN buffer (seems that this is not necessary for ISOC endpoints). The workflow is verified with USB control center application.

             

            Now, what I'm observing is that the first IN transfer gets 32 bytes with the data sent to the OUT endpoint, and the other 32 bytes are empty. Requesting another IN transfer gets the whole buffer (I verified that the PSoC got the full 64 bytes into the IN buffer within a single OUT transaction). I attached a screenshot of the USB control center window. I can reproduce this behaviour also in a small C# application: requesting 64 bytes from IN endpoint with XferData() function fills 32 bytes of a 64 byte buffer, a second call to the function gets the remaining 32 bytes.

             

            So, I assume it is related to the 32 byte size of the endpoint buffer in PSoC when using DMA. But how to detect if the whole transfer has completed on both sides (PC application and PSoC)?

             

            Regards

             

            • 18. Re: USB_FS with Auto-DMA / API handling: HowTo?
              raal_264636

              Just an update, figured out why two IN transfers were needed: it seems that the above issue is really related to the 32 byte DMA chunk size. In the main() for-loop, using a "data ready" flag to indicate that the whole buffer has been copied from OUT to IN endpoint buffer and making the call to LoadInEP() function only if this flag has been set (along with checking if the IN endpoint is ready, of course) transfers the whole buffer in one single transfer. Verified this behaviour in control panel application.

               

              Keep in mind, when doing it this way, the IN endpoint is not re-armed (because LoadInEP() will only be called when the above mentioned flag is set), therefore a second IN transfer will result in an endpoint error in control panel application. Maybe this can be overcome by either using the endpoint exit callback instead of the entry callback or by checking the endpoint state if it's empty when copying the buffer.

               

              Don't forget to call EnableOutEP() function if you're using interrupt or bulk OUT endpoints (as already mentioned, it seems that this is not needed for isochronous endpoints provided in the original example) after copying the buffer.

               

              Hope this helps others trying to get into the mysteries of USBFS component with auto-DMA. Too bad that there are no better examples provided I find it's quite hard to understand the component datasheet regarding this, other Cypress examples are much more detailed and helpful.

               

              Anyway, I don't give up! Next steps are figuring out the USB DMA buffers, currently I don't see any increased speed compared to non-DMA mode. I'll report the state here.

               

              Regards

              1 of 1 people found this helpful
              • 19. Re: USB_FS with Auto-DMA / API handling: HowTo?
                AnkitaS_51

                Thanks a lot for all the updates.Actually, a thread correspond to resolution of one issue.

                Please create another thread for a different issue

                • 20. Re: USB_FS with Auto-DMA / API handling: HowTo?
                  raal_264636

                  Hi anks,

                   

                  attached is the modified example which enabled me to get the data within a single transfer. It also works with interrupt and bulk transfers because the OUT endpoint is re-enabled, but I have not checked if this must be removed when switching back to the original isochronous configuration.

                   

                  I also tried the exit callback idea to overcome the two-IN-transfer issue, but it showed no difference. For the endpoint status check, I'm not sure if it will work, haven't tried it yet.

                   

                  I agree that one thread should be used for one problem. But I'm not sure if the DMA buffer & increase speed topic should be separated. Remember, the initial topic was about how to get USB up and running with auto-DMA. I'm not sure if the buffer handling still is within the initial topic, because someone would use DMA to increase speed. There are already a few topics regarding USB & DMA, but each of them covers only "a bit of the whole byte"

                  I'd be glad if we get it managed to have this thread as a single point solution for all USB DMA related questions, but it would also be okay if we place links from this to other topics.

                  So, how should we proceed? Should I open a new thread?

                   

                  Regards

                  • 21. Re: USB_FS with Auto-DMA / API handling: HowTo?
                    AnkitaS_51

                    You should create a new thread for any new topic.

                    1 2 Previous Next