Hello @zhangzhixing ,
Thank you for the detailed description.
May I ask which version of the RTD you are currently using?
Below are a few suggestions based on the RTD 4.0.0 and the lwIP example for S32K396. I hope they help clarify the configuration:
1. Pin Configuration
The pin settings in the Gmac_Ip_InternalLoopback_S32K396 example look correct.
You might consider starting with the Fastest drive strength for output pins.
2. Clock Configuration
The EMAC clock shall be configured for RMII as shown on the picture (from S32K344):
PavelL_0-1750839936554.png
Based on the lwIP example, please verify the DCM_GPR configuration:
/* Set RMII configuration for EMAC in DCM module */
IP_DCM_GPR->DCMRWF1 |= DCM_GPR_DCMRWF1_MAC_CONF_SEL_MASK;
This line is typically placed very early in the initialization sequence, often before any clock or peripheral setup.
Please note: This configuration differs from the one used on S32K344, as the DCMRWF1 register layout has changed in the S32K396.
3. PHY Reset Sequence
Ensure the PHY is properly reset and stabilized before EMAC initialization:
- A good place for the PHY reset is after Siul2_Port_Ip_Init() and before Clock_Ip_Init().
- Make sure to insert a delay (typically 3-5 msec - depends on used PHY) after releasing the PHY reset to allow it to complete internal initialization.
Also verify:
- The PHY has completed its internal startup sequence.
- The RMII clock (50 MHz) is present and stable before calling Clock_Ip_Init() and initializing the EMAC.
Please feel free to use the lwIP example as a reference. However, all the checks and updates mentioned above are still necessary to ensure proper functionality.
Best regards,
Pavel