SPC58EHx/SPC58NHx giga Ethernet TX_CLK DoS analysis
Introduction
The SPC58EHx/SPC58NHx microcontroller (MCU) embeds the 1 Gbps Ethernet controller RGMII compliant.
This microcontroller introduces a new clock schema designed to manage the RGMII. The RGMII clock schema is designed
to be very flexible and it supports several different programming modes as described in the reference manual (see
Section A.2 Reference documents). The SPC58EHx/SPC58NHx microcontroller has a new dedicated PLL_ETH and a logic to
introduce a delay on the TX_CLK signal. While negotiating the 1000 link speed an improper or not enough margin to align the
data to the clock can make unstable or unusable the whole network connectivity. So, the delay on source is designed to provide
a phase shift of 90 degree guaranteeing enough margin to toggle the data.
The purpose of this technical note is to detail some measurements performed on the SPC58NHADPT302S evaluation board in
order to demonstrate the delay on source functionality applied on the TX_CLK. The document also provides some information
and some examples about the solutions that can be adopted to introduce skew.
TN1337 - Rev 1 - January 2021
For further information contact your local STMicroelectronics sales office.
www.st.com
1RGMII overview
The Reduced Gigabit Media Independent Interface (RGMII) has become a widely used alternative to the Gigabit
Media Independent Interface (GMII) by offering lower pin count.
The RGMII standard achieves this by reducing the width of the parallel data bus and through double data rate
(DDR). RGMII specifies that the clock and data will be generated simultaneously from the transmitting source and
that a skew has to be introduced between clock and data. Skew can be achieved from the transceiver either using
an internal delay or via PCB trace routing.
The interface definition supports two delay modes:
•Delay on Destination (DoD): the delay of the clock signal has to be accomplished by the receiver device.
•Delay on Source (DoS): the transmitter device already provides a delayed clock signal.
The SPC58EHx/SPC58NHx microcontroller has DoS capability as described in the following chapters.
1.1RGMII timing specification
The RGMII version 2.0 specification defines RGMII data-clock imbalances only for operation at 1000 Mbps, which
uses both clock edges to sample data and control signals at the clock rate of 125 MHz (8 ns period). For 10/100
Mbps operations, the data signals are sampled on the rising clock edge and the control signals are sampled on
both clock edges.
With slower clock rates, 2.5 MHz for 10 Mbps and 25 MHz for 100 Mbps, RGMII imbalances for 10/100 Mbps
operations will have larger timing margins than running at 1000 Mbps, and therefore can be relaxed, such as
maximum value, from 2.6 ns from 1000 Mbps to 160 ns for 10 Mbps and 16 ns for 100 Mbps.
TN1337
RGMII overview
Figure 1. RGMII RX timing diagram
TN1337 - Rev 1
page 2/19
Figure 2. RGMII TX Timing diagram
TN1337
RGMII timing specification
TN1337 - Rev 1
page 3/19
SPC58EHx/SPC58NHx RGMII clocking schema
2SPC58EHx/SPC58NHx RGMII clocking schema
The TX_CLK can be selected using an internal PLL_ETH clock or the receive clock that is routed by the PHY
transceive. When PLL_ETH is selected as reference clock for TX_CLK, MC_CGM Aux10 must be programmed
to configure the reference clock for this source. Check the reference manual (see Section A.2 Reference
documents) for detailed information on MC_CGM module.
There are three possibilities:
•XOSC
•a divided version of PLL0
•a divided version of RXCLK
The delay on the source can be enabled by programming the related mux: rgmii_txclk_dos.
The following figure shows the clock diagram for the RGMII clock selections and DoS clock selection:
Figure 3. SPC58EHx RGMII clock schema
TN1337
2.1TX_CLK selection with Delay on Source (DoS)
DoS selection is the recommended configuration on this platform and can be performed referring to
Figure 3. SPC58EHx RGMII clock schema, by setting the rgmii_txclk_dos = 1 and rgmii_txclk_sel = 0.
2.2TX_CLK selection with Delay on Destination (DoD)
In this mode no delay is introduced internally by the microcontroller.
This mode can be activated by:
•selecting the RX_CLK as TX_CLK (both for MAC / PHY)
–rgmii_txclk_dos=0
–rgmii_txclk_sel=1
•selecting the ETH_PLL divided output as TX_CLK
–rgmii_txclk_dos=0
–rgmii_txclk_sel=0
TN1337 - Rev 1
page 4/19
3Microchip KSZ9031RNX RGMII transceiver
The KSZ9031RNX RGMII microchip complies with the timing requirements in the RGMII specification version 2.0
for internal PHY chip delay. For the transmission path, that is from MAC to KSZ9031RNX, the PHY transceiver
by default does not add any delay to its GTX CLK, TEN and data lines. The GTX CLK delay is expected to be
provided by the MAC.
The GTX_CLK on the transceiver is wired to the TX_CLK on the MAC side.It has been verified that, without DoS
selection, on the SPC58NHADPT302S board, used as the reference PCB in these experiments, it is mandatory to
program the KSZ9031RNX to add an additional delay when the giga link speed is negotiated. Without any delay
on TX_CLK, issues occurred when ping the interface from a remote host, e.g. packet lost or no connectivity (see
Section Appendix A Network setup).
In case of DoS selection, it has been demonstrated that the PHY does not need to introduce any further delay, so
the microcontroller DoS logic satisfy the requirements. It does not need any extra delay on 100 Mbps speed .
3.1GTX_CLK delay from transceiver registers
In case of DoD, MAC does not provide any delay for the TX_CLK, the KSZ9031RNX can be used to provide it.
In fact, the KSZ9031RNX has skew pad registers for all RGMII pins (clock, control signals and data) to provide
programming options to adjust or correct the timing relationship for each RGMII pin.
Here is a piece of the code invoked by the low-level driver to provide the delay on TX_CLK:
/* RGMII Control Signal Pad Skew */
value = ksz9031_extended_read(phydev, 1, 2, reg);
value |= delay;
ksz9031_extended_write(phydev, 1, 2, reg, value);
value = ksz9031_extended_read(phydev, 1, 2, reg);
}
page 5/19
TN1337
PCB trace routing on GTX_CLK
Note:the transceiver software set is available within the SPC5Studio tool (https://www.st.com/en/development-tools/
spc5-studio.html).
3.2PCB trace routing on GTX_CLK
The additional delay can be solved in the PCB. In this scenario, neither the PHY transceiver nor the MCU for DoS
may need to be programmed.
The figure below shows an example of another PCB where the tune is created by a serpentine trace route on
GTX_CLK for the KSZ9031RNX with a fixed length of 1 ns (how to calculate it is out of scope of this document).
Figure 4. PCB trace routing on GTX_CLK
TN1337 - Rev 1
page 6/19
4Hardware
The figure below shows the SPC58NHADPT302S board used to perform measurements and connections with the
oscilloscope: LeCroy 610Zi using PP008 probes.
TN1337
Hardware
Figure 5. SPC58NHADPT302S connections
Note:the measurements are taken from GTX_CLK (TP10) and TDX0 (TP6).
Note:all the experiments confirmed that same results are obtained while probing other data signals.
TN1337 - Rev 1
page 7/19
Figure 6. SPC58NHADPT302S - KSZ9031NX schematic (and test points)
TN1337
Hardware
TN1337 - Rev 1
page 8/19
SPC58EHx/SPC58NHx TX_CLK programming
5SPC58EHx/SPC58NHx TX_CLK programming
The following piece of code is intended to explain some of the mentioned clock and delay configurations that can
be adopted.
/* RGMII selection for Ethernet_1 */
SIUL2.SCR0.B.ETH1_REGPHY_IF_SELECT = 1;
/* RX clock is used as TX_CLK source (DoD) */
#ifdef RXCLK_SELECTION
SIUL2.SCR0.B.RGMII_TX_CLK_SEL = 1;
#endif //RXCLK_SELECTION
The figure below shows the TX_CLK path tested in this configuration (refer to Figure 1. RGMII RX timing diagram
too).
Note:at 125 MHz as RGMII clock at 1 giga, the period is 8 ns.
Figure 7. PLL_ETH with XOSC selection and DoS enable
TN1337
Giga measurements
The figures below report the measurements of the delay showing that there is the shift of 90 degrees (2ns) as
expected that guarantees the working connectivity at 1 GiGa speed. Same result has been obtained when use, as
PLL_ETH source, the PLL0 instead of the XOSC.
Note:in the figures below the purple line is the Channel #2 for TX_CLK. insetead the TXDATA[0] is the blue channel
#3.
TN1337 - Rev 1
page 10/19
PLL_ETH with XOSC selection and DoS
Figure 8. 1GiGa: PLL_ETH sourced by XOSC - Oscilloscope view
TN1337
Figure 9. 1GiGa: DoS 2ns delay - PLL_ETH sourced by XOSC
TN1337 - Rev 1
page 11/19
7100 Mbps measurements
The following cases aim to detail the impact of DoS on 100 Mbps. For this speed, the extra delay on TX_CLK is
not mandatory, in fact the PHY low level driver is programmed not to add any delay. It has been noted that when
using DoS and DoD configuration the network activity is not affected (it is able to exchange data from the card to
the remote partner) and data and clock are perfectly aligned.
7.1PLL_ETH with XOSC selection and DoS
Figure 10. 100Mbps: PLL_ETH - XOSC selection with DoS enable
TN1337
100 Mbps measurements
TN1337 - Rev 1
page 12/19
7.2TX_CLK from RX_CLK (DoD)
The following figure shows that the TX_CLK is selected from the transceiver and DoS is disabled.
Figure 11. TX_CLK from RX_CLK – no delay
TN1337
TX_CLK from RX_CLK (DoD)
Figure 12. 100Mbps: TX_CLK with DoD
TN1337 - Rev 1
page 13/19
TN1337
Conclusions
8Conclusions
This technical note provides some details on how to manage skew.There are three main approaches:
•The transceiver has its own extended register set to add skew to signals.
•The PCB can be modified to have a trace routing for the TX_CLK.
•The micro-controller can introduce the delay.
As a general rule, the calculation of the necessary skew and delay correction must be analyzed case by case
following the RGMII specification and the technical data sheet of the devices. Further measurements on the PCB
can help to understand the necessary signal delay. To provide adequate flexibility and leeway to fine tune skew
you can have the DoS function on the microcontroller as well as a transceiver capable of introducing additional
delay.
The main focus is the SPC58EHx / SPC58NHx DoS functionality. It has been shown that the expected delay
is introduced during the DoS configuration and the whole network connectivity is working at different speeds
removing any dependence on the transceiver and PCB.
Note:Microchip KSZ9031RNX can add further misalignment on the signals by programming the internal registers.
Note:a phisycal device can implement signal delays internally also via HW belt option.
TN1337 - Rev 1
page 14/19
TN1337
Network setup
Appendix A Network setup
SPC5Studio's high-level application, based on the operating system and TCP / IP network stacks, is configured to
have full network protocols running, for example ICMP, ARP, UDP, TCP.
Below is the configuration used to check if the network works (for example Ping command to target from a remote
host).
Figure 13. Ethernet_1 external connection
A.1 Acronyms and abbreviations
AbbreviationComplete name
MACMedium Access Control
DoSDelay on Source
DoDDelay on Destination
RGMIIReduced gigabit media independent interface
ICMPInternet Control Message Protocol
ARPAddress Resolution Protocol
UDPUser Datagram Protocol
TCPTransmission Control Protocol
SkewDelay between clock and data transitions
PCBPrinted Circuit Board
A.2 Reference documents
•RM0452 Reference manual.
•SPC58EHx, SPC58NHx datasheet.
•TN1257 SPC58EHx, SPC58NHx IO definition: signal description and input multiplexing tables.
•Microchip SZ9031RNX (DS00002117F).
•RGMII/RTBI specification version 2.6 from HP/Marvell.
•OPEN Alliance RGMII EPL (Electrical-Physical Layer) Recommendations for automotive.
STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST
products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST
products are sold pursuant to ST’s terms and conditions of sale in place at the time of order acknowledgement.
Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of
Purchasers’ products.
No license, express or implied, to any intellectual property right is granted by ST herein.
Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.
ST and the ST logo are trademarks of ST. For additional information about ST trademarks, please refer to www.st.com/trademarks. All other product or service
names are the property of their respective owners.
Information in this document supersedes and replaces information previously supplied in any prior versions of this document.