How can I append data before wrapping up AUTO DMA Bulk transmission?

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

cross mob
heanc_1330791
Level 2
Level 2

Hi,

I am using an FX3 to stream larger chuncks(~3MB) of data from GPIF to the host though a DMA channel set to AUTO_MANY_TO_ONE. I am triggering the GPIF Callback when reaching the end of the GPIF input data to WrapUp the channel and transmit the last partially filed buffer and end the transmission. I have a smaller chunk of status data (~128bytes) in the FX3s RAM I would like to append at the end of the transmission (that I dont have to transmit it separately).

Is there a way to append data to a BULK transmission in the GPIF callback before wrapping up an AUTO_MANY_TO_ONE DMA channel?

Is CyU3PDmaChannelSetupSendBuffer a way to go?

Thanks in advance.

0 Likes
1 Solution
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello,

- The CyU3PDmaChannelSetupSendBuffer() API cannot be used when the DMA channel is active. In other words, the DMA channel must be in the CONFIGURED state before calling the CyU3PDmaChannelSetupSendBuffer() API. In order to switch the channel into the CONFIGURED state, the CyU3PDmaChannelReset() API can be called.

- Another option would be to suspend the consumer socket whenever the additional data is to be added. This can be done through the CyU3PDmaChannelSetSuspend() API with the suspend type set as appropriate (In your case, you can set the suspend type as CY_U3P_DMA_SCK_SUSP_CONS_PARTIAL_BUF since you have mentioned that you need to add data only after the last partial buffer). When the socket is suspended, the CyU3PDmaChannelGetBuffer() API can be called to obtain handle to the DMA buffers and the custom data can be filled in and committed using the CyU3PDmaChannelCommitBuffer() API. Please refer to the below link for an example implementation.

FX3 DMA Socket Suspend

Best regards,

Srinath S

View solution in original post

0 Likes
1 Reply
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello,

- The CyU3PDmaChannelSetupSendBuffer() API cannot be used when the DMA channel is active. In other words, the DMA channel must be in the CONFIGURED state before calling the CyU3PDmaChannelSetupSendBuffer() API. In order to switch the channel into the CONFIGURED state, the CyU3PDmaChannelReset() API can be called.

- Another option would be to suspend the consumer socket whenever the additional data is to be added. This can be done through the CyU3PDmaChannelSetSuspend() API with the suspend type set as appropriate (In your case, you can set the suspend type as CY_U3P_DMA_SCK_SUSP_CONS_PARTIAL_BUF since you have mentioned that you need to add data only after the last partial buffer). When the socket is suspended, the CyU3PDmaChannelGetBuffer() API can be called to obtain handle to the DMA buffers and the custom data can be filled in and committed using the CyU3PDmaChannelCommitBuffer() API. Please refer to the below link for an example implementation.

FX3 DMA Socket Suspend

Best regards,

Srinath S

0 Likes