timvideos / HDMI2USB-litex-firmware

A version of the HDMI2USB firmware based around LiteX tools produced by @Enjoy-Digital (based on misoc+migen created by @M-Labs)
https://hdmi2usb.tv
BSD 2-Clause "Simplified" License
145 stars 71 forks source link

Wireshark reports corrupted Frame Check Sequence for Mimas A7 #460

Closed rohitk-singh closed 6 years ago

rohitk-singh commented 6 years ago

Wireshark is reporting incorrect frame check sequence when using Gigabit Ethernet on Mimas A7.

@enjoy-digital @mithro Any ideas what could be going wrong here? Maybe issues with RGMII signal delays? Problem is I don't have a spare USB-Serial module to attach a litescope to and probe the RGMII signals. The only USB-Serial interface on MimasA7 is being used for firmware/bootloader console.

image

rohitk-singh commented 6 years ago

I'm planning to debug it via Etherbone target + Litescope without CPU, so that I wouldn't need to use the only UART for console, instead I will use it for Litescope samples extraction. BTW is there any reason Etherbone target for Nexys_video uses 140 MHz sys clock? Should the sys clock frequency be >= 125 MHz (or some other reason), or is it just any random value?

enjoy-digital commented 6 years ago

I'm not able to find the mimas a7 code, but you can maybe try to play with: https://github.com/enjoy-digital/liteeth/blob/master/liteeth/phy/s7rgmii.py#L133

When used with a CPU, you only need to have sys_clk_freq > 125MHz/4. When used with the hardware UDP/IP stack, the way it's instanciated in nexys_video, you need to have sys_clk > eth_clk (so 125MHz here).

GitHub
enjoy-digital/liteeth
Small footprint and configurable Ethernet core. Contribute to enjoy-digital/liteeth development by creating an account on GitHub.
rohitk-singh commented 6 years ago

@enjoy-digital Thanks! I'll take a look. Currently I'm trying to set up a litescope + etherbone design.

Apologies for not mentioning the code. It is here as part of the pull request: https://github.com/timvideos/HDMI2USB-litex-firmware/pull/447/commits/1dd165e8967e3b6f26087a24435f9e016c32917c

Pull request: #447 WIP: Support for Mimas A7

rohitk-singh commented 6 years ago

@enjoy-digital Did you mean for me to try with different phase values for the rx-clk (here: https://github.com/enjoy-digital/liteeth/blob/master/liteeth/phy/s7rgmii.py#L133) ?

GitHub
enjoy-digital/liteeth
Small footprint and configurable Ethernet core. Contribute to enjoy-digital/liteeth development by creating an account on GitHub.
enjoy-digital commented 6 years ago

You can try the etherbone design first and see what you get when you ping the board. Then you can try to adjust the phase if it's not working.

If it's not working, i think it will be easier for you to debug with the CPU:

GitHub
enjoy-digital/litex
Build your hardware, easily! Contribute to enjoy-digital/litex development by creating an account on GitHub.
GitHub
enjoy-digital/liteeth
Small footprint and configurable Ethernet core. Contribute to enjoy-digital/liteeth development by creating an account on GitHub.
rohitk-singh commented 6 years ago

@enjoy-digital Thanks for the great tips! The interesting thing is that etherbone design seems to be responding to pings. Here is the VCD dump for Ping request and response.

dump.zip image image

Maybe something is wrong with the TCP/IP stack. I'll try with enabling debug on uIP.

enjoy-digital commented 6 years ago

Good, then it should also work with the CPU. When loading the design with the CPU, are you loading with serialboot or tftp? If via serialboot, you should maybe try with tftp and enable debug in microudp.c. If tftp is working then yes it's probably in uip. If tftp is not working it could be a configuration issue or a timing constraint that is not applied correctly.

rohitk-singh commented 6 years ago

@enjoy-digital Sure, I'll try with enabling debug in microudp. I tried with serialboot till now. I'll try with tftp as per your recommendation. Pings were failing but I could see ARP and TFTP firmware request packets from boards in wireshark.

Thank you so much for all the help and great tips! It's been real life-saver! :)

rohitk-singh commented 6 years ago

@enjoy-digital It's working. Very weird. Last night I tried everything to get it working but it didn't. After following your structured steps for debugging it is now working without any issues and modifications! Thank you so much for your help! :)

Current Status

One more question: How do I use the etherbone interface of HDMI2USB firmware? I tried to use Litex server, which failed to read/write memory. Upon looking into the code, I found 2 interesting things, 1. Etherbone on HDMI2USB is implemented purely on software (which I was not expecting at all, ingenious idea!), 2. It uses TCP protocol, but Litex Server uses UDP protocol, so it wasn't working.

So, how do we actually use it? Is there any TCP client for Etherbone? cc: @mithro

enjoy-digital commented 6 years ago

I think it should simply work by doing in your script: wb = RemoteClient("192.168.1.50") :) (just maybe also verify the port)

rohitk-singh commented 6 years ago

OMG, LOL. Indeed it works. Thanks @enjoy-digital ! :)

Closing this issue.