5 Replies Latest reply on May 27, 2019 9:26 PM by KandlaguntaR_36

    FX3S Facing Problem: USB -  SDIO Read/Write Using CMD53




      I am developing a FX3S host application to communicate with SDIO card through USB.


      My application communication is like USB to SDIO for Write and SDIO to USB to read.


      I imported a SDK example FX3SSdioUart (C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\storage_examples\cyfx3s_sdiouart) and I disabled UART and USB, and tested CMD52 Read and Write - That is working as expected.


      So I am facing problem on SDK API CyU3PSdioExtendedReadWrite (CMD53) for block read/write, I want block read/write using CMD53, but I am facing problem to setup DMA Socket ID.


      Any Clue or pseudo code?



      Application Should Like:


        • 1. Re: FX3S Facing Problem: USB -  SDIO Read/Write Using CMD53



          - Please mention the error code that you see while the mentioned API fails.

          - In the firmware file that you have shared, I do not find the usage of mentioned API. Kindly, recheck.

          - Are you facing issues in setting up the S-Port socket or in using the API?


          Best regards,
          Srinath S

          • 2. Re: FX3S Facing Problem: USB -  SDIO Read/Write Using CMD53



            PFA, In "CyFxBulkLpDmaCallback" function, I have implemented"CyU3PSdioExtendedReadWrite" API with producer socket ID.


            In the first call, it is not throwing any error, but writing is not happening. In second call it is throwing an error "CY_U3P_ERROR_DEVICE_BUSY" (0x73). (Using USB Control Center to read/write Endpoint)

            • 3. Re: FX3S Facing Problem: USB -  SDIO Read/Write Using CMD53



              - In the CyU3PSdioExtendedReadWrite() API, the sckId parameter should be set to one of the SIB sockets and it should be a producer socket for read operations and consumer socket in case of write operations. I find that you have used a producer socket for write operations. Please modify this and try out.

              - Also, let me know between what sockets is the glChHandleBulkLp DMA channel created.


              Best regards,

              Srinath S

              • 4. Re: FX3S Facing Problem: USB -  SDIO Read/Write Using CMD53

                In CyU3PSdioExtendedReadWrite() APi, I tried producer socket for write operations, but it is throwing an error "CY_U3P_ERROR_DEVICE_BUSY" (0x7C).


                And Socket between DMA channel is as below:

                dmaCfg.prodSckId = CY_U3P_UIB_SOCKET_PROD_1;

                dmaCfg.consSckId = CY_U3P_SIB_SOCKET_1;


                is any changes are required in the descriptor.h file?


                I also followed the below steps:


                1. Created an auto DMA channel between UIB producer and Storage consumer (say socket 1).

                2. While creating, set the DMA to call back with CY_U3P_DMA_CB_RECV_CPLT notification, but CY_U3P_DMA_CB_PROD_EVENT is notifying not CY_U3P_DMA_CB_RECV_CPLT

                3. In the callback function, I am setting a RxFlag

                4. Looking for this RxFlag in Thread infinite for loop. When the flag is set to call CyU3PSdioExtendedReadWrite() API with consumer storage socket (i.e. socket 1)


                Still, Problem is the same


                I have attached full project, please look into

                • 5. Re: FX3S Facing Problem: USB -  SDIO Read/Write Using CMD53

                  CY_U3P_DMA_CB_RECV_CPLT and CY_U3P_DMA_CB_SEND_CPLT events will trigger when you operate DMA in override mode using CyU3PDmaChannelSetupRecvBuffer and CyU3PDmaChannelSetupSendBuffer API.


                  Note that you should not call CyU3PDmaChannelSetXfer API after creating the DMA Channel.


                  Since you are calling CyU3PDmaChannelSetXfer after creating the DMA Channel and you are not using CyU3PDmaChannelSetupRecvBuffer  API, therefore, CY_U3P_DMA_CB_RECV_CPLT  is not triggered.

                  This is implemented to MSC example firmware.


                  Please refer the attachment for DMAOverride details.


                  The DMA_CB_PROD_EVENT or DMA_CB_CONS_EVENT triggers when the DMA Channel type is AUTO_SIGNAL/ MANUAL mode. You will not received DMA_CB_PROD_EVENT or CONS_EVENT in DMA_AUTO mode.


                  In MANUAL DMA Channel, you need to commit the DMA Channel using commitbuffer API, so that the buffer will be available for consumer.


                  Please refer table 5.2  and section 7.1 for DMA examples in FX3_Programmers manual for more details on DMA Channel types and its configuration.