Flush DMA data between acquisitions on FX3

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

cross mob
mgiacomelli
Level 3
Level 3
25 replies posted 10 questions asked 25 sign-ins

I have implemented a working GPIF state machine that captures N individual lines of data, with one DMA buffer the size of one line.  At the end of acquisition, the state machine loops indefinitely at the final state waiting for a vendor command to reset the acquisition for a new frame.

I've been struggling with commiting/flushing data however.  I'll either get the last line of one acquisition prepended to the start of the next, or the current acquisition never completes (Begin/Wait/FinishDataXfer will time out), depending on the size of the acquisition. 

Things that are unclear to me:

1)  Do I need to flush  at the end state of the GPIF if I've made sure to capture exactly one buffer of data?  It seems like if I don't flush I may or may not get data returned.  

2)   I'm really confused about the remark in the reference manual saying that I need to read data while doing a commit to avoid a zero length packet.  I tried this (forcing the acquisition to end with a half full buffer), and without it the acquisition did not return data. With the read data it did, but I get one extra sample.  Is that expected?   

3)  For CY_U3P_DMA_TYPE_MANUAL_MANY_TO_ONE, is the callback called during the FLUSH state?  Or only when the buffer is actually full?

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

If the DMA buffer is full, then commit action need not be used in the GPIF state with IN_DATA

If the DMA buffer is partially filled, then  while sampling last data word commit action should be called along with IN_DATA to commit the partial buffer (short packet)

If only commit action is called in a state ZLP (empty buffer) will be committed.

As this is a multi threaded (gpif threads) application,  the DMA buffer from the GPIF sockets are expected to be committed in ping pong manner. So please check the thread number (in the action settings) is as expected  when the commit action  is called 

When the commit action is executed by the GPIF State machine, a producer event will be triggered (provided that the event is registered in the DMA channel configuration) in the DMA callback and the DMA buffer needs to be committed to the USB socket.

Regards,
Rashi

View solution in original post

0 Likes
4 Replies