Clock issue of S32K3 EMAC

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

Clock issue of S32K3 EMAC

1,112 Views
wuxianlong
Contributor V

Hi, NXP

Regarding the clock configuration of the EMAC of S32K3, why is there a timing issue between the input clock and the register configuration?

After TXC and RXC receive stable clocks, configure the relevant registers MUX_7.MUx_8, MUX_9, and the EMAC can work normally.

Before TXC and RXC receive stable clocks, configure the relevant registers MUX_7.MUx_8, MUX_9, and the output rate of the EMAC will be abnormal.

I compared the relevant registers, and all are the same configurations. wuxianlong_0-1761725478471.png

Best Regards,
xianlong

0 Kudos
Reply
7 Replies

510 Views
sw_ma
Contributor II

I encountered an initialization timing issue while using the Emac function of s32k314. If initialization is performed according to the timing in the demo (initializing GPIO first and then initializing clock), EMAC can work normally. However, if initialization is performed according to the timing of initializing GPIO first and then initializing clock, EMAC will run abnormally. Why is this?

0 Kudos
Reply

492 Views
wuxianlong
Contributor V
This problem you mentioned is the same as mine. Before the pin initialization, both EMAC_TXC/RXC are in GPIO mode. If the clock is initialized directly, the condition cannot be met (the clock initialization of the EMAC must be performed after the clock input is stable). As for why this condition needs to be met, there is currently no explanation or description.
0 Kudos
Reply

416 Views
sw_ma
Contributor II
Thank you for your answer. I now have a better understanding of this question.
0 Kudos
Reply

1,086 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

there should be no issue if the clock MUXes (MUX_7, MUX_8, MUX_9) are configured before the external TXC/RXC clocks become stable. However, it is essential to ensure that the EMAC initialization is performed only after the external clocks are stable. This is typically achieved by adding a delay after clock and pin initialization.

BR, Petr

0 Kudos
Reply

1,067 Views
wuxianlong
Contributor V

Hi,@PetrS

Thank you for your reply.
After I tested adding a delay, the EMAC was able to send out MAC frames, but the data was incorrect.

The difference I tested: whether to configure the clock multiplexers (MUX_7, MUX_8, MUX_9) before the external TXC/RXC clock is stable.
wuxianlong_0-1761788185412.png

wuxianlong_1-1761788275424.png

wuxianlong_2-1761788351696.png

Best Regards.
xianlong

 

0 Kudos
Reply

1,039 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

if the issue is related to the placement of PHY RST deassertion—working when done before clock initialization but failing when done after—it could still be due to insufficient delay for PHY activation.

Please note that the PHY typically requires a delay of around 6 ms or more after RST deassertion before it becomes fully active. Try extending the delay you're currently using to ensure proper PHY readiness.

Also, if you deassert RST before clock initialization, you inherently introduce some delay due to waiting for the crystal oscillator, PLL lock, and mode transitions. This might explain why it works in that case.

If the issue persists, please share:

  • The full project you're using
  • Details about the hardware setup

This will help in diagnosing the problem more accurately.

BR, Petr

0 Kudos
Reply

1,029 Views
wuxianlong
Contributor V

Hi,

I tested it using the S32K3x4. This issue is not related to the RTD version or the type of PHY chip.
You can test and reproduce it.

Best Regards,

xianlong

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2194936%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EClock%20issue%20of%20S32K3%20EMAC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2194936%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%EF%BC%8C%20NXP%3CBR%20%2F%3E%3CBR%20%2F%3ERegarding%20the%20clock%20configuration%20of%20the%20EMAC%20of%20S32K3%2C%20why%20is%20there%20a%20timing%20issue%20between%20the%20input%20clock%20and%20the%20register%20configuration%3F%3C%2FP%3E%3CP%3EAfter%20TXC%20and%20RXC%20receive%20stable%20clocks%2C%20configure%20the%20relevant%20registers%20MUX_7.MUx_8%2C%20MUX_9%2C%20and%20the%20EMAC%20can%20work%20normally.%3C%2FP%3E%3CP%3EBefore%20TXC%20and%20RXC%20receive%20stable%20clocks%2C%20configure%20the%20relevant%20registers%20MUX_7.MUx_8%2C%20MUX_9%2C%20and%20the%20output%20rate%20of%20the%20EMAC%20will%20be%20abnormal.%3C%2FP%3E%3CP%3EI%20compared%20the%20relevant%20registers%2C%20and%20all%20are%20the%20same%20configurations.%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22wuxianlong_0-1761725478471.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_0-1761725478471.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_0-1761725478471.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_0-1761725478471.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_0-1761725478471.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F363046i233AD6CDFB9AFB13%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22wuxianlong_0-1761725478471.png%22%20alt%3D%22wuxianlong_0-1761725478471.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EBest%20Regards%2C%3CBR%20%2F%3Exianlong%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2195736%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Clock%20issue%20of%20S32K3%20EMAC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2195736%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%EF%BC%8C%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EI%20tested%20it%20using%20the%20S32K3x4.%20This%20issue%20is%20not%20related%20to%20the%20RTD%20version%20or%20the%20type%20of%20PHY%20chip.%3CBR%20%2F%3EYou%20can%20test%20and%20reproduce%20it.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSPAN%3EBest%20Regards%2C%3C%2FP%3E%3CP%3Exianlong%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2195700%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Clock%20issue%20of%20S32K3%20EMAC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2195700%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3Eif%20the%20issue%20is%20related%20to%20the%20placement%20of%20PHY%20RST%20deassertion%E2%80%94working%20when%20done%20before%20clock%20initialization%20but%20failing%20when%20done%20after%E2%80%94it%20could%20still%20be%20due%20to%20insufficient%20delay%20for%20PHY%20activation.%3C%2FP%3E%0A%3CP%3EPlease%20note%20that%20the%20PHY%20typically%20requires%20a%20delay%20of%20around%206%20ms%20or%20more%20after%20RST%20deassertion%20before%20it%20becomes%20fully%20active.%20Try%20extending%20the%20delay%20you're%20currently%20using%20to%20ensure%20proper%20PHY%20readiness.%3C%2FP%3E%0A%3CP%3EAlso%2C%20if%20you%20deassert%20RST%20before%20clock%20initialization%2C%20you%20inherently%20introduce%20some%20delay%20due%20to%20waiting%20for%20the%20crystal%20oscillator%2C%20PLL%20lock%2C%20and%20mode%20transitions.%20This%20might%20explain%20why%20it%20works%20in%20that%20case.%3C%2FP%3E%0A%3CP%3EIf%20the%20issue%20persists%2C%20please%20share%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EThe%20full%20project%20you're%20using%3C%2FLI%3E%0A%3CLI%3EDetails%20about%20the%20hardware%20setup%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThis%20will%20help%20in%20diagnosing%20the%20problem%20more%20accurately.%3C%2FP%3E%0A%3CP%3EBR%2C%20Petr%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2195363%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Clock%20issue%20of%20S32K3%20EMAC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2195363%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F52961%22%20target%3D%22_blank%22%3E%40PetrS%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EThank%20you%20for%20your%20reply.%3CBR%20%2F%3EAfter%20I%20tested%20adding%20a%20delay%2C%20the%20EMAC%20was%20able%20to%20send%20out%20MAC%20frames%2C%20but%20the%20data%20was%20incorrect.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EThe%20difference%20I%20tested%3A%20whether%20to%20configure%20the%20clock%20multiplexers%20(MUX_7%2C%20MUX_8%2C%20MUX_9)%20before%20the%20external%20TXC%2FRXC%20clock%20is%20stable.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22wuxianlong_0-1761788185412.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_0-1761788185412.png%22%20style%3D%22width%3A%20917px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_0-1761788185412.png%22%20style%3D%22width%3A%20917px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_0-1761788185412.png%22%20style%3D%22width%3A%20917px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_0-1761788185412.png%22%20style%3D%22width%3A%20917px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F363144i5869945354E63357%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22wuxianlong_0-1761788185412.png%22%20alt%3D%22wuxianlong_0-1761788185412.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22wuxianlong_1-1761788275424.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_1-1761788275424.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_1-1761788275424.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_1-1761788275424.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_1-1761788275424.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F363145iC98BFAB1B0D4091B%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22wuxianlong_1-1761788275424.png%22%20alt%3D%22wuxianlong_1-1761788275424.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22wuxianlong_2-1761788351696.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_2-1761788351696.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_2-1761788351696.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_2-1761788351696.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wuxianlong_2-1761788351696.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F363146i8A079B4C304F0257%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22wuxianlong_2-1761788351696.png%22%20alt%3D%22wuxianlong_2-1761788351696.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EBest%20Regards.%3CBR%20%2F%3Exianlong%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2195117%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Clock%20issue%20of%20S32K3%20EMAC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2195117%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3Ethere%20should%20be%20no%20issue%20if%20the%20clock%20MUXes%20(MUX_7%2C%20MUX_8%2C%20MUX_9)%20are%20configured%20before%20the%20external%20TXC%2FRXC%20clocks%20become%20stable.%20However%2C%20it%20is%20essential%20to%20ensure%20that%20the%20EMAC%20initialization%20is%20performed%20only%20after%20the%20external%20clocks%20are%20stable.%20This%20is%20typically%20achieved%20by%20adding%20a%20delay%20after%20clock%20and%20pin%20initialization.%3C%2FP%3E%0A%3CP%3EBR%2C%20Petr%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2252698%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%20Clock%20issue%20of%20S32K3%20EMAC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2252698%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EThis%20problem%20you%20mentioned%20is%20the%20same%20as%20mine.%20Before%20the%20pin%20initialization%2C%20both%20EMAC_TXC%2FRXC%20are%20in%20GPIO%20mode.%20If%20the%20clock%20is%20initialized%20directly%2C%20the%20condition%20cannot%20be%20met%20(the%20clock%20initialization%20of%20the%20EMAC%20must%20be%20performed%20after%20the%20clock%20input%20is%20stable).%20As%20for%20why%20this%20condition%20needs%20to%20be%20met%2C%20there%20is%20currently%20no%20explanation%20or%20description.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2252622%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%20Clock%20issue%20of%20S32K3%20EMAC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2252622%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20encountered%20an%20initialization%20timing%20issue%20while%20using%20the%20Emac%20function%20of%20s32k314.%20If%20initialization%20is%20performed%20according%20to%20the%20timing%20in%20the%20demo%20(initializing%20GPIO%20first%20and%20then%20initializing%20clock)%2C%20EMAC%20can%20work%20normally.%20However%2C%20if%20initialization%20is%20performed%20according%20to%20the%20timing%20of%20initializing%20GPIO%20first%20and%20then%20initializing%20clock%2C%20EMAC%20will%20run%20abnormally.%20Why%20is%20this%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2258772%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%20Clock%20issue%20of%20S32K3%20EMAC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2258772%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EThank%20you%20for%20your%20answer.%20I%20now%20have%20a%20better%20understanding%20of%20this%20question.%3C%2FLINGO-BODY%3E