S32K344 Mini EVB + GMAC RMII + KSZ8091RND: RX frames discarded with CRC_ERROR + DRIBBLE_ERROR

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K344 Mini EVB + GMAC RMII + KSZ8091RND: RX frames discarded with CRC_ERROR + DRIBBLE_ERROR

Jump to solution
1,285 Views
brunoGT88
Contributor III

Hello,

I am working with Ethernet on an S32K344, using the S32K344 Mini EVB as the base board. The project uses the RTD Eth_43_GMAC driver, without lwIP. The application is based on the NXP ethernet_no_lwip example, but adapted to our board

The hardware uses a Microchip/Micrel KSZ8091RND PHY in RMII mode. The PHY receives a 50 MHz clock on the XI pin, according to our schematic. In the KSZ8091RND PHY Control 2 register, bit 7, RMII Reference Clock Select, is 0. We understand this to be consistent with the RND mode using a 50 MHz clock on XI.

The interface between the MCU and the PHY is configured as RMII, 100 Mbps, full-duplex.

In the .mex file, the GMAC/EMAC pins are configured as follows:

PTD16, pin 34: RMII_MDIO, emac_mii_rmii_mdio
PTD17, pin 31: RMII_MDC, emac_mii_rmii_mdc
PTB5, pin 47: RMII_TX0, emac_mii_rmii_txd0
PTB4, pin 48: RMII_TX1, emac_mii_rmii_txd1
PTE9, pin 36: RMII_TX_EN, emac_mii_rmii_tx_en
PTC0, pin 62: RMII_TX_CLK, emac_mii_rmii_tx_clk
PTD9, pin 63: RMII_RX0, emac_mii_rmii_rxd0
PTD8, pin 64: RMII_RX1, emac_mii_rmii_rxd1
PTC15, pin 68: RMII_RX_DV, emac_mii_rmii_rx_dv
PTC16, pin 66: RMII_RX_ER, emac_mii_rmii_rx_er
PTC1, pin 61: RMII_RX_CLK, emac_mii_rx_clk
PTE21, pin 153: ENET_RESET

Relevant Ethernet configuration in the .mex file:

EthCtrlMacLayerType = ETH_MAC_LAYER_TYPE_XMII
EthCtrlMacLayerSubType = REDUCED
EthCtrlMacLayerSpeed = ETH_MAC_LAYER_SPEED_100M
EthDuplexMode = ETH_FULL_DUPLEX
EthCtrlEnableRxInterrupt = false
EthCtrlEnableTxInterrupt = false

Relevant GMAC configuration generated by RTD:

miiMode = GMAC_RMII_MODE
speed = GMAC_SPEED_100M
duplex = GMAC_FULL_DUPLEX

We also checked that the driver selects the RMII interface before resetting the controller. In Eth_43_GMAC_Ipw.c, when the mode is GMAC_RMII_MODE, it writes DCMRWF1 MAC_CONF_SEL with value 2U.

So, based on the generated code, MAC_CONF_SEL appears to be configured for RMII.

Regarding clocks, the .mex file shows:

external_clocks.emac_mii_rmii_tx.outFreq = 50 MHz
EMAC_MII_RMII_TX.outFreq = 50 MHz
EMAC0_RX_CLK.outFreq = 25 MHz
EMAC0_TX_CLK.outFreq = 25 MHz
EMAC0_TS_CLK.outFreq = 50 MHz

The EMAC clock muxes use EMAC_MII_RMII_TX_CLK as their source:

McuCgm0ClockMux7_Source = EMAC_MII_RMII_TX_CLK
McuCgm0ClockMux8_Source = EMAC_MII_RMII_TX_CLK
McuCgm0ClockMux9_Source = EMAC_MII_RMII_TX_CLK

When comparing this with NXP example .mex files, we saw that they also show EMAC_MII_RMII_TX at 50 MHz and EMAC0_RX_CLK / EMAC0_TX_CLK at 25 MHz, so we assume this may be normal in the tool, but we would like to confirm.

The application transmits and receives Ethernet frames directly through Eth_43_GMAC, without lwIP.

For TX, we use this sequence:

Eth_43_GMAC_ProvideTxBuffer
Eth_43_GMAC_Transmit
Eth_43_GMAC_TxConfirmation

For RX, we use polling, since RX/TX interrupts are disabled:

ETH_43_GMAC_RX_IRQ_ENABLED = STD_OFF
ETH_43_GMAC_TX_IRQ_ENABLED = STD_OFF

The RX code repeatedly calls Eth_43_GMAC_Receive with CtrlIdx, FifoIdx, and receiveStatus.

We also monitor EthIf_RxIndications[0], because the driver only calls EthIf_RxIndication when the received frame has no error.

The observed behavior is:

TX is confirmed successfully several times.

On the other side, some frames appear to be received.

RX on the S32K344 receives something, but then all frames are discarded by the driver.

receiveStatus may indicate that a frame was received.

However, EthIf_RxIndication is not called because the driver detects an error in the frame.

When inspecting Eth_43_GMAC_Ipw_axRxFrameInfo[0][0].ErrMask, the observed value is:

ErrMask = 0x01080000

According to the driver header, this corresponds to:

GMAC_RX_ERR_CRC_ERROR = 0x01000000
GMAC_RX_ERR_DRIBBLE_ERROR = 0x00080000

So the frame reaches the GMAC, but it is marked with CRC and dribble errors.

The main question is: considering that the GMAC is configured as RMII 100M full-duplex, the KSZ8091RND PHY receives a 50 MHz clock on XI, and the driver selects MAC_CONF_SEL value 2U, what could cause simultaneous CRC and dribble errors on RX?

We would especially like to confirm:

  1. For S32K344 plus GMAC plus RMII, is it expected that the .mex file shows EMAC_MII_RMII_TX = 50 MHz, but EMAC0_RX_CLK and EMAC0_TX_CLK as 25 MHz?

  2. In RMII mode on S32K344, is it expected to configure both emac_mii_rmii_tx_clk on PTC0 and emac_mii_rx_clk on PTC1, or should one of these signals not be used or routed in this mode?

  3. Is any additional configuration required in DCM_GPR, the clock tree, or pin mux for RMII besides MAC_CONF_SEL value 2U?

  4. Is the KSZ8091RND with bit 7 of PHY Control 2 set to 0 and an external 50 MHz clock on XI compatible with this GMAC configuration?

  5. In cases of CRC_ERROR plus DRIBBLE_ERROR on RX, which RMII signals would you recommend checking first with an oscilloscope or logic analyzer? REF_CLK, CRS_DV, RXD0, RXD1, RX_ER?

  6. Is there any official NXP example for S32K344 using a KSZ8091RND PHY in RMII mode without lwIP?

Summary: the link comes up, TX is confirmed, and RX detects frames, but the frames are discarded due to CRC_ERROR plus DRIBBLE_ERROR. We are trying to determine whether this points to an RMII clock issue, pin mux/physical signal issue, or some additional GMAC/RTD configuration requirement.

Thank you in advance for your support and guidance.

0 Kudos
Reply
1 Solution
1,170 Views
brunoGT88
Contributor III

Hi @PavelL ,

I found the root cause.

The issue was related to the initialization order. In my project, the MCU-clock initialization was being executed before the SIUL2 pin mux initialization. After changing the startup flow so that the pin mux configuration is done first, before MCU clock initialization, the Ethernet frames are now transmitted correctly.

This also matches the initialization order used in the clean NXP example I compared against.

Thank you for the support.

View solution in original post

0 Kudos
Reply
7 Replies
1,171 Views
brunoGT88
Contributor III

Hi @PavelL ,

I found the root cause.

The issue was related to the initialization order. In my project, the MCU-clock initialization was being executed before the SIUL2 pin mux initialization. After changing the startup flow so that the pin mux configuration is done first, before MCU clock initialization, the Ethernet frames are now transmitted correctly.

This also matches the initialization order used in the clean NXP example I compared against.

Thank you for the support.

0 Kudos
Reply
1,257 Views
PavelL
NXP Employee
NXP Employee

Hello @brunoGT88 ,

Thank you for the very detailed description. I reviewed your setup carefully.

Based on what you described, this looks more like a typical RMII clocking issue than a problem in the Eth_43_GMAC TX/RX software flow.

At first, Please check that the external RMII 50 MHz clock is present and stable before calling Eth_43_GMAC_Init(). This is an important point for S32K344 RMII setups.

Regarding your questions:

1. Yes - in RMII mode, it is expected that the clock configuration shows EMAC_MII_RMII_TX = 50 MHz while the internal EMAC0_RX_CLK and EMAC0_TX_CLK are derived as 25 MHz. 

2. No - emac_mii_rx_clk is not used by the S32K344 EMAC in RMII mode. In the usual S32K3 RMII setup, the PHY provides the 50 MHz TX clock to the MAC and the internal EMAC RX/TX clocks are derived from that clock using divider 2. 

3. On my side, I typically use only the RMII selection in DCMRWF1 as the key additional setting, usually as the very first row in the project:

IP_DCM_GPR->DCMRWF1 = (IP_DCM_GPR->DCMRWF1 & ~DCM_GPR_DCMRWF1_MAC_CONF_SEL_MASK) | DCM_GPR_DCMRWF1_MAC_CONF_SEL(2U);

 

4. The PHY clocking part is still not fully clear from your description. Saying that the KSZ8091RND receives 50 MHz on XI does not automatically confirm that the S32K344 MAC is receiving the required 50 MHz RMII reference clock on emac_mii_rmii_tx_clk. Please confirm how exactly the 50 MHz RMII reference clock is connected between the PHY / oscillator and the MCU and ideally share that portion of the schematic.

5. For CRC error + dribble error on RX, I would check the RMII clocking/signals in this order:

REF_CLK / RMII_TX_CLK (50 MHz)
CRS_DV
RXD0 / RXD1
RX_ER

6. I'm not aware of an official NXP example specifically for S32K344 + KSZ8091RND + RMII + no lwIP. However, you may refer to this S32K344 EMAC example and compare your clock/pin setup against it, or adapt it to your board:

Example S32K344 EMAC lwIP FreeRTOS miniEVB S32DS 3.6.1 RTD 6.0.0


As an additional debug step, if your PHY supports it, please also try enabling MII/RMII loopback on the PHY side so that the MAC can receive back frames that it transmitted. This can help separate a PHY/link-level problem from an MCU RX sampling problem.

Best regards,

Pavel

0 Kudos
Reply
1,242 Views
brunoGT88
Contributor III

Hello Pavel,

Thank you for your reply and guidance.

We performed additional hardware and software checks following your points.

First, we confirmed with an oscilloscope that the 50 MHz RMII clock is present and stable at the MCU pin configured as emac_mii_rmii_tx_clk, which is PTC0. We also confirmed that this clock is present before the Ethernet driver initialization.

Regarding the emac_mii_rx_clk signal, we understood your explanation that it is not used in RMII mode on the S32K344. We removed this signal from the configuration to avoid confusion, but the error behavior did not change.

We also checked DCMRWF1. The RTD driver is configuring RMII mode with MAC_CONF_SEL = 2U, as you mentioned.

During schematic and board inspection, we found a hardware issue: resistor R190, which connects the PHY CRS_DV signal to the MCU pin, was open/not mounted. This signal corresponds to the RMII CRS_DV signal, connected to the MCU pin configured as emac_mii_rmii_rx_dv.

After identifying this, we mounted/closed resistor R190. After that, the CRS_DV signal started appearing on the oscilloscope and now toggles at the MCU pin during reception. We also measured RX_ER, and it remains low all the time, with no pulses during the frame.

Even after fixing CRS_DV, the issue remained. The driver still reports ErrMask = 0x01080000, which means CRC_ERROR + DRIBBLE_ERROR.

We also checked the RX buffer content. The frame seems to reach the GMAC, but some bytes are received with incorrect bits. For example, the expected frame was:

Destination MAC: 02:00:00:00:00:02
Source MAC: 11:12:21:77:77:77
EtherType: 88:88

But what appeared in the RX buffer was something like:

Destination MAC: 21:00:00:00:00:02
Source MAC: 11:21:11:76:77:77
EtherType: 8B:88

After that, a byte 08 appeared, and then the remaining bytes were zero.

This suggests that the frame is reaching the GMAC, but the data is being sampled with incorrect or misaligned bits.

We also observed CRS_DV on the oscilloscope. At the end of the frame, when it goes low, it toggles for a few cycles before becoming definitively low. From our understanding, this behavior may be normal in RMII because CRS_DV combines CRS and RX_DV, but we would like to confirm if this is expected with the S32K344/GMAC.

After that, we reviewed the board again and confirmed that the resistors/jumpers for the remaining RMII signals are mounted correctly. After the issue found on R190, we also reviewed the other RMII signals and did not find any other missing or open resistors.

We also implemented a loopback test on the KSZ8091RND PHY. We configured the PHY through MDIO for loopback in the Basic Control register. In the debugger, we confirmed that the bits are:

loopback = 1
speedSelect = 1
autoNegotiationEnable = 0
duplexMode = 1

So the PHY is in loopback mode, 100 Mbps, full-duplex, with auto-negotiation disabled.

In this mode, our software transmits a frame through the GMAC and immediately polls for reception using Eth_43_GMAC_Receive. The TX sequence still confirms correctly with Eth_43_GMAC_TxConfirmation.

Even with the PHY in loopback mode, the issue remains. The frame still reaches the RX buffer, but with corrupted bytes, and the driver still reports ErrMask = 0x01080000, which means CRC_ERROR + DRIBBLE_ERROR.

This seems to remove the cable and the other device from the analysis, since the issue also happens on the local path MCU -> PHY -> internal PHY loopback -> MCU.

Currently, our answers to your points are:

1->We confirmed that EMAC_MII_RMII_TX = 50 MHz and that EMAC0_RX_CLK / EMAC0_TX_CLK = 25 MHz seem to be normal in RMII.

2->We confirmed that emac_mii_rx_clk is not required in RMII. It was removed from the configuration, but the issue continued.

3->We confirmed that the driver configures DCMRWF1.MAC_CONF_SEL = 2U.

4->We confirmed with an oscilloscope that the 50 MHz clock reaches the MCU pin PTC0 / emac_mii_rmii_tx_clk.

5->We confirmed that CRS_DV now reaches the MCU after mounting/closing resistor R190.

6->We confirmed that RX_ER remains low all the time during reception.

7->We confirmed that PHY loopback is really active according to the BMCR readback.

8->We confirmed that the resistors/jumpers for the remaining RMII signals are mounted correctly.

Even so, we are still receiving frames with corrupted bytes and CRC_ERROR + DRIBBLE_ERROR.

In this scenario, the issue still seems related to the local RMII interface between the S32K344 and the KSZ8091RND, possibly timing/skew between REF_CLK, TXD0/TXD1/TX_EN, CRS_DV and RXD0/RXD1, or some electrical/pad configuration of the RMII signals.

Do you have any specific recommendation for this case, now that the error also occurs with PHY loopback enabled? Is there any pad configuration, clock phase, drive strength, slew rate, or series resistor requirement for RMII on the S32K344 Mini EVB that we should verify?

Is there also any recommended GMAC or PHY test to separate whether the issue is on the TX RMII path from the MCU to the PHY or on the RX RMII path from the PHY to the MCU?

Thank you in advance for your support and guidance.

0 Kudos
Reply
1,270 Views
brunoGT88
Contributor III

I'm using RTD 5.0.0.

0 Kudos
Reply
1,234 Views
brunoGT88
Contributor III

Hello Pavel,

We have one important update.

We enabled the internal MAC loopback on the S32K344 and adjusted our test so it only performs TX followed by RX, without enabling PHY loopback and without waiting for PHY link-autonegotiation.

With MAC internal loopback, the test passes correctly. The received frame is valid and there are no CRC or dribble errors.

However, with KSZ8091RND PHY loopback enabled, the issue remains: the frame reaches the RX buffer, but some bytes are corrupted and the GMAC reports CRC error.

So the current result is:

MAC internal loopback: OK, no CRC-dribble error
PHY loopback: FAIL, CRC error remains
Normal external RX: FAIL, CRC error remains

This seems to indicate that the GMAC driver, TX-RX software flow, buffers, and internal MAC path are working correctly, and that the remaining issue is likely on the external RMII path between the S32K344 and the KSZ8091RND, or in the PHY-RMII-pad configuration.

Do you have any recommendation for what to check next, considering that MAC internal loopback passes but PHY loopback fails?

Thank you.

0 Kudos
Reply
1,191 Views
brunoGT88
Contributor III

Hello @PavelL,

We have an important new finding.

We tested the board TX using Wireshark on the PC. The firmware sends frames with:

Destination MAC: 70:69:79:A6:74:4F
Source MAC: 11:12:21:77:77:77
EtherType: 0x8888
Payload: 0x55 pattern

However, Wireshark shows that the frames arriving at the PC are already corrupted. The source MAC, destination MAC, and EtherType are not correct.

So the issue is not only on RX into the S32K344. The TX path from the S32K344 to the PHY-PC is also corrupting bits.

MAC internal loopback still works correctly, so the frame is built correctly inside the GMAC. The corruption appears when the frame goes out through the external RMII interface.

This now points more strongly to the external RMII TX path or pad configuration:

TXD0
TXD1
TX_EN
REF_CLK - RMII_TX_CLK

Do you recommend any specific pad settings for RMII TX on S32K344, such as drive strength, slew rate, keeper, or pull configuration? Currently the generated pin configuration shows driveStrengthEnable disabled for TXD0, TXD1, TX_EN, and TX_CLK.

Thank you.

0 Kudos
Reply
1,186 Views
PavelL
NXP Employee
NXP Employee

Hello @brunoGT88 ,

Thank you for the detailed update and for performing the additional checks. Your latest results are very helpful. Since: MAC internal loopback passes, PHY loopback still fails and
the frame is already corrupted on TX when observed on the PC - this strongly suggests that the issue is not in the GMAC driver flow, buffer handling or internal MAC path.

The remaining suspect area is the external RMII interface between the S32K344 and the KSZ8091RND, including signal routing, pin mapping, I/O voltage compatibility or timing / signal integrity on the RMII lines. Please kindly review my suggestions:

  • Verify I/O voltage compatibility between the KSZ8091RND and the S32K344 RMII pins.
  • Check pin-to-pin continuity and signal mapping for all RMII lines.
  • Confirm that TXD0/TXD1 and RXD0/RXD1 are not swapped anywhere on the board.
  • Probe the RMII TX interface directly at the PHY pins (REF_CLK, TX_EN, TXD0, TXD1).
  • Reconstruct the transmitted frame from the RMII TX signals and compare it with the expected frame.
  • Recheck the PHY strap configuration and confirm the intended RMII / reference clock mode after reset.

Best regards,

Pavel

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2374654%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K344%20Mini%20EVB%20%2B%20GMAC%20RMII%20%2B%20KSZ8091RND%3A%20RX%20frames%20discarded%20with%20CRC_ERROR%20%2B%20DRIBBLE_ERROR%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2374654%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20class%3D%22%22%3EHello%2C%3C%2FP%3E%3CP%20class%3D%22%22%3EI%20am%20working%20with%20Ethernet%20on%20an%20S32K344%2C%20using%20the%20S32K344%20Mini%20EVB%20as%20the%20base%20board.%20The%20project%20uses%20the%20RTD%20Eth_43_GMAC%20driver%2C%20without%20lwIP.%20The%20application%20is%20based%20on%20the%20NXP%20ethernet_no_lwip%20example%2C%20but%20adapted%20to%20our%20board%3C%2FP%3E%3CP%20class%3D%22%22%3EThe%20hardware%20uses%20a%20Microchip%2FMicrel%20KSZ8091RND%20PHY%20in%20RMII%20mode.%20The%20PHY%20receives%20a%2050%20MHz%20clock%20on%20the%20XI%20pin%2C%20according%20to%20our%20schematic.%20In%20the%20KSZ8091RND%20PHY%20Control%202%20register%2C%20bit%207%2C%20RMII%20Reference%20Clock%20Select%2C%20is%200.%20We%20understand%20this%20to%20be%20consistent%20with%20the%20RND%20mode%20using%20a%2050%20MHz%20clock%20on%20XI.%3C%2FP%3E%3CP%20class%3D%22%22%3EThe%20interface%20between%20the%20MCU%20and%20the%20PHY%20is%20configured%20as%20RMII%2C%20100%20Mbps%2C%20full-duplex.%3C%2FP%3E%3CP%20class%3D%22%22%3EIn%20the%20.mex%20file%2C%20the%20GMAC%2FEMAC%20pins%20are%20configured%20as%20follows%3A%3C%2FP%3E%3CP%20class%3D%22%22%3EPTD16%2C%20pin%2034%3A%20RMII_MDIO%2C%20emac_mii_rmii_mdio%3CBR%20%2F%3EPTD17%2C%20pin%2031%3A%20RMII_MDC%2C%20emac_mii_rmii_mdc%3CBR%20%2F%3EPTB5%2C%20pin%2047%3A%20RMII_TX0%2C%20emac_mii_rmii_txd0%3CBR%20%2F%3EPTB4%2C%20pin%2048%3A%20RMII_TX1%2C%20emac_mii_rmii_txd1%3CBR%20%2F%3EPTE9%2C%20pin%2036%3A%20RMII_TX_EN%2C%20emac_mii_rmii_tx_en%3CBR%20%2F%3EPTC0%2C%20pin%2062%3A%20RMII_TX_CLK%2C%20emac_mii_rmii_tx_clk%3CBR%20%2F%3EPTD9%2C%20pin%2063%3A%20RMII_RX0%2C%20emac_mii_rmii_rxd0%3CBR%20%2F%3EPTD8%2C%20pin%2064%3A%20RMII_RX1%2C%20emac_mii_rmii_rxd1%3CBR%20%2F%3EPTC15%2C%20pin%2068%3A%20RMII_RX_DV%2C%20emac_mii_rmii_rx_dv%3CBR%20%2F%3EPTC16%2C%20pin%2066%3A%20RMII_RX_ER%2C%20emac_mii_rmii_rx_er%3CBR%20%2F%3EPTC1%2C%20pin%2061%3A%20RMII_RX_CLK%2C%20emac_mii_rx_clk%3CBR%20%2F%3EPTE21%2C%20pin%20153%3A%20ENET_RESET%3C%2FP%3E%3CP%20class%3D%22%22%3ERelevant%20Ethernet%20configuration%20in%20the%20.mex%20file%3A%3C%2FP%3E%3CP%20class%3D%22%22%3EEthCtrlMacLayerType%20%3D%20ETH_MAC_LAYER_TYPE_XMII%3CBR%20%2F%3EEthCtrlMacLayerSubType%20%3D%20REDUCED%3CBR%20%2F%3EEthCtrlMacLayerSpeed%20%3D%20ETH_MAC_LAYER_SPEED_100M%3CBR%20%2F%3EEthDuplexMode%20%3D%20ETH_FULL_DUPLEX%3CBR%20%2F%3EEthCtrlEnableRxInterrupt%20%3D%20false%3CBR%20%2F%3EEthCtrlEnableTxInterrupt%20%3D%20false%3C%2FP%3E%3CP%20class%3D%22%22%3ERelevant%20GMAC%20configuration%20generated%20by%20RTD%3A%3C%2FP%3E%3CP%20class%3D%22%22%3EmiiMode%20%3D%20GMAC_RMII_MODE%3CBR%20%2F%3Espeed%20%3D%20GMAC_SPEED_100M%3CBR%20%2F%3Eduplex%20%3D%20GMAC_FULL_DUPLEX%3C%2FP%3E%3CP%20class%3D%22%22%3EWe%20also%20checked%20that%20the%20driver%20selects%20the%20RMII%20interface%20before%20resetting%20the%20controller.%20In%20Eth_43_GMAC_Ipw.c%2C%20when%20the%20mode%20is%20GMAC_RMII_MODE%2C%20it%20writes%20DCMRWF1%20MAC_CONF_SEL%20with%20value%202U.%3C%2FP%3E%3CP%20class%3D%22%22%3ESo%2C%20based%20on%20the%20generated%20code%2C%20MAC_CONF_SEL%20appears%20to%20be%20configured%20for%20RMII.%3C%2FP%3E%3CP%20class%3D%22%22%3ERegarding%20clocks%2C%20the%20.mex%20file%20shows%3A%3C%2FP%3E%3CP%20class%3D%22%22%3Eexternal_clocks.emac_mii_rmii_tx.outFreq%20%3D%2050%20MHz%3CBR%20%2F%3EEMAC_MII_RMII_TX.outFreq%20%3D%2050%20MHz%3CBR%20%2F%3EEMAC0_RX_CLK.outFreq%20%3D%2025%20MHz%3CBR%20%2F%3EEMAC0_TX_CLK.outFreq%20%3D%2025%20MHz%3CBR%20%2F%3EEMAC0_TS_CLK.outFreq%20%3D%2050%20MHz%3C%2FP%3E%3CP%20class%3D%22%22%3EThe%20EMAC%20clock%20muxes%20use%20EMAC_MII_RMII_TX_CLK%20as%20their%20source%3A%3C%2FP%3E%3CP%20class%3D%22%22%3EMcuCgm0ClockMux7_Source%20%3D%20EMAC_MII_RMII_TX_CLK%3CBR%20%2F%3EMcuCgm0ClockMux8_Source%20%3D%20EMAC_MII_RMII_TX_CLK%3CBR%20%2F%3EMcuCgm0ClockMux9_Source%20%3D%20EMAC_MII_RMII_TX_CLK%3C%2FP%3E%3CP%20class%3D%22%22%3EWhen%20comparing%20this%20with%20NXP%20example%20.mex%20files%2C%20we%20saw%20that%20they%20also%20show%20EMAC_MII_RMII_TX%20at%2050%20MHz%20and%20EMAC0_RX_CLK%20%2F%20EMAC0_TX_CLK%20at%2025%20MHz%2C%20so%20we%20assume%20this%20may%20be%20normal%20in%20the%20tool%2C%20but%20we%20would%20like%20to%20confirm.%3C%2FP%3E%3CP%20class%3D%22%22%3EThe%20application%20transmits%20and%20receives%20Ethernet%20frames%20directly%20through%20Eth_43_GMAC%2C%20without%20lwIP.%3C%2FP%3E%3CP%20class%3D%22%22%3EFor%20TX%2C%20we%20use%20this%20sequence%3A%3C%2FP%3E%3CP%20class%3D%22%22%3EEth_43_GMAC_ProvideTxBuffer%3CBR%20%2F%3EEth_43_GMAC_Transmit%3CBR%20%2F%3EEth_43_GMAC_TxConfirmation%3C%2FP%3E%3CP%20class%3D%22%22%3EFor%20RX%2C%20we%20use%20polling%2C%20since%20RX%2FTX%20interrupts%20are%20disabled%3A%3C%2FP%3E%3CP%20class%3D%22%22%3EETH_43_GMAC_RX_IRQ_ENABLED%20%3D%20STD_OFF%3CBR%20%2F%3EETH_43_GMAC_TX_IRQ_ENABLED%20%3D%20STD_OFF%3C%2FP%3E%3CP%20class%3D%22%22%3EThe%20RX%20code%20repeatedly%20calls%20Eth_43_GMAC_Receive%20with%20CtrlIdx%2C%20FifoIdx%2C%20and%20receiveStatus.%3C%2FP%3E%3CP%20class%3D%22%22%3EWe%20also%20monitor%20EthIf_RxIndications%5B0%5D%2C%20because%20the%20driver%20only%20calls%20EthIf_RxIndication%20when%20the%20received%20frame%20has%20no%20error.%3C%2FP%3E%3CP%20class%3D%22%22%3EThe%20observed%20behavior%20is%3A%3C%2FP%3E%3CP%20class%3D%22%22%3ETX%20is%20confirmed%20successfully%20several%20times.%3C%2FP%3E%3CP%20class%3D%22%22%3EOn%20the%20other%20side%2C%20some%20frames%20appear%20to%20be%20received.%3C%2FP%3E%3CP%20class%3D%22%22%3ERX%20on%20the%20S32K344%20receives%20something%2C%20but%20then%20all%20frames%20are%20discarded%20by%20the%20driver.%3C%2FP%3E%3CP%20class%3D%22%22%3EreceiveStatus%20may%20indicate%20that%20a%20frame%20was%20received.%3C%2FP%3E%3CP%20class%3D%22%22%3EHowever%2C%20EthIf_RxIndication%20is%20not%20called%20because%20the%20driver%20detects%20an%20error%20in%20the%20frame.%3C%2FP%3E%3CP%20class%3D%22%22%3EWhen%20inspecting%20Eth_43_GMAC_Ipw_axRxFrameInfo%5B0%5D%5B0%5D.ErrMask%2C%20the%20observed%20value%20is%3A%3C%2FP%3E%3CP%20class%3D%22%22%3EErrMask%20%3D%200x01080000%3C%2FP%3E%3CP%20class%3D%22%22%3EAccording%20to%20the%20driver%20header%2C%20this%20corresponds%20to%3A%3C%2FP%3E%3CP%20class%3D%22%22%3EGMAC_RX_ERR_CRC_ERROR%20%3D%200x01000000%3CBR%20%2F%3EGMAC_RX_ERR_DRIBBLE_ERROR%20%3D%200x00080000%3C%2FP%3E%3CP%20class%3D%22%22%3ESo%20the%20frame%20reaches%20the%20GMAC%2C%20but%20it%20is%20marked%20with%20CRC%20and%20dribble%20errors.%3C%2FP%3E%3CP%20class%3D%22%22%3EThe%20main%20question%20is%3A%20considering%20that%20the%20GMAC%20is%20configured%20as%20RMII%20100M%20full-duplex%2C%20the%20KSZ8091RND%20PHY%20receives%20a%2050%20MHz%20clock%20on%20XI%2C%20and%20the%20driver%20selects%20MAC_CONF_SEL%20value%202U%2C%20what%20could%20cause%20simultaneous%20CRC%20and%20dribble%20errors%20on%20RX%3F%3C%2FP%3E%3CP%20class%3D%22%22%3EWe%20would%20especially%20like%20to%20confirm%3A%3C%2FP%3E%3COL%3E%3CLI%3E%3CP%20class%3D%22%22%3EFor%20S32K344%20plus%20GMAC%20plus%20RMII%2C%20is%20it%20expected%20that%20the%20.mex%20file%20shows%20EMAC_MII_RMII_TX%20%3D%2050%20MHz%2C%20but%20EMAC0_RX_CLK%20and%20EMAC0_TX_CLK%20as%2025%20MHz%3F%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3EIn%20RMII%20mode%20on%20S32K344%2C%20is%20it%20expected%20to%20configure%20both%20emac_mii_rmii_tx_clk%20on%20PTC0%20and%20emac_mii_rx_clk%20on%20PTC1%2C%20or%20should%20one%20of%20these%20signals%20not%20be%20used%20or%20routed%20in%20this%20mode%3F%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3EIs%20any%20additional%20configuration%20required%20in%20DCM_GPR%2C%20the%20clock%20tree%2C%20or%20pin%20mux%20for%20RMII%20besides%20MAC_CONF_SEL%20value%202U%3F%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3EIs%20the%20KSZ8091RND%20with%20bit%207%20of%20PHY%20Control%202%20set%20to%200%20and%20an%20external%2050%20MHz%20clock%20on%20XI%20compatible%20with%20this%20GMAC%20configuration%3F%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3EIn%20cases%20of%20CRC_ERROR%20plus%20DRIBBLE_ERROR%20on%20RX%2C%20which%20RMII%20signals%20would%20you%20recommend%20checking%20first%20with%20an%20oscilloscope%20or%20logic%20analyzer%3F%20REF_CLK%2C%20CRS_DV%2C%20RXD0%2C%20RXD1%2C%20RX_ER%3F%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3EIs%20there%20any%20official%20NXP%20example%20for%20S32K344%20using%20a%20KSZ8091RND%20PHY%20in%20RMII%20mode%20without%20lwIP%3F%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%20class%3D%22%22%3ESummary%3A%20the%20link%20comes%20up%2C%20TX%20is%20confirmed%2C%20and%20RX%20detects%20frames%2C%20but%20the%20frames%20are%20discarded%20due%20to%20CRC_ERROR%20plus%20DRIBBLE_ERROR.%20We%20are%20trying%20to%20determine%20whether%20this%20points%20to%20an%20RMII%20clock%20issue%2C%20pin%20mux%2Fphysical%20signal%20issue%2C%20or%20some%20additional%20GMAC%2FRTD%20configuration%20requirement.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EThank%20you%20in%20advance%20for%20your%20support%20and%20guidance.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2375183%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K344%20Mini%20EVB%20%2B%20GMAC%20RMII%20%2B%20KSZ8091RND%3A%20RX%20frames%20discarded%20with%20CRC_ERROR%20%2B%20DRIBBLE_ERROR%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2375183%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20class%3D%22%22%3EHello%20Pavel%2C%3C%2FP%3E%3CP%20class%3D%22%22%3EWe%20have%20one%20important%20update.%3C%2FP%3E%3CP%20class%3D%22%22%3EWe%20enabled%20the%20internal%20MAC%20loopback%20on%20the%20S32K344%20and%20adjusted%20our%20test%20so%20it%20only%20performs%20TX%20followed%20by%20RX%2C%20without%20enabling%20PHY%20loopback%20and%20without%20waiting%20for%20PHY%20link-autonegotiation.%3C%2FP%3E%3CP%20class%3D%22%22%3EWith%20MAC%20internal%20loopback%2C%20the%20test%20passes%20correctly.%20The%20received%20frame%20is%20valid%20and%20there%20are%20no%20CRC%20or%20dribble%20errors.%3C%2FP%3E%3CP%20class%3D%22%22%3EHowever%2C%20with%20KSZ8091RND%20PHY%20loopback%20enabled%2C%20the%20issue%20remains%3A%20the%20frame%20reaches%20the%20RX%20buffer%2C%20but%20some%20bytes%20are%20corrupted%20and%20the%20GMAC%20reports%20CRC%20error.%3C%2FP%3E%3CP%20class%3D%22%22%3ESo%20the%20current%20result%20is%3A%3C%2FP%3E%3CP%20class%3D%22%22%3EMAC%20internal%20loopback%3A%20OK%2C%20no%20CRC-dribble%20error%3CBR%20%2F%3EPHY%20loopback%3A%20FAIL%2C%20CRC%20error%20remains%3CBR%20%2F%3ENormal%20external%20RX%3A%20FAIL%2C%20CRC%20error%20remains%3C%2FP%3E%3CP%20class%3D%22%22%3EThis%20seems%20to%20indicate%20that%20the%20GMAC%20driver%2C%20TX-RX%20software%20flow%2C%20buffers%2C%20and%20internal%20MAC%20path%20are%20working%20correctly%2C%20and%20that%20the%20remaining%20issue%20is%20likely%20on%20the%20external%20RMII%20path%20between%20the%20S32K344%20and%20the%20KSZ8091RND%2C%20or%20in%20the%20PHY-RMII-pad%20configuration.%3C%2FP%3E%3CP%20class%3D%22%22%3EDo%20you%20have%20any%20recommendation%20for%20what%20to%20check%20next%2C%20considering%20that%20MAC%20internal%20loopback%20passes%20but%20PHY%20loopback%20fails%3F%3C%2FP%3E%3CP%20class%3D%22%22%3EThank%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2375116%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K344%20Mini%20EVB%20%2B%20GMAC%20RMII%20%2B%20KSZ8091RND%3A%20RX%20frames%20discarded%20with%20CRC_ERROR%20%2B%20DRIBBLE_ERROR%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2375116%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20class%3D%22%22%3EHello%20Pavel%2C%3C%2FP%3E%3CP%20class%3D%22%22%3EThank%20you%20for%20your%20reply%20and%20guidance.%3C%2FP%3E%3CP%20class%3D%22%22%3EWe%20performed%20additional%20hardware%20and%20software%20checks%20following%20your%20points.%3C%2FP%3E%3CP%20class%3D%22%22%3EFirst%2C%20we%20confirmed%20with%20an%20oscilloscope%20that%20the%2050%20MHz%20RMII%20clock%20is%20present%20and%20stable%20at%20the%20MCU%20pin%20configured%20as%20emac_mii_rmii_tx_clk%2C%20which%20is%20PTC0.%20We%20also%20confirmed%20that%20this%20clock%20is%20present%20before%20the%20Ethernet%20driver%20initialization.%3C%2FP%3E%3CP%20class%3D%22%22%3ERegarding%20the%20emac_mii_rx_clk%20signal%2C%20we%20understood%20your%20explanation%20that%20it%20is%20not%20used%20in%20RMII%20mode%20on%20the%20S32K344.%20We%20removed%20this%20signal%20from%20the%20configuration%20to%20avoid%20confusion%2C%20but%20the%20error%20behavior%20did%20not%20change.%3C%2FP%3E%3CP%20class%3D%22%22%3EWe%20also%20checked%20DCMRWF1.%20The%20RTD%20driver%20is%20configuring%20RMII%20mode%20with%20MAC_CONF_SEL%20%3D%202U%2C%20as%20you%20mentioned.%3C%2FP%3E%3CP%20class%3D%22%22%3EDuring%20schematic%20and%20board%20inspection%2C%20we%20found%20a%20hardware%20issue%3A%20resistor%20R190%2C%20which%20connects%20the%20PHY%20CRS_DV%20signal%20to%20the%20MCU%20pin%2C%20was%20open%2Fnot%20mounted.%20This%20signal%20corresponds%20to%20the%20RMII%20CRS_DV%20signal%2C%20connected%20to%20the%20MCU%20pin%20configured%20as%20emac_mii_rmii_rx_dv.%3C%2FP%3E%3CP%20class%3D%22%22%3EAfter%20identifying%20this%2C%20we%20mounted%2Fclosed%20resistor%20R190.%20After%20that%2C%20the%20CRS_DV%20signal%20started%20appearing%20on%20the%20oscilloscope%20and%20now%20toggles%20at%20the%20MCU%20pin%20during%20reception.%20We%20also%20measured%20RX_ER%2C%20and%20it%20remains%20low%20all%20the%20time%2C%20with%20no%20pulses%20during%20the%20frame.%3C%2FP%3E%3CP%20class%3D%22%22%3EEven%20after%20fixing%20CRS_DV%2C%20the%20issue%20remained.%20The%20driver%20still%20reports%20ErrMask%20%3D%200x01080000%2C%20which%20means%20CRC_ERROR%20%2B%20DRIBBLE_ERROR.%3C%2FP%3E%3CP%20class%3D%22%22%3EWe%20also%20checked%20the%20RX%20buffer%20content.%20The%20frame%20seems%20to%20reach%20the%20GMAC%2C%20but%20some%20bytes%20are%20received%20with%20incorrect%20bits.%20For%20example%2C%20the%20expected%20frame%20was%3A%3C%2FP%3E%3CP%20class%3D%22%22%3EDestination%20MAC%3A%2002%3A00%3A00%3A00%3A00%3A02%3CBR%20%2F%3ESource%20MAC%3A%2011%3A12%3A21%3A77%3A77%3A77%3CBR%20%2F%3EEtherType%3A%2088%3A88%3C%2FP%3E%3CP%20class%3D%22%22%3EBut%20what%20appeared%20in%20the%20RX%20buffer%20was%20something%20like%3A%3C%2FP%3E%3CP%20class%3D%22%22%3EDestination%20MAC%3A%2021%3A00%3A00%3A00%3A00%3A02%3CBR%20%2F%3ESource%20MAC%3A%2011%3A21%3A11%3A76%3A77%3A77%3CBR%20%2F%3EEtherType%3A%208B%3A88%3C%2FP%3E%3CP%20class%3D%22%22%3EAfter%20that%2C%20a%20byte%2008%20appeared%2C%20and%20then%20the%20remaining%20bytes%20were%20zero.%3C%2FP%3E%3CP%20class%3D%22%22%3EThis%20suggests%20that%20the%20frame%20is%20reaching%20the%20GMAC%2C%20but%20the%20data%20is%20being%20sampled%20with%20incorrect%20or%20misaligned%20bits.%3C%2FP%3E%3CP%20class%3D%22%22%3EWe%20also%20observed%20CRS_DV%20on%20the%20oscilloscope.%20At%20the%20end%20of%20the%20frame%2C%20when%20it%20goes%20low%2C%20it%20toggles%20for%20a%20few%20cycles%20before%20becoming%20definitively%20low.%20From%20our%20understanding%2C%20this%20behavior%20may%20be%20normal%20in%20RMII%20because%20CRS_DV%20combines%20CRS%20and%20RX_DV%2C%20but%20we%20would%20like%20to%20confirm%20if%20this%20is%20expected%20with%20the%20S32K344%2FGMAC.%3C%2FP%3E%3CP%20class%3D%22%22%3EAfter%20that%2C%20we%20reviewed%20the%20board%20again%20and%20confirmed%20that%20the%20resistors%2Fjumpers%20for%20the%20remaining%20RMII%20signals%20are%20mounted%20correctly.%20After%20the%20issue%20found%20on%20R190%2C%20we%20also%20reviewed%20the%20other%20RMII%20signals%20and%20did%20not%20find%20any%20other%20missing%20or%20open%20resistors.%3C%2FP%3E%3CP%20class%3D%22%22%3EWe%20also%20implemented%20a%20loopback%20test%20on%20the%20KSZ8091RND%20PHY.%20We%20configured%20the%20PHY%20through%20MDIO%20for%20loopback%20in%20the%20Basic%20Control%20register.%20In%20the%20debugger%2C%20we%20confirmed%20that%20the%20bits%20are%3A%3C%2FP%3E%3CP%20class%3D%22%22%3Eloopback%20%3D%201%3CBR%20%2F%3EspeedSelect%20%3D%201%3CBR%20%2F%3EautoNegotiationEnable%20%3D%200%3CBR%20%2F%3EduplexMode%20%3D%201%3C%2FP%3E%3CP%20class%3D%22%22%3ESo%20the%20PHY%20is%20in%20loopback%20mode%2C%20100%20Mbps%2C%20full-duplex%2C%20with%20auto-negotiation%20disabled.%3C%2FP%3E%3CP%20class%3D%22%22%3EIn%20this%20mode%2C%20our%20software%20transmits%20a%20frame%20through%20the%20GMAC%20and%20immediately%20polls%20for%20reception%20using%20Eth_43_GMAC_Receive.%20The%20TX%20sequence%20still%20confirms%20correctly%20with%20Eth_43_GMAC_TxConfirmation.%3C%2FP%3E%3CP%20class%3D%22%22%3EEven%20with%20the%20PHY%20in%20loopback%20mode%2C%20the%20issue%20remains.%20The%20frame%20still%20reaches%20the%20RX%20buffer%2C%20but%20with%20corrupted%20bytes%2C%20and%20the%20driver%20still%20reports%20ErrMask%20%3D%200x01080000%2C%20which%20means%20CRC_ERROR%20%2B%20DRIBBLE_ERROR.%3C%2FP%3E%3CP%20class%3D%22%22%3EThis%20seems%20to%20remove%20the%20cable%20and%20the%20other%20device%20from%20the%20analysis%2C%20since%20the%20issue%20also%20happens%20on%20the%20local%20path%20MCU%20-%26gt%3B%20PHY%20-%26gt%3B%20internal%20PHY%20loopback%20-%26gt%3B%20MCU.%3C%2FP%3E%3CP%20class%3D%22%22%3ECurrently%2C%20our%20answers%20to%20your%20points%20are%3A%3C%2FP%3E%3CP%20class%3D%22%22%3E1-%26gt%3BWe%20confirmed%20that%20EMAC_MII_RMII_TX%20%3D%2050%20MHz%20and%20that%20EMAC0_RX_CLK%20%2F%20EMAC0_TX_CLK%20%3D%2025%20MHz%20seem%20to%20be%20normal%20in%20RMII.%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3E2-%26gt%3BWe%20confirmed%20that%20emac_mii_rx_clk%20is%20not%20required%20in%20RMII.%20It%20was%20removed%20from%20the%20configuration%2C%20but%20the%20issue%20continued.%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E3-%26gt%3BWe%20confirmed%20that%20the%20driver%20configures%20DCMRWF1.MAC_CONF_SEL%20%3D%202U.%3C%2FP%3E%3CP%20class%3D%22%22%3E4-%26gt%3BWe%20confirmed%20with%20an%20oscilloscope%20that%20the%2050%20MHz%20clock%20reaches%20the%20MCU%20pin%20PTC0%20%2F%20emac_mii_rmii_tx_clk.%3C%2FP%3E%3CP%20class%3D%22%22%3E5-%26gt%3BWe%20confirmed%20that%20CRS_DV%20now%20reaches%20the%20MCU%20after%20mounting%2Fclosing%20resistor%20R190.%3C%2FP%3E%3CP%20class%3D%22%22%3E6-%26gt%3BWe%20confirmed%20that%20RX_ER%20remains%20low%20all%20the%20time%20during%20reception.%3C%2FP%3E%3CP%20class%3D%22%22%3E7-%26gt%3BWe%20confirmed%20that%20PHY%20loopback%20is%20really%20active%20according%20to%20the%20BMCR%20readback.%3C%2FP%3E%3CP%20class%3D%22%22%3E8-%26gt%3BWe%20confirmed%20that%20the%20resistors%2Fjumpers%20for%20the%20remaining%20RMII%20signals%20are%20mounted%20correctly.%3C%2FP%3E%3CP%20class%3D%22%22%3EEven%20so%2C%20we%20are%20still%20receiving%20frames%20with%20corrupted%20bytes%20and%20CRC_ERROR%20%2B%20DRIBBLE_ERROR.%3C%2FP%3E%3CP%20class%3D%22%22%3EIn%20this%20scenario%2C%20the%20issue%20still%20seems%20related%20to%20the%20local%20RMII%20interface%20between%20the%20S32K344%20and%20the%20KSZ8091RND%2C%20possibly%20timing%2Fskew%20between%20REF_CLK%2C%20TXD0%2FTXD1%2FTX_EN%2C%20CRS_DV%20and%20RXD0%2FRXD1%2C%20or%20some%20electrical%2Fpad%20configuration%20of%20the%20RMII%20signals.%3C%2FP%3E%3CP%20class%3D%22%22%3EDo%20you%20have%20any%20specific%20recommendation%20for%20this%20case%2C%20now%20that%20the%20error%20also%20occurs%20with%20PHY%20loopback%20enabled%3F%20Is%20there%20any%20pad%20configuration%2C%20clock%20phase%2C%20drive%20strength%2C%20slew%20rate%2C%20or%20series%20resistor%20requirement%20for%20RMII%20on%20the%20S32K344%20Mini%20EVB%20that%20we%20should%20verify%3F%3C%2FP%3E%3CP%20class%3D%22%22%3EIs%20there%20also%20any%20recommended%20GMAC%20or%20PHY%20test%20to%20separate%20whether%20the%20issue%20is%20on%20the%20TX%20RMII%20path%20from%20the%20MCU%20to%20the%20PHY%20or%20on%20the%20RX%20RMII%20path%20from%20the%20PHY%20to%20the%20MCU%3F%3C%2FP%3E%3CP%20class%3D%22%22%3EThank%20you%20in%20advance%20for%20your%20support%20and%20guidance.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2374878%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K344%20Mini%20EVB%20%2B%20GMAC%20RMII%20%2B%20KSZ8091RND%3A%20RX%20frames%20discarded%20with%20CRC_ERROR%20%2B%20DRIBBLE_ERROR%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2374878%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F256974%22%20target%3D%22_blank%22%3E%40brunoGT88%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EThank%20you%20for%20the%20very%20detailed%20description.%20I%20reviewed%20your%20setup%20carefully.%3C%2FP%3E%0A%3CP%3EBased%20on%20what%20you%20described%2C%20this%20looks%20more%20like%20a%20typical%20RMII%20clocking%20issue%20than%20a%20problem%20in%20the%20Eth_43_GMAC%20TX%2FRX%20software%20flow.%3C%2FP%3E%0A%3CP%3EAt%20first%2C%20Please%20check%20that%20the%20external%20RMII%2050%20MHz%20clock%20is%20present%20and%20stable%20before%20calling%20Eth_43_GMAC_Init().%20This%20is%20an%20important%20point%20for%20S32K344%20RMII%20setups.%3C%2FP%3E%0A%3CP%3ERegarding%20your%20questions%3A%3C%2FP%3E%0A%3CP%3E1.%20Yes%20-%20in%20RMII%20mode%2C%20it%20is%20expected%20that%20the%20clock%20configuration%20shows%20EMAC_MII_RMII_TX%20%3D%2050%20MHz%20while%20the%20internal%20EMAC0_RX_CLK%20and%20EMAC0_TX_CLK%20are%20derived%20as%2025%20MHz.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2.%20No%20-%20emac_mii_rx_clk%20is%20not%20used%20by%20the%20S32K344%20EMAC%20in%20RMII%20mode.%20In%20the%20usual%20S32K3%20RMII%20setup%2C%20the%20PHY%20provides%20the%2050%20MHz%20TX%20clock%20to%20the%20MAC%20and%20the%20internal%20EMAC%20RX%2FTX%20clocks%20are%20derived%20from%20that%20clock%20using%20divider%202.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E3.%20On%20my%20side%2C%20I%20typically%20use%20only%20the%20RMII%20selection%20in%20DCMRWF1%20as%20the%20key%20additional%20setting%2C%20usually%20as%20the%20very%20first%20row%20in%20the%20project%3A%3C%2FP%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%20padding%3A%200px%200px%200px%202px%3B%22%3E%0A%3CDIV%20style%3D%22color%3A%20%23000000%3B%20background-color%3A%20%23ffffff%3B%20font-family%3A%20'Courier%20New'%3B%20font-size%3A%2010pt%3B%20white-space%3A%20pre%3B%22%3E%0A%3CP%20style%3D%22margin%3A%200%3B%22%3E%3CSPAN%3EIP_DCM_GPR%3C%2FSPAN%3E%3CSPAN%3E-%26gt%3B%3C%2FSPAN%3E%3CSPAN%3EDCMRWF1%3C%2FSPAN%3E%3CSPAN%3E%20%3D%20(%3C%2FSPAN%3E%3CSPAN%3EIP_DCM_GPR%3C%2FSPAN%3E%3CSPAN%3E-%26gt%3B%3C%2FSPAN%3E%3CSPAN%3EDCMRWF1%3C%2FSPAN%3E%3CSPAN%3E%20%26amp%3B%20~DCM_GPR_DCMRWF1_MAC_CONF_SEL_MASK)%20%7C%20DCM_GPR_DCMRWF1_MAC_CONF_SEL(2U)%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E4.%20The%20PHY%20clocking%20part%20is%20still%20not%20fully%20clear%20from%20your%20description.%20Saying%20that%20the%20KSZ8091RND%20receives%2050%20MHz%20on%20XI%20does%20not%20automatically%20confirm%20that%20the%20S32K344%20MAC%20is%20receiving%20the%20required%2050%20MHz%20RMII%20reference%20clock%20on%20emac_mii_rmii_tx_clk.%20Please%20%3CSTRONG%3Econfirm%3C%2FSTRONG%3E%20how%20exactly%20the%2050%20MHz%20RMII%20reference%20clock%20is%20connected%20between%20the%20PHY%20%2F%20oscillator%20and%20the%20MCU%20and%20ideally%20share%20that%20portion%20of%20the%20schematic.%3C%2FP%3E%0A%3CP%3E5.%20For%20CRC%20error%20%2B%20dribble%20error%20on%20RX%2C%20I%20would%20check%20the%20RMII%20clocking%2Fsignals%20in%20this%20order%3A%3C%2FP%3E%0A%3CP%3EREF_CLK%20%2F%20RMII_TX_CLK%20(50%20MHz)%3CBR%20%2F%3ECRS_DV%3CBR%20%2F%3ERXD0%20%2F%20RXD1%3CBR%20%2F%3ERX_ER%3C%2FP%3E%0A%3CP%3E6.%20I'm%20not%20aware%20of%20an%20official%20NXP%20example%20specifically%20for%20S32K344%20%2B%20KSZ8091RND%20%2B%20RMII%20%2B%20no%20lwIP.%20However%2C%20you%20may%20refer%20to%20this%20S32K344%20EMAC%20example%20and%20compare%20your%20clock%2Fpin%20setup%20against%20it%2C%20or%20adapt%20it%20to%20your%20board%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K344-EMAC-lwIP-FreeRTOS-miniEVB-S32DS-3-6-1-RTD-6-0-0%2Fta-p%2F2320618%22%20target%3D%22_blank%22%3EExample%20S32K344%20EMAC%20lwIP%20FreeRTOS%20miniEVB%20S32DS%203.6.1%20RTD%206.0.0%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EAs%20an%20additional%20debug%20step%2C%20if%20your%20PHY%20supports%20it%2C%20please%20also%20try%20enabling%20MII%2FRMII%20loopback%20on%20the%20PHY%20side%20so%20that%20the%20MAC%20can%20receive%20back%20frames%20that%20it%20transmitted.%20This%20can%20help%20separate%20a%20PHY%2Flink-level%20problem%20from%20an%20MCU%20RX%20sampling%20problem.%3C%2FP%3E%0A%3CP%3EBest%20regards%2C%3C%2FP%3E%0A%3CP%3EPavel%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2374680%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K344%20Mini%20EVB%20%2B%20GMAC%20RMII%20%2B%20KSZ8091RND%3A%20RX%20frames%20discarded%20with%20CRC_ERROR%20%2B%20DRIBBLE_ERROR%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2374680%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI'm%20using%20RTD%205.0.0.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2375738%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K344%20Mini%20EVB%20%2B%20GMAC%20RMII%20%2B%20KSZ8091RND%3A%20RX%20frames%20discarded%20with%20CRC_ERROR%20%2B%20DRIBBLE_ERROR%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2375738%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20class%3D%22%22%3EHello%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F233505%22%20target%3D%22_blank%22%3E%40PavelL%3C%2FA%3E%2C%3C%2FP%3E%3CP%20class%3D%22%22%3EWe%20have%20an%20important%20new%20finding.%3C%2FP%3E%3CP%20class%3D%22%22%3EWe%20tested%20the%20board%20TX%20using%20Wireshark%20on%20the%20PC.%20The%20firmware%20sends%20frames%20with%3A%3C%2FP%3E%3CP%20class%3D%22%22%3EDestination%20MAC%3A%2070%3A69%3A79%3AA6%3A74%3A4F%3CBR%20%2F%3ESource%20MAC%3A%2011%3A12%3A21%3A77%3A77%3A77%3CBR%20%2F%3EEtherType%3A%200x8888%3CBR%20%2F%3EPayload%3A%200x55%20pattern%3C%2FP%3E%3CP%20class%3D%22%22%3EHowever%2C%20Wireshark%20shows%20that%20the%20frames%20arriving%20at%20the%20PC%20are%20already%20corrupted.%20The%20source%20MAC%2C%20destination%20MAC%2C%20and%20EtherType%20are%20not%20correct.%3C%2FP%3E%3CP%20class%3D%22%22%3ESo%20the%20issue%20is%20not%20only%20on%20RX%20into%20the%20S32K344.%20The%20TX%20path%20from%20the%20S32K344%20to%20the%20PHY-PC%20is%20also%20corrupting%20bits.%3C%2FP%3E%3CP%20class%3D%22%22%3EMAC%20internal%20loopback%20still%20works%20correctly%2C%20so%20the%20frame%20is%20built%20correctly%20inside%20the%20GMAC.%20The%20corruption%20appears%20when%20the%20frame%20goes%20out%20through%20the%20external%20RMII%20interface.%3C%2FP%3E%3CP%20class%3D%22%22%3EThis%20now%20points%20more%20strongly%20to%20the%20external%20RMII%20TX%20path%20or%20pad%20configuration%3A%3C%2FP%3E%3CP%20class%3D%22%22%3ETXD0%3CBR%20%2F%3ETXD1%3CBR%20%2F%3ETX_EN%3CBR%20%2F%3EREF_CLK%20-%20RMII_TX_CLK%3C%2FP%3E%3CP%20class%3D%22%22%3EDo%20you%20recommend%20any%20specific%20pad%20settings%20for%20RMII%20TX%20on%20S32K344%2C%20such%20as%20drive%20strength%2C%20slew%20rate%2C%20keeper%2C%20or%20pull%20configuration%3F%20Currently%20the%20generated%20pin%20configuration%20shows%20driveStrengthEnable%20disabled%20for%20TXD0%2C%20TXD1%2C%20TX_EN%2C%20and%20TX_CLK.%3C%2FP%3E%3CP%20class%3D%22%22%3EThank%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2375855%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K344%20Mini%20EVB%20%2B%20GMAC%20RMII%20%2B%20KSZ8091RND%3A%20RX%20frames%20discarded%20with%20CRC_ERROR%20%2B%20DRIBBLE_ERROR%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2375855%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F256974%22%20target%3D%22_blank%22%3E%40brunoGT88%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EThank%20you%20for%20the%20detailed%20update%20and%20for%20performing%20the%20additional%20checks.%20Your%20latest%20results%20are%20very%20helpful.%26nbsp%3BSince%3A%20MAC%20internal%20loopback%20passes%2C%20PHY%20loopback%20still%20fails%20and%3CBR%20%2F%3Ethe%20frame%20is%20already%20corrupted%20on%20TX%20when%20observed%20on%20the%20PC%20-%20this%20strongly%20suggests%20that%20the%20issue%20is%20not%20in%20the%20GMAC%20driver%20flow%2C%20buffer%20handling%20or%20internal%20MAC%20path.%3C%2FP%3E%0A%3CP%3EThe%20remaining%20suspect%20area%20is%20the%20external%20RMII%20interface%20between%20the%20S32K344%20and%20the%20KSZ8091RND%2C%20including%20signal%20routing%2C%20pin%20mapping%2C%20I%2FO%20voltage%20compatibility%20or%20timing%20%2F%20signal%20integrity%20on%20the%20RMII%20lines.%20Please%20kindly%20review%20my%20suggestions%3A%3C%2FP%3E%0A%3CDIV%3E%0A%3CUL%3E%0A%3CLI%3EVerify%20I%2FO%20voltage%20compatibility%20between%20the%20KSZ8091RND%20and%20the%20S32K344%20RMII%20pins.%3C%2FLI%3E%0A%3CLI%3ECheck%20pin-to-pin%20continuity%20and%20signal%20mapping%20for%20all%20RMII%20lines.%3C%2FLI%3E%0A%3CLI%3EConfirm%20that%20TXD0%2FTXD1%20and%20RXD0%2FRXD1%20are%20not%20swapped%20anywhere%20on%20the%20board.%3C%2FLI%3E%0A%3CLI%3EProbe%20the%20RMII%20TX%20interface%20directly%20at%20the%20PHY%20pins%20(REF_CLK%2C%20TX_EN%2C%20TXD0%2C%20TXD1).%3C%2FLI%3E%0A%3CLI%3EReconstruct%20the%20transmitted%20frame%20from%20the%20RMII%20TX%20signals%20and%20compare%20it%20with%20the%20expected%20frame.%3C%2FLI%3E%0A%3CLI%3ERecheck%20the%20PHY%20strap%20configuration%20and%20confirm%20the%20intended%20RMII%20%2F%20reference%20clock%20mode%20after%20reset.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FDIV%3E%0A%3CP%3EBest%20regards%2C%3C%2FP%3E%0A%3CP%3EPavel%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2376212%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K344%20Mini%20EVB%20%2B%20GMAC%20RMII%20%2B%20KSZ8091RND%3A%20RX%20frames%20discarded%20with%20CRC_ERROR%20%2B%20DRIBBLE_ERROR%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2376212%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20class%3D%22%22%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F233505%22%20target%3D%22_blank%22%3E%40PavelL%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%3CP%20class%3D%22%22%3EI%20found%20the%20root%20cause.%3C%2FP%3E%3CP%20class%3D%22%22%3EThe%20issue%20was%20related%20to%20the%20initialization%20order.%20In%20my%20project%2C%20the%20MCU-clock%20initialization%20was%20being%20executed%20before%20the%20SIUL2%20pin%20mux%20initialization.%20After%20changing%20the%20startup%20flow%20so%20that%20the%20pin%20mux%20configuration%20is%20done%20first%2C%20before%20MCU%20clock%20initialization%2C%20the%20Ethernet%20frames%20are%20now%20transmitted%20correctly.%3C%2FP%3E%3CP%20class%3D%22%22%3EThis%20also%20matches%20the%20initialization%20order%20used%20in%20the%20clean%20NXP%20example%20I%20compared%20against.%3C%2FP%3E%3CP%20class%3D%22%22%3EThank%20you%20for%20the%20support.%3C%2FP%3E%3C%2FLINGO-BODY%3E