Hi all!
During development I encountered Ethernet connection stability issues. After some investigation using both rw612 custom board and frdm_rw612, it occured that frequency on MDC pin was wrong. Instead of 2.5MHz, it is 13 MHz. As Ethernet module ksz8081 allows up to 10 MHz MDC frequency, it is just luck that eth is working stable on frdm_rw612 (you can flash any eth sample from Zephyr and see that frequency on MDC pin on frdm_rw612 is 13 MHz)
Getting deeper, it seems that issue root cause is in ethernet MSCR register, which for MII_SPEED calculation uses fixed 50MHz clock value. I found it in Zephyr under CLOCK_GetTddrMciEnetClkFreq(void) function in mcux/mcux-sdk/devices/RW612/drivers/fsl_clock.c.
When i calculate this register value using M33 processor frequency (260 MHz), then I see correct MDC frequency - 2.5MHz.
According to RW612 datasheet frequency in code (50 MHz) seems to be correct, but in reality it uses 260 MHz clock as reference to calculations.
Initially I changed returned value from CLOCK_GetTddrMciEnetClkFreq to 260 MHz, but I'm not sure that it won't influence on other part of code but it now works.
Could You please confirm that issue exists and help me where to fix it?
Hello,
Hope you are doing well. Could you please give us more details about your setup?
What SDK version are you using? Did you try with the ethernet example from the SDK?
How are you measuring this with the FRDM?
Best Regards,
Ricardo
Hello Ricardo,
With our product we are working on Zephyr 3.7 but to be sure that this issue is reproducible I set up Zephyr 4.1.0.rc3, it uses zephyrSdk 0.17.0 and in west.yml I see that it points to HAL NXP rev. 9dc7449014a7380355612453b31be479cb3a6833 (https://github.com/zephyrproject-rtos/hal_nxp/commits/9dc7449014a7380355612453b31be479cb3a6833).
I build dhcpv4 example from Zephyr samples using the following command:
west build -b frdm_rw612 samples/net/dhcpv4_client/ -p
After flashing, I see on console that this example starts correctly. I measured frequency on GPIO56 (exactly on R31 on frdm_rw612 board). Please see image from frdm_rw612 schematic:
Measured frequency is ~13 MHz. According to ksz8081 datasheet it shall not exceed 10MHz and optimal conditions is if this frequency is 2.5 MHz:
Looking into MSCR register, it seems to have correct value, but in reality it has to be recalculated using 260 MHz frequency, not 50 MHz. Because of that MSCR MII_SPEED is 13MHz instead of 2.5MHz and MSCR HOLDTIME is set to 0 causing connection issues.
I've made some work-around in enet devicetree, but it can't be like that. Using the following method leaves HOLDTIME value wrong and there are still some communication issues.
I didn't tried eth example from mcuexpresso as we are using Zephyr for our development
Here I attach measuring MDC frequency with changed CLOCK_GetTddrMciEnetClkFreq to 260 MHz:
Hello,
I know that you are using Zephyr, but could you please help us check if this issue is also present when using the MCUXpresso SDK?
I also will be checking the Zephyr example in the meantime.
Regards,
Ricardo
Hello Ricardo,
are there any updates?
It seems that in MCUxpresso sample 260 MHz frequency is being used to calculate MSCR register values:
Hi,
No problem, I've flashed frdmrw612_enet_txrx_transfer sample using MCUXpresso IDE 24.9.25 and here everything seems to work fine, measured frequency on MDC pin is 2.5 MHz