Forum Discussion
Altera_Forum
Honored Contributor
7 years ago --- Quote Start --- We are currently trying to configure it with VHDL and it is successful in configuring the TSE but are unsuccessful in configuring the PHYs. We are trying to trigger a device over Ethernet and accept data for a custom application. --- Quote End --- I've attached some code that worked for me. It's a bit of junk code with all sorts of things I was playing around with. It's easier for me to tell you the lines to look at than to try and clean it up. The EMAC is generated in 10/100 only mode and we hardwired the speed to 100 Mbit full-duplex. The CLK was 50 Mhz. We used MII to talk between the FPGA and Phy. If you are using gigabit, you will need to make appropriate changes (will require the 88E1111 datasheet), but the basics of talking to the Phy should work. Suggest getting it to work in 10/100 first. Line 246 begins the EMAC declaration. Line 352 are the register specifications. Line 431 begins the Phy registers. Note that you should add 0x80 to the Phy register to get the value that should be written to the EMAC. For example, infamous Phy register 20 is 0x80 + 0x14 = 0x94. This code is probably much more fancy than it needs to be in a final system, but it was useful when making all sorts of tests to try and figure out how this ridiculous Phy chip works. The EMAC state machine types start on line 475. Line 533 is the set of values we write to the EMAC. Line 709 is important. The mdio line needs to be tristated when acting as an input. The EMAC configuration logic begins on line 781. As I recall, the long waits on lines 836 and 844 were a key to get the whole thing working. I'd recommend adding code to read back the Phy registers to make sure you are even communicating with it at all (see line 887). I'd also recommend using SignalTap to see how the external lines are changing. As others have said, if this is for your own board, avoid the 88E1111. Despite Marvell's "customer hostile" attitude, I would have used it if it were the best choice. But by almost any criteria (ie cost, speed, size, power and especially ease of use), there are better ones out there. This code was for a devel board. We changed to another vendor's Phy for our own board and it was a trivial matter to get it working.