FX3 DMA and Interrupt callback

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

cross mob
lock attach
Attachments are accessible only for community members.
wyw
Level 3
Level 3
25 replies posted 25 sign-ins 10 replies posted

In my project, there are two interrupt endpoints, 0x01 and 0x81, and the DMA configuration for the interrupt OUT endpoints is as follows:

dmaCfg_int_ep1_out.size = 1024;
dmaCfg_int_ep1_out.count = CY_FX_INT_DMA_BUF_COUNT;
//dmaCfg_int_ep1_out.prodSckId = CY_FX_UIB_INT_EP_PRODUCER_CMD_SOCKET;
dmaCfg_int_ep1_out.prodSckId = CY_U3P_UIB_SOCKET_PROD_1;
dmaCfg_int_ep1_out.consSckId = CY_U3P_CPU_SOCKET_CONS;
dmaCfg_int_ep1_out.dmaMode = CY_U3P_DMA_MODE_BYTE;
dmaCfg_int_ep1_out.notification = CY_U3P_DMA_CB_PROD_EVENT;
dmaCfg_int_ep1_out.cb = CyFxEP1_OUT_CMD_DmaCallback;
dmaCfg_int_ep1_out.prodHeader = 0;
dmaCfg_int_ep1_out.prodFooter = 0;
dmaCfg_int_ep1_out.consHeader = 0;
dmaCfg_int_ep1_out.prodAvailCount = 0;
apiRetStatus = CyU3PDmaChannelCreate (&glChHandle_H2F_CMD, CY_U3P_DMA_TYPE_MANUAL_IN, &dmaCfg_int_ep1_out);
if (apiRetStatus != CY_U3P_SUCCESS)
{
CyU3PDebugPrint(CY_FX_DEBUG_PRIORITY, "EP1 OUT CyU3PDmaChannelCreate failed, Error code = %d\r\n", apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}

/* Set DMA Channel transfer size */
apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandle_H2F_CMD, CY_FX_BULKSRCSINK_DMA_TX_SIZE);
if (apiRetStatus != CY_U3P_SUCCESS)
{
CyU3PDebugPrint(CY_FX_DEBUG_PRIORITY, "EP1 OUT CyU3PDmaChannelSetXfer failed, Error code = %d\r\n", apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}

apiRetStatus = CyU3PDmaChannelSetWrapUp (&glChHandle_H2F_CMD);
if (apiRetStatus != CY_U3P_SUCCESS)
{
CyU3PDebugPrint(CY_FX_DEBUG_PRIORITY, "EP1 OUT CyU3PDmaChannelSetWrapUp failed, Error code = %d\r\n", apiRetStatus);
CyFxAppErrorHandler (apiRetStatus);
}

When I download the project-compiled firmware to the FX3 development board, the interrupt callback that interrupts the OUT endpoint is executed once,Attached is my project. Could you help me check it,please.

0 Likes
1 Solution
Biren_R
Moderator
Moderator
Moderator
First question asked First like given 250 sign-ins

we suspect that CyU3PDmaChannelSetWrapUp API is triggered this interrupt on startup, can you comment out this API-related code and test it.

Best Regards,
Biren

View solution in original post

0 Likes
3 Replies
Biren_R
Moderator
Moderator
Moderator
First question asked First like given 250 sign-ins

we suspect that CyU3PDmaChannelSetWrapUp API is triggered this interrupt on startup, can you comment out this API-related code and test it.

Best Regards,
Biren

0 Likes
wyw
Level 3
Level 3
25 replies posted 25 sign-ins 10 replies posted

Hi,I commented out the CyU3PDmaChannelSetWrapUp API so that the interrupt callback would not enter on startup, but I set the DMA buffer to 1024 bytes and might actually only receive 64 bytes, so that the interrupt would not be triggered.How do you deal with that?

0 Likes
Biren_R
Moderator
Moderator
Moderator
First question asked First like given 250 sign-ins

You can test the same features with the USBBulkSourceSink example which you can find at this path (C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\basic_examples\cyfxbulksrcsink), DMA size is 1024 but sill if you send small no data they still hit call back function. 

Please test this and let us know if you need more help on this topic.

Best Regards,
Biren

0 Likes