I converted the linux LAN7800 driver to create a baremetal driver and it works perfectly if I am sending and receiving packets out through the interface.
The problem arises if you want to debug packets and put the LAN7800 into internal loopback mode.
Supposedly all you do is set bit 10 (INT_LOOP) on the MAC_CR
register.
So I do that and craft a packet and send, and then go and read the received packet. What I get back is rubbish, not even the header makes any sense.
There is a comment in the datasheet about not changing the mode while TXEN
and RXEN
are up and I even took them down and waited for the acknowledge that they were down. Then I changed the mode and brought them back up.
But nothing changed. All I ever get from the loopback is junk.
What am I missing?