It is recommended to have the endpoint size to be the same as the allowed maz packets sizes by the usb spec. (512 bytes for high speed, 1024B for super speed.) And the DMA Buffer Size is recommended to be a multiple of EP Size.
All our example projects follow this apprach. In your case, 16*1024 as buffer size is fine. You can keep the EP Size as 512 / 1024 for HS / SS respectively.
Q1:I have some problems about DMA buffer.The maximun buffer is 64K-16 bytes,and there are 256KB space for DMA data memory.I don't know the meaning of 16 (64K-16)mentioned above.The AN65974 indicates an application which has two transfer channels(PtoU &UtoP),one channel has 8 buffers and each buffer size is 16KB,and another channel has 4 buffers whose size is also 16KB.However,my application creates a DMAMultiChannel(two producer sockets)whose buffer size is 32KB and count is 4.The renumeration of FX3 fail in this configuration,whereas it works when buffer size is 16KB.
Q2:As above,two producer sockets and four buffers,how to allocate buffer for each socket?
1. Each DMA buffer has a descriptor associated with it. These descriptors contains meta data about the data in these buffers. In these descriptors, there is a 12 bit field to indicate the size of the DMA buffer in multiples of 16 bytes. Hence the maximum size of each DMA buffer possible is (2^12 - 1) *16 bytes.
2. Do you have 4 , 32 KB buffers for each channel , i.e. do you have a total of 8 ,32 KB buffers. The count of buffers allocated depends on you. Just ensure that the maximum size of each buffer is not exceeded and the total DMA buffers size is also not more then what is allocated.
My application has 4,32KB buffers for the only channel(P to U),i.e.the total buffers are 4,32KB.But the FX3 only works at 4,16KB buffers.How many are the total buffers(maximum size of each buffer & total DMA buffers size) I can allocate?
Thanks a lot.
4,32 KB buffers amounts to a total DMA buffer area of 128KB and it should work. As you mentioned, you have only single DMA channel in your application. There are no other DMA buffers being created. Please confirm this.
Use the GPIFTOUSB example project and modify the buffer size to be 32K and count as 4 . Check if this enumerates.
Thank you for your reply.Can you recommend a GPIFTOUSB example project which has only single DMA channel for me?
Thanks a lot!
SDK >> Firmware >> Basic_examples >> cyfxgpiftousb
Use this example
i have this code for 4 endpoint, but i cant send data from fpga to fx3. what is the problem?
can the problem from verilog coding?
in this code i want have 4 endpoint and can send data with two channel to fx3. i changed the slavefifosync project.
SlaveFifoSync_1.zip 2.0 MB