I'm programming an ENC28J60 driver at the moment, and have encountered something odd when attempting to receive packets. More specifically, unicast packets.
According to the datasheet, when the unicast filter is enabled, any unicast packet with a destination MAC address not matching the MAC address stored in the registers gets discarded.
I've written the following filters to ERXFCON:
That means it should allow unicasts with a matching MAC, broadcasts, multicasts, while rejecting packets that don't have a matching CRC.
I plug the ENC into the router I have, and all is well - I'm receiving broadcasts. Nice! Then I attempt to start DHCP. The DHCPDISCOVER packet gets sent. Nice!
... But where's the DHCPOFFER?
Looking at wireshark shows the router has tried to send it, at least. I've plugged my computer into a mirrored port. The destination MAC of the unicast DHCPOFFER packet is indeed matching the MAC address I've written into the registers. And yet ENC decides to reject it. Of course this isn't an issue if I disable these filters entirely, but then I have to let my software handle it, and why should I do that when the hardware is capable of doing that?
In short, I'm not sure why the ENC is rejecting unicode packets when everything seems in order.