BULK OUT transfer failed with Error Code:997 while transfering file above 4MB

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

cross mob
amjoc_3854616
Level 3
Level 3

I'm trying to write to NOR flash via SPI interface through the control center utility. I am using bulk out endpoint to transfer data to nor flash .After complete data is transfered to NOR flash , FPGA is configured by transferring data from NOR flash to FPGA .SDK using is  EZ-USB FX3 SDK 1.3.4 .

NOR Flash used : Micron Serial NOR Flash Memory, MT25QU01GBBB.

Bulk out transfer is not consistent on transferring data above 4 MB. I am getting BULK OUT transfer failed with Error Code:997.

Can you help me with this?

I am attaching the source code.

Details of code :

1.NOR flash is erased upon receiving USB vendor commands.

2.After erase is completed , file is transferred to NOR flash via bulk out endpoint..

3. On Transfer complete , FPGA is configured.

dmaCfg.size = 43008;

dmaCfg.count = 4;

0 Likes
1 Solution

Hi Hemanth,

Issue is resolved by increasing the bulk endpoint timeout for file transfer in control centre application.

View solution in original post

0 Likes
13 Replies
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

Are you using Cypress cyusb3.sys driver? Please let me know the frequency of the failures?

And do you get 997 error each time the failure occurs?

Regards,

Hemanth

Hemanth
0 Likes

Hi Hemanth ,

Yes , I am using cyusb3.sys driver. Please find the path from the SDK..

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\driver\bin\Win10\x64.

0 Likes

Hi Hemanth ,

I am currently trying to transfer 6692572 bytes bin file and I was never successfully able to transfer it. By increasing the buffer size I was able to reach til 5.5Mb , but it was not consistent. Everytime I got the 997 error. 

0 Likes

Could you please tell me whether I should edit source code of control centre?

0 Likes

Hi Hemanth,

I did some modifications in the code. In the DMA callback if I just set a flag and in the main function , I check the flag value and do discard buffer , but bulk out transfer fails after sending around 4.5Mb data.

If I do discard buffer in the callback itself , no transfer errors are seen.

I have to do SPI transfer after receiving buffer.Is there any way I can solve this issue. I need to avoid USB timeout. If this has to be done in control centre source code , can you please help me with code. Attaching the code for your reference.

void

BulkLpAppThread_Entry (

        uint32_t input)

{

.

.

.

     CyU3PDebugPrint (2, "\r\n %d : %x\n", glDMARxCount,spi_count);

    if (glCallback == CyTrue)

    {

            stat =  CyU3PDmaChannelDiscardBuffer(&glChHandleBulkLp1);

            if (stat != CY_U3P_SUCCESS)

            {

            CyU3PDebugPrint (4, "CyU3PDmaChannelDiscardBuffer failed, Error code = %d\n", stat);

            }

            glCallback = CyFalse;

    }

}

void

CyFxBulkLpDmaCallback (

        CyU3PDmaChannel   *chHandle, /* Handle to the DMA channel. */

        CyU3PDmaCbType_t  type,      /* Callback type.             */

        CyU3PDmaCBInput_t *input)    /* Callback status.           */

{

    uint16_t index;

    CyU3PReturnStatus_t status = CY_U3P_SUCCESS;

    if (type == CY_U3P_DMA_CB_PROD_EVENT)

    {

        /* Increment the counter. */

        glDMARxCount++;

        glCallback = CyTrue;

}

dmaCfg.size  = 4096;

dmaCfg.count = 16;

0 Likes

Hi Hemanth,

I tried increasing the buffer size to 16KB and count to 8. Sometimes I was able to transfer 6MB , but most of the time it was failing.Can you suggest any way to solve this?

How can I control the dma callback frequency?Can you reply asap as I am stuck in development?

0 Likes

Hi Amal John,

Can you please install the attached cyusb3 driver and test?

Password for the attachment: cypress

Regards,

Hemanth

Hemanth
0 Likes

Hi Hemanth,

I tried installing new driver , but maximum file size I could transfer was 6029312 bytes. My final bin file size is 6692572 bytes.

0 Likes

Hi Hemanth,

Is there any way I can solve this issue?

0 Likes

Hi Hemanth,

Could you please increase the  curEndpt.TimeOut in control centre application and share the new application. I am new to Visual studio and facing issues while compiling.

0 Likes

Hi Hemanth,

Could you please explain what changes you made in the driver you provided me earlier? As it didnt fix the issue shall  I expect another driver from you  which could solve my issue?Also please share the release note.

0 Likes

Hi Hemanth,

Issue is resolved by increasing the bulk endpoint timeout for file transfer in control centre application.

0 Likes
amjoc_3854616
Level 3
Level 3

Can anyone help me with this?

If I increased the dma buffer size and reduce the count , i was able to transfer upto 5.5 Mb but after that bulk transfer fails. My requirement is to transfer upto 10 Mb. In betweeen transfer I could see USB not responding comes in control centre.

Can anyone say where I am going wrong. In the callback , I am writing to NOR flash and discarding the buffer , then is there any possibility of buffer unavailability?

0 Likes