0 Replies Latest reply on Aug 18, 2017 12:47 PM by hosseini_sm_2024016

    FX3S mass storage using Manual DMA

    hosseini_sm_2024016

      Hi,

         

      I want a mass storage device with ability of editing data before write to sd card. I used mass storage example in SDK with two S ports and changed MscOut channel handle from AUTO to MANUAL and I added commit function to the callback function(no operation on data for now). Here are the changes: 

         

      /* #####1#####

         

      dmaConfig.size           = 1024 * CY_FX_MSC_EP_BURST_SIZE;
          dmaConfig.count          = CY_FX_MSC_DMA_BUF_COUNT;
          dmaConfig.prodSckId      = (CyU3PDmaSocketId_t)(CY_U3P_UIB_SOCKET_PROD_0 | CY_FX_MSC_EP_BULK_OUT_SOCKET);
          dmaConfig.consSckId      = CY_U3P_SIB_SOCKET_0;
          dmaConfig.dmaMode        = CY_U3P_DMA_MODE_BYTE;
          dmaConfig.notification   = (CyU3PDmaCbType_t) (CY_U3P_DMA_CB_RECV_CPLT | CY_U3P_DMA_CB_PROD_EVENT);
          dmaConfig.cb             = CyFxMscApplnDmaCb;
          dmaConfig.prodHeader     = 0;
          dmaConfig.prodFooter     = 0;
          dmaConfig.consHeader     = 0;
          dmaConfig.prodAvailCount = 0;

         


          status = CyU3PDmaChannelCreate (&glChHandleMscOut, CY_U3P_DMA_TYPE_MANUAL, &dmaConfig);

         

      #####1##### */

         

      /* #####2##### this is added in CyFxMscApplnDmaCb()

         

          CyU3PReturnStatus_t status = CY_U3P_SUCCESS;
          if (evtype & CY_U3P_DMA_CB_PROD_EVENT)
              status = CyU3PDmaChannelCommitBuffer (handle, input->buffer_p.count, 0);

         

      #####2##### */

         

       

         

      CBW and CSW works fine but can not write files to sd from windows os.

         

      Any idea why it does not work?