Hello, Hoping to get some advice on establishing a connection on the RMII interface between an LPC1768 and a RTL8304 PHY. The PHY indicates it is sending data but the GMAC is not generating any interrupts.
The PHY has 2 network ports that are operating. I am able to retrieve data from the PHY on the MDIO interface, which indicates the network ports can link up and indicates the MAC is up. The PHY statistics registers also indicate it is receiving data on the ports and transmitting data to the MCU.
I am currently using the following connections, which I was able to get to work on a different MCU and this PHY.
NXP LPC1768 |
| Realtek PHY | |
Pin | RTL8304MBI | I/O | |
P1_15 / ENET_REF_CLK | - | REFCLK | O |
P1_8 / ENET_CRS | - | TXEN | O |
P1_9 / ENET_RXD0 | - | TXD_0 | O |
P1_10 / ENET_RXD1 | - | TXD_1 | O |
P1_4 / ENET_TX_EN | - | CRS_DV | I |
P1_0 / ENET_TXD0 | - | RXD_0 | I |
P1_1 / ENET_TXD1 | - | RXD_1 | I |
P1_16 / ENET_MDC | - | MDC | I |
P1_17 / ENET_MDIO | - | MDIO | I/O |
I also tried the following connections, but the IAR debugger crashes as soon as the pins are initialized. So I have returned to the above connections.
NXP LPC1768 |
| Realtek PHY | |
Pin | RTL8304MBI | I/O | |
P1_15 / ENET_REF_CLK | - | REFCLK | O |
P1_4 / ENET_TX_EN | - | TXEN | O |
P1_0 / ENET_TXD0 | - | TXD_0 | O |
P1_1 / ENET_TXD1 | - | TXD_1 | O |
P1_8 / ENET_CRS | - | CRS_DV | I |
P1_9 / ENET_RXD0 | - | RXD_0 | I |
P1_10 / ENET_RXD1 | - | RXD_1 | I |
P1_16 / ENET_MDC | - | MDC | I |
P1_17 / ENET_MDIO | - | MDIO | I/O |
I have initialized the pins as follows:
PINSEL_ConfigPin_17xx(1, 0, 1); // P1.0 - ENET_TXD0
PINSEL_ConfigPin_17xx(1, 1, 1); // P1.1 - ENET_TXD1
PINSEL_ConfigPin_17xx(1, 4, 1); // P1.4 - ENET_TX_EN
PINSEL_ConfigPin_17xx(1, 8, 1); // P1.8 - ENET_CRS
PINSEL_ConfigPin_17xx(1, 9, 1); // P1.9 - ENET_RXD0
PINSEL_ConfigPin_17xx(1, 10, 1); // P1.10 - ENET_RXD1
PINSEL_ConfigPin_17xx(1, 14, 1); // P1.14 - ENET_RX_ER
PINSEL_ConfigPin_17xx(1, 15, 1); // P1.15 - ENET_REF_CLK
// NXP LPC1768 MDIO pins
PINSEL_ConfigPin_17xx(1, 16, 1); // P1.16 - ENET_MDC
PINSEL_ConfigPin_17xx(1, 17, 1); // P1.17 - ENET_MDIO
Looking at the RMII interface with a scope I found the TX_EN, TXD1 and TXD0 are steady around 2V and the CRS, RXD0, RXD1 lines are at 0V. And the REFCLK is at 50MHz.
For a test I removed the TX_EN, TXD0/1, CRS, RXD0/1 connections and with a scope on the PHY pins I see a repeating pattern about every 10ms which appears to auto negotiation pulses, TX_EN is high during a stream of pulses appearing on TXD0/1.
It appears to me that the PHY is working and attempting to send data to the MCU, but when the MCU is connected the signals are snubbed. So I also tried changing the pins from mode 0 (default, on-chip pull-up resistor enabled) to mode 2 (neither pull-up nor pull-down resistor enabled). But still no luck.
Any thoughts or ideas greatly appreciated.
Thanks
9-16-2022 - Additional info added
Below are 2 scope captures on Power Up of the PHY TX_EN signal with the PHY receiving packets on one of its ports and transmitting to the MCU over RMII.
The 1st pic is with the PHY TX_EN Connected to the NXP LPC1768 ENET_CRS, the 2nd one with TX_EN NOT Connected.
PHY TX_EN Connected to NXP1768
When the pin is connected to the MCU there is some very strange behavior then continuous pulses from 0-2.2V.
PHY TX_EN not connected to NXP1768
As you can see when not connected the signal contains repeating pulses from 0-3.3V
Any idea what is going on? or why the MCU pin connected is causing the signal to be reduced to 2.2V?
I also tried setting the pin functions to GPIO Inputs (function 0) and tested with all the resistor modes, pull-up / repeater / Neither pull-up nor pull-down / pull-down, but get the same results. Also tested on 4 different boards.
I have other boards with a different MCU working with this PHY, and the same MCU working with other PHY chips using the same connections. With this MCU the PHY indicates it is up and running and scope captures show it is transmitting, but a connected MCU corrupts the signals.
Again, any suggestions greatly appreciated. We are starting to go out of our minds on this.
Thanks
Dave
Hello XiangJun,
We do have the connections as you suggested.
We verified the RTL8304 is sending data to the NXP LPC1768 MCU, but the MCU is not generating RX interrupts.
The Firmware is configured to send ARP packets at a rate of 1/s. We do see 7us pulses on the MCU TX_EN pin at a rate of 1/s, but there is no activity on the ENET_TXD[1:0] pins. EMAC TX interrupts do take place.
Is there anything I can look at to get more info?
Thanks
Hi,
I think the following connection of Ethernet interface is correct.
The following the ethernet signal timing I copied from data sheet of LPC546xx.
The ENET_TX_EN is an output signal from the LPC17xx, regarding the 2.2V voltage, what is the VDD(3V3) power supply voltage? the VDD(3V3) voltage is the power supply voltage for the I/O
ports.
Hope it can help you
BR
XiangJun Rong
Thanks for getting back to me XiangJun Rong.
VDD is 3V3.
I understand the connections for the LPCXpressoLPC1769 are TX to TX and RX to RX, however, this connection is to the Microchip LAN8720, which specifies the TX pins as inputs and the RX pins as outputs.
The chip we are using, the Realtek RTL8304 specifies TX pins as outputs and RX pins as inputs.
Previously, for a test I connected the TX pins to TX (Outputs to Outputs) and RX to RX (Inputs to Inputs), but the MCU would stop operating in the IAR debugger exactly when the pins were configured as RMII pins.
Additionally, we were able to get the RTL8304 working on a different manufacturers MCU with RTL8304 TX output connected to MCU RX input and RTL8304 RX input connected to MCU TX output.
But, we would like to get it working on the NXP LPC1768.
Unless the NXP LPC1768 RMII pins autodetect inputs/outputs?
Is there something than can explain the scope traces above?
Thanks
Hi,
Based on the pic I copied from RTL4304, I think you should connect as following:
LPC1768 RTL8304MBI PHY
P1.0-RMII_TXD0 RXD0 pin 22
P1.1-RMII_TXD1 RXD1 pin23
P1.4-RMII_TXEN CRS_DV pin21
P1.9-RMII_RXD0 TXD0 pin 16
P1.10-RMII_RXD1 TXD1 pin15
P1.8-RMII_CRS TXEN pin17
P1.15-RMII_CLK REFCLK 20
P1.16-RMII_MCD SCL/MDC pin27
P1.17-RMII_MDIO SDA/MDIO pin28
Pls have a check.
BR
XiangJun Rong
We finally got it working.
Using the pin connections we started with: (Outputs -> Inputs)
If anyone has dealt with Realtek then you know how secretive they are about their documentation. They will not release documentation or the phy register set. We finally got the spec after signing NDA's. But no register information.
Then when you finally get the spec after numerous requests you find it is so vague that you have tons of questions. So you start the question process. Ask 1 question and you will not get a response. Ask 10 questions and you will get a single question in return.
The question from them was usually "what are the contents of register 'x'?"
So, after months of this I get "The contents of that register should be 'y', clear bit 14".
After clearing bit 14 of this register the phy now works.
I asked them what is the function of this bit and why does it need to be cleared. We did not have to do this when using the phy with a different MCU.
I get in response "The reason should be some RMII pins share with some LED pins"
Sorry for the rant. Just wanted to warn anyone who has the privilege to work with Realtek, and to let everyone know that has worked with them that I surely felt your pain.