- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
According to project requirements,the host will transfer one frame to the FPGA.The size of the frame is 2160KB.In order to reduce errors, we will add a frame header such as “0x55AA_66BB” in front of the frame.So the size of transfer data is 2160KB+4B.What should I do ?
The KBAhttps://community.cypress.com/t5/Knowledge-Base-Articles/Data-sent-from-Host-over-USB-is-not-Committ... said:
If X > 16 KB, then let Y = (X % 16 KB). Now:
i) If Y == 0, then on completion of X bytes nothing needs to be done.
ii) If Y < 16 KB and (X % 1024) == 0, then on completion of X bytes, a zero-length packet must be sent so that the buffer in the device gets committed to GPIF.
But in my design,X>16KB,Y<16KB and (X)
Jack chen
Solved! Go to Solution.
- Labels:
-
USB Superspeed Peripherals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Thank you for the clarification.
For your case, the size of DMA buffer is 16KB and the frame size (along with header) is 2160KB + 4B. The sum 2160KB + 4B is not divisible by 16KB. This means that the last DMA buffer will have 4B data and will not be committed to the FPGA side. So, you need to send a ZLP (Zero Length Packet) after one frame is transferred (2160KB + 4B) from the host.
Jayakrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Please let me know the size of the DMA buffer used in the firmware so that we can check if the calculations should be done on 16KB or not.
Based on your description, I find that the total frame size is 2160KB. Is the 4B header added at the host side before sending the data to the device or is it added on the firmware side? How is this header added? Is it before the start of the frame?
Jayakrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Thanks for your reply.
The size of the DMA buffer used in the firmware is 16KB.
The project require us to transfer pictures from host to the FPGA.We want to add the 4B header before the start of every frame,but we do not know how to do it.The 4B header is used for FPGA checked correctness of the frame.The 4B header added at the host side in my plan.But if I add the 4B header at the host side,the total size of one frame will be 2160KB+4B,and i do not know how to transfer this by host.
So do you have some advice to meet my needs?
Jack chen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As that KBA mentioned:
If X > 16 KB, then let Y = (X % 16 KB). Now:
i) If Y == 0, then on completion of X bytes nothing needs to be done.
ii) If Y < 16 KB and (X % 1024) == 0, then on completion of X bytes, a zero-length packet must be sent so that the buffer in the device gets committed to GPIF.
But in my design,X>16KB,Y<16KB and (X%1024)!=0. what should i do to transfer this frame at the host side.
Jack chen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Thank you for the clarification.
For your case, the size of DMA buffer is 16KB and the frame size (along with header) is 2160KB + 4B. The sum 2160KB + 4B is not divisible by 16KB. This means that the last DMA buffer will have 4B data and will not be committed to the FPGA side. So, you need to send a ZLP (Zero Length Packet) after one frame is transferred (2160KB + 4B) from the host.
Jayakrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Thanks a lot.
As you metioned,the code as follow at the host side.
xferdata(frame,len);//frame saved the header and picture //data,len=2048*1080+4= 2160KB+4B
xferdata(buf,len1);//len1=0
Is that correct?
Jack chen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Yes, the code mentioned in your previous response is proper.
Jayakrishna