5 Replies Latest reply on May 19, 2019 3:10 AM by MoLa_3842091

    help with raid1 example code

    MoLa_3842091

      Regarding Raid1 example code, in the CyFxMscApplnDmaCb () function, is the "CyU3PDmaBuffer_t dmaBuf = input->buffer_p" used to hold the read/write operation when data is transfered between to/from sdCard via dma?

       

      any helpful answer is appriciated

        • 1. Re: help with raid1 example code
          KandlaguntaR_36

          Yes, dmaBuf in Dma callback function holds data when there is a read/write operation.

          You cannot modify the data when the dma channel is AUTO. You can modify in Manual channel.

          1 of 1 people found this helpful
          • 2. Re: help with raid1 example code
            MoLa_3842091

            Thanks for your response,

            I understand that I should change CY_U3P_DMA_TYPE_AUTO to CY_U3P_DMA_TYPE_MANUAL when creating dma channel, Is that the only change I should do in the Raid1 example code?

            • 3. Re: help with raid1 example code
              KandlaguntaR_36

              >> I understand that I should change CY_U3P_DMA_TYPE_AUTO to CY_U3P_DMA_TYPE_MANUAL when creating dma channel, Is that the only change I should do in the Raid1 example code?

               

              In addition to this, you need to add a notification (Producer_Event) and dma callback function while creating the DMA Channel. In the dma callback function, you have to explicitely commit the dma buffer using CyU3PDmaChannelCommitBuffer API. You may refer bulklpmanual example for this (C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\dma_examples\cyfxbulklpmanual)

              1 of 1 people found this helpful
              • 4. Re: help with raid1 example code
                MoLa_3842091

                Thanks, I have been looking at the refered example, so far it's helpful.

                Now I want to use gdb for debuging the code running in the raid1-usb-dongle-on-chip but this is what I get:

                Error in final launch sequence

                Failed to execute MI command:

                -exec-run

                Error message from debugger back end:

                Don't know how to run.  Try "help target".

                Don't know how to run.  Try "help target".

                 

                What changes should I do in the debug configurations to make it work?

                • 5. Re: help with raid1 example code
                  MoLa_3842091

                  Hi,

                  I'm trying to change the buffer (as shown in the underlined part of the code) in  the cyfx3s_raid1.c  file,  but finally no changes appear to me after compiling and burning the image into the usb raid dongle-on-chip! any helpful feedback is appreciated.

                  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];

                      input->buffer_p.buffer[index] = 3;

                              }

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

                  if (status != CY_U3P_SUCCESS)

                  {

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

                  }

                  GLCommitCount++;

                      }