help with raid1 example code

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MoLa_3842091
Level 3
Level 3
5 likes given First like given

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

0 Likes
1 Solution
KandlaguntaR_36
Moderator
Moderator
Moderator
25 solutions authored 10 solutions authored 5 solutions authored

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.

View solution in original post

6 Replies
KandlaguntaR_36
Moderator
Moderator
Moderator
25 solutions authored 10 solutions authored 5 solutions authored

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.

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?

0 Likes

>> 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)

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?

0 Likes

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

    }

0 Likes

Hello,

FX3S Raid 1 application is not recommended for modifiying the data in the firmware.

If you want to do any such modifications, please identify what is the overhead and what is actual data in the firmware and do XOR.

You may capture USB trace with Wireshark to idently flow of data from USB host to device. This will help you to identify what is the overhead and what is the actula data being sent.

Regards,

Sridhar

0 Likes