Search code examples
ipportfpgaethernetifconfig

Receice UDP Packets on fpga


I'm trying to send data from my PC to FPGA with ethernet cable.

I used this code for receiving packet's that send from my PC to FPGA (through Ethernet cable). I capture received packets on FPGA with ila(integrated logic debugger).

After programming FPGA when i used ifconfig on my linux pc, i see below: (I hidden my MAC Address)

enp7s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1490
        ether xx:xx:xx:xx:xx:xx  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1427  bytes 199195 (199.1 KB)
        TX errors 1071  dropped 0 overruns 0  carrier 0  collisions 0

As i knew from this similar question, My FPGA don't have any specific ip address and even port number. it's listen on every packets that sent on RXD (ethernet mii) according to it's MAC Address.

How i can send packets to FPGA when even i haven't any specific IP and Port?

I think i should set port and IP for my FPGA in my PC(no need to change hardware) but i don't know how do it?


Solution

  • there are few options.

    • if the FPGA is directly connected to your interface, then it will receive anything you send, so no worry about the network config
    • if you have a switch between, you could send a broadcast message, that would be forwarded to all device in the network (assuming you don't have a complex config in your switch like vlan or similar) .

    about broadcast: https://en.wikipedia.org/wiki/Broadcasting_(networking) it is simply a dest mac with FFs

    as for the actual sending, you could be using python to generate and send your packet. scapy is a very simple package that should help you for that doc: https://scapy.readthedocs.io/en/latest/usage.html

    look at this particular example:

    sendp(Ether()/IP(dst="1.2.3.4",ttl=(1,4)), iface="eth1")