4 Replies Latest reply on May 29, 2019 1:34 AM by lastf0042_3842091

    Raid1 example code issue

    lastf0042_3842091

      I'm using the raid1 usb-dongle-on-chip and using Raid1 example code to run the device. I'm trying to display the data that is written to the SD card using the  CyU3PDebugPrint  but when doing this it prints the first 8 bytes and then it stucks!

       

      This is the code:

         if (type == CY_U3P_DMA_CB_PROD_EVENT)

          {

          CyU3PDmaCBInput_t *input1=input;

                  for (index = 9; index < input1->buffer_p.count; index++)

                  {

                  CyU3PDebugPrint (4, "Write buffer before change [%d] = %x\r\n", index, input1->buffer_p.buffer[index]);

                  }

      /* This is a produce event notification to the CPU. This notification is

      * received upon reception of every buffer. The buffer will not be sent

      * out unless it is explicitly committed. The call shall fail if there

      * is a bus reset / usb disconnect or if there is any application error. */

      status = CyU3PDmaMultiChannelCommitBuffer (chHandle, input->buffer_p.count, 0);

      if (status != CY_U3P_SUCCESS)

      {

          CyU3PDebugPrint (4, "CyU3PDmaChannelCommitBuffer failed, Error code = %d\r\n", status);

      }

      GLCommitCount++;

          }

      }

        • 1. Re: Raid1 example code issue
          KandlaguntaR_36

          You are not supposed to use CyU3PDebugPrint  in DMACallback.

          Please copy the input buffer to a global buffer and print in the main thread.

          What is the amount of data that you are sending to SD card at a time and expecting to print in the dma callback?

           

          • 2. Re: Raid1 example code issue
            lastf0042_3842091

            Thanks,

            >>What is the amount of data that you are sending to SD card at a time and expecting to print in the dma callback?

            I'm sending a small text file containing numbers 1 to 8 from host to sd-card.

             

            Even if i try to change data in the DMA callback function [CyFxMscApplnMultiDmaCb] as shown in the code below, the copy process from host to SD-card stuck forever, what is wrong in doing this step?

             

                if (type == CY_U3P_DMA_CB_PROD_EVENT)

                {

            /* This is a produce event notification to the CPU. This notification is

            * received upon reception of every buffer. The buffer will not be sent

            * out unless it is explicitly committed. The call shall fail if there

            * is a bus reset / usb disconnect or if there is any application error. */

                for (index = 0; index < input->buffer_p.count; index++)

                {

                input->buffer_p.buffer[index] = ~(uint8_t)input->buffer_p.buffer[index];

                }

            status = CyU3PDmaMultiChannelCommitBuffer (chHandle, input->buffer_p.count, 0);

            if (status != CY_U3P_SUCCESS)

            {

                CyU3PDebugPrint (4, "CyU3PDmaChannelCommitBuffer failed, Error code = %d\r\n", status);

            }

            GLCommitCount++;

                }

            }

            • 3. Re: Raid1 example code issue
              KandlaguntaR_36

              As said in FX3SMSC_RAID1_Rev2 , there are additional overheads
              (related to the file system that you use in your case) that sends to the sd card before writing the actual data.

               

              Hence, you will receive producer event for every buffer of data transfer from UIB to SD card. It will have overhead + data.

               

              Please let us know why you want to modifty the data being sent to SD card.

              • 4. Re: Raid1 example code issue
                lastf0042_3842091

                Thanks,

                Because I want to XOR the data passing IN/OUT  through the fx3s processor. It's a study project that I need to accomplish.

                 

                Any helpful feedback is appreciated