qtudpfpga

Is it possible to restrict UDP packets being sent to an FPGA to a single host?


I'm trying to send data from a Qt application on a Windows 11 PC to an Arty A7-100T equipped with the Xilinx TEMAC IP Core.

Currently the Qt app just consists of a start/stop toggle button that, when pressed, sends a byte of data to the FPGA. If the byte is a specific number, one of the onboard LEDs toggles.

This works in that pressing the button on the Qt GUI will toggle the LED state, but sometimes the LED will toggle without me clicking anything, meaning that supposedly there's something else on my PC that is sending data to the FPGA. This happens regardless of whether I have the Qt application running or not, but it does not happen if I unplug the ethernet from the FPGA.

I thought that the QAbstractSocket::bind command with bindMode set to DontShareAddress would stop other services from communicating with the FPGA, but I guess that isn't the case.

What I can do to ensure the only thing sending data to the FPGA is my Qt application?


Solution

  • It isn't possible in the way that you mean, no. You can control the channel it listens on (which in this case is the port) but you cannot control who speaks on that port. You could try to find an empty port, as you have, but as you've discovered, there's no way to guarantee that no one else is talking on that port.

    What you could do is create a protocol that only your FPGA and Qt app are privy to.

    For example, you could hardcode a "password" on both ends. Lets say you decide to make it 7 digits, and the password is 1111111. Then the Qt app could send 8 bytes, with the first 7 being all 1's and the last being your specific number to activate the LEDs. Your FPGA would store each byte into a FIFO buffer of size 8 bytes. Then it would compare the first 7 against the password; if they are all 1's, then it could check if the last byte is that specific number and toggle the LEDs.

    This is why we have protocols and encryption; on any network, from a LAN to your University "private" network to the entire internet, no listener can know who it is that's speaking. And similarly, no speaker can know who's listening. Even when you unplugged your network cable, you still found that some other process is occasionally transmitting on that port. The only way to absolutely ensure only a single host is talking to your FPGA is to create a network containing only your FPGA and your desired host.