How to transfer a data with small size?

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

cross mob
Anonymous
Not applicable

 Hi,

   

   I configure FX3 DMA in 1024bytes packet size and burst of 4. And the dmaCfg.size is 1024x4 = 4KB.

   

If I want to transfer a data from PC to FX3 or FX3 to PC, what's the dedicated API can be use to handle the

   

transmission of data size less than dmaCfg.size (4KB)?

0 Likes
2 Replies
Anonymous
Not applicable

There are a few ways to do this:

   

 

   

1. if your DMA channel is from GPIF to some other socket, then you can use the COMMIT action in GPIF designer to send the partially filled buffer (less than 4KB in your situation) to the PC

   

2. if the channel is from USB to some socket, then you should either send a zero byte packet in the last transfer or send a short packet. For example, if you want to only send 3KB, then send 3KB from PC and then send 0 bytes. This last packet will cause the 3KB to be wrapped up on the USB socket.

   

On the other hand, if you want to send 3.2KB (3276 bytes), then there is no need to send a 0 byte packet because the last packet sent by the PC will be 0.2KB (204 bytes) is a short packet. This short packet will cause the buffer to automatically wrap up

   

3. for other types of sockets, you need to use the CyU3PDmaChannelSetWrapUp API. This can be used for GPIF and USB sockets too but it is not mandatory as I just explained.

I have similar conditions for USB OUT endpoint (ingress/producer socket).

No one send zero packets on packet size boundary.

CyU3PDmaChannelSetWrapUp works fine by calling it periodically.

It would be a cleaner to call this function only when it necessary, when data received from host but not wrapped-out (released/committed).

Is there a way to detect condition of non-empty state of ingress socket ?

0 Likes