STM32F207VGT with KSZ8463 3-port Switch
Hi!
I am trying to interface the STM32F207's Ethernet peripheral with a KSZ8463 3-port managed switch. I'm using SPI as the management interface, so the MIIM is not connected (MCO + MDIO). So far, I have been able to run the lwIP HTTP server example on the NUCLEO dev board, but have not been able to successfully run the example on our custom PCB, although I am able to read the registers of the switch via SPI and they all seem to be correct (link up, etc), and the switching on ports 1 and 2 works perfectly.
The clock is generated using a 25 MHz oscillator connected to X1 on the KSZ chip, which then generates a 50MHz output on its REFCLK_O pin, which is routed to the RMII_REF_CK pin on the STM32.
Obviously, the standard HAL ETH driver can't communicate with this using its standard PHYReadRegister/PHYWriteRegister commands, but it seems to be getting past the MAC reset, which I understand indicates that the 50MHz reference clock is good.
The code for the lwIP is pretty much the same as the default, except for changing some of the GPIO configuration since the pins are different:
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.Pin = GPIO_PIN_4 | GPIO_PIN_5;
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_InitStructure.Pin = GPIO_PIN_12 | GPIO_PIN_11 | GPIO_PIN_13;
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);I'm wondering if there is anything that we're missing in terms of connections or configuration, and would be super appreciative since this has caused much confusion.
How the pins are connected on the board is as follows:
STM32 -> Net name -> KSZ8463 pin
PA1 -> RMII_REF_CLK -> 32
PA7 -> RMII_CRS_DV -> 31
PC4 -> RMII_RXD0 -> 35
PC5 -> RMII_RXD1 -> 34
PB11 -> RMII_TX_EN -> 22
PB12 -> RMII_TXD0 -> 26
PB13 -> RMII_TXD1 -> 25
PA5 -> IRQ -> 43Thank you so much!
