2024-02-28 05:38 AM
Heyho,
until now I only used STM32 with the LAN8742, in a few weeks I'll get my 2nd custom board, but this time with the "dual" PHY KSZ8863RLL.
It's connected via RMII, for setup MDIO (and optionally I2C for the registers not accessible via MDIO).
Are there any known issues or "pitfalls" with this PHY?
Thanks in advance,
LCE
PS: interesting that there is no "ETH" label... :D
Solved! Go to Solution.
2024-09-17 09:18 AM - edited 2024-09-17 04:33 PM
@LCE , @JR5 is referencing the hardware design guide from Microchip (DS00003048A).
@JR5, you'll notice if you look below the table of the image you shared, you aren't using the internal RMII feedback of the KSZ as suggested by @LCE in their suggestion:
a) use internal RMII clock
@LCE must be using mode 4 or 5:
---------------------
@LCE thanks for following up with this thread on your results and learnings. It's crazy that two other people are currently discussing this because I am just starting designing my own board. I am deciding between which mode to use for my board. I'm also trying to match that to the options shared in the STM32's datasheet (I am using STM32F407VG). The datasheet shares a couple options:
I was thinking of going with "mode 5" for the KSZ, because this is what is suggested in the KSZ's hardware design guide. For providing the clock for the STM and the KSZ, I see three potential good options:
There are other options, like going with "mode 4" and using an external 50Mhz source directly. I'm thinking of not doing this based on the suggestion in the KSZ hardware design guide, which says:
@LCE I'd be curious to hear what you've perhaps done, or if you have an opinion on options a-c from what you have tested.
2024-09-17 10:51 AM - edited 2024-09-17 02:08 PM
Looking around more, I think I'll move ahead with what is shown in Figure 99 (so option a from my previous post) of the ST datasheet. I'm pretty confused by Figure 98. because how I understand the STM32F4 is it doesn't have an option for an external 50Mhz Oscillator, but I could be misunderstanding how bypass mode works (maybe it needs 2x the clock?). EDIT: If you switch the HSE clock mode to Bypass in STMCubeMX, it then allows you to have the input frequency anywhere from 1-50MHz (which explains figure 98). I think I'm narrowing down on option b) or c), since both of these use an external clock source (don't have to mess with resonator desgn).
Looking online, I found this nice guide from Andy's Workshop that explains one of the main purposes of the Main Clock Output is to share the 25Mhz clock with an ethernet PHY, so this brings me to option c)
Still would love any input from you, @LCE, if you don't mind sharing any more lessons learned.
2024-09-17 11:20 PM
The main lessons learned:
1) as always, try to keep some ("strap") options open, e.g. at some pins place options for pull-up and pull-down resistors - if can afford it space-wise, better one too many (I had to fiddle the pull-down onto the board at P2LED1 to enable I2C)
2) make sure you have the option to use not only the MDIO, but also the I2C or SPI interface
3) do NOT feed REFCLKI from its own REFCLKO, but use the internal clock -> you must use I2C / SPI to set register 198d / bit 3
Again: with external feed the complete RMII was whacky with only 33R between REFCLKI / REFCLKO, it worked with 0R, but I don't want to rely on that, come on, only 33R and such a big impact? No thanks...
So I am using "mode 5", 25 MHz dedicated crystal for the KSZ at X1/2, RMII_REF_CLK output to STM32.