-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Probable issue fix when sending more than 512 bytes #10
Comments
Thank you for finding and fixing this bug, which are very helpful for the improvement of this repo! I will review and update it when I have time (a few days later). Besides, if this repo is useful for you, welcome to star it. |
Thanks! Starred. |
Hello, I carefully look at the waveform you showed and find a question: The following figure in FT2232H datasheet page 31 shows the correct waveform of synchronous FIFO mode. Similar waveforms can be seen from the simulation examples I provided in the SIM folder. To recur the situation in your test, I constructed a case where the To verify this, I also carried out a test, and found that when the Host PC received the data sent from the FPGA, there was no data loss (including on the boundary of each transmission) whenever send length >=512B or <512B. Perhaps you can tell me more details about your test in which you found this bug. Note: |
Hello, About C/C# code: About Verilog code and constraints: What's strange is that i can not reach more than 4Mbps, that sounds me asynchronous mode. Analyzer Enabled:
Analyzer Disabled:
Also I've some other timing problem. I'm using this library wrapped on a protocol I've write. If I enable the analyzer it works, if not it does not. There are for sure timing problem, not caught at Place & Route compile time. Thanks for your help! Attached my test projects. |
Hi,
I roughly read your Verilog (
because By the way, the method of implementing loopback can be simpler, just connect to TX interface and RX interface:
Then, back to the main problem, you found that there is a probable issue when sending more than 512 bytes. It doesn't matter that I'd recommend you to completely use my test code (fpga_top_example_ft232h.sv and supporting python test program in my repo). If there is no any issue, you can modify it to your application as you wish. I have not used Lattice FPGA, and I do not understand its timing constraint process, so I cannot directly advise you on timing. But when I looked at the ECP5 board User Guide, I found that there was no FT2232H chip on it that could be used for sync-245 fifo mode communication (there was a FT2232H used as a JTAG, but it could not be used for sync-245 fifo mode communication). It seems that you have an external FT2232H module, so there is a very critical hint: the wiring from FPGA to FT2232H must be short enough (including the length of the wiring on the PCB), preferably within 5cm, because the clock frequency of the interface between them is up to 60MHz. If you connect FPGA and FT2232H module with DuPont cable or flying wire, it is almost impossible to work normally. At least, they should be connected in the way of pin insertion. Even so, if the distance between them is not close enough, they may still not work properly. You can send me a photo of the boards. Don't feel frustrated for hardware debugging failure, because once you succeed, your sense of achievement will be stronger. Welcome to contact me again and wish you all the best :) |
I've look at your board's photo. Obviously, it is not reliable to use DuPont wire to connect. Btw, It seems hard to find an FPGA development board with FT232H/FT2232H chips (I use a PCB I drew myself). However, you can try to plug the FPGA and the FT2232H board directly by the 2.54mm pin header (if there is no connection error, be careful to burn the board). In fact, you don't need to worry too much about half duplex or full duplex, and you don't need to use Verilog to deliberately control half duplex. My |
Hello, |
Hello @WangXuan95 and thanks for this IP, it saves me a lot of time.
I've ported your code to Verilog.
I'm working on a ECP5 Lattice, running at synchronous mode a FT2232H.
I've built a simple project to loopback and test data. My sample program is in C and C#. I'm using the FTDI driver.
I've found a issue when sending/receiving more than 512 bytes.
It keeps me a couple of days but finally I've been able to solve the issue.
It happens only when TXE and WR goes up at the same cycle, find image as reference, this cause the txfifoo_wtrans_i to get full.
My solution was to disable the input buffer of this module and wait for the buffer to became empty when TXT get high.
Hope this helps!
Find below the changed code, in Verilog, but you can easily port to SystemVerilog
From this:
To this:
The text was updated successfully, but these errors were encountered: