how to reset the DMA buffer

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

cross mob
laden
Level 1
Level 1
10 sign-ins 5 replies posted 5 sign-ins

hi, I  want to transfer data from the gpif to PC. the fx3 was working dma auto mode, gpif  width=16bits,I want reset the DMA buffer before every  transfer to clear the DMA buffer data。How should I do,thx

0 Likes
1 Solution
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi,

You could reset the channel using CyU3PDmaChannelReset(..} API and flush the endpoints using CyU3PUsbFlushEp(..) API when the device config is changed. You could refer to ApplnStop(..) functions in the FX3 SDK. (replace channelDestroy with channelReset)

Best Regards,
AliAsgar

View solution in original post

0 Likes
7 Replies
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi,

Could you let us know why DMA buffer needs to be cleared before every transfer?

Memset function could be used to clear the DMA buffer data, after the buffer has been consumed by the USB Side.

Best Regards,
AliAsgar

0 Likes
laden
Level 1
Level 1
10 sign-ins 5 replies posted 5 sign-ins

I need make sure the first data timing from the gpif is accuracy. 

0 Likes
laden
Level 1
Level 1
10 sign-ins 5 replies posted 5 sign-ins

Is there some demo code about "Memset function " could clear the DMA buffer data?

0 Likes
laden
Level 1
Level 1
10 sign-ins 5 replies posted 5 sign-ins

???

0 Likes
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi,

"I need make sure the first data timing from the gpif is accuracy." Could you let us know what you meant by this?
Could you elaborate more on why DMA buffer needs to be cleared before every transfer?

Best Regards,
AliAsgar

0 Likes
laden
Level 1
Level 1
10 sign-ins 5 replies posted 5 sign-ins

I need get a 16K byte data from a stream device that can be config by pc,after change the device ,the dma buffer(such as 4K) has filled by the data  which was configed last time .When PC get the 16K data from the DMA buffer,4K of the 16K data is not from the device with  current config.It is not acceptable,and the stream device can not be intteruput.So I need to clear the DMA buffer,befor get the data from the DMA buffer.

0 Likes
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi,

You could reset the channel using CyU3PDmaChannelReset(..} API and flush the endpoints using CyU3PUsbFlushEp(..) API when the device config is changed. You could refer to ApplnStop(..) functions in the FX3 SDK. (replace channelDestroy with channelReset)

Best Regards,
AliAsgar

0 Likes