I started evaluating MCXN547 ENET peripheral functionalities on MCX-N5XX-EVK board.
On that board the Ethernet PHY clock input can be either of the following:
- OSC_50M clock from an external 50 MHz crystal oscillator (Y7) enabled by JP50 jumper open.
- ENET0_TXCLK clock received through the MCU P1_4 port
I checked the mcxn5xxevk_lwip_dhcp_bm SDK 2.16 example with JP50 open and the EVK board properly receives a IPv4 configuration from my network DHCP.
Then I replaced in the lwip_dhcp_bm.c source file the PHY input clock assertion:
CLOCK_AttachClk(MUX_A(CM_ENETRMIICLKSEL, 0));
with my new assertion:
/* Use internal reference clock. */
/* attach PLL0_CLK_clock to ENETRMII */
CLOCK_AttachClk(kPLL0_to_ENETRMII);
/*!< Set up ENETRMIICLKDIV divider */
CLOCK_SetClkDiv(kCLOCK_DivEnetrmiiClk, 3U);
and I build and check the same mcxn5xxevk_lwip_dhcp_bm demo application with JP50 closed (using ENET0_TXCLK clock).
But now the PHY state is "down" and Auto-negotiation fails till finally PHY state becomes "up", but then returns again "down" and DHCP configuration is never received.
PLL0_CLK should be set to 150MHz by BOARD_InitBootClocks() function, right?.
How to properly drive the Ethernet PHY with the ENET0_TXCLK clock from MCU ?