AnsweredAssumed Answered

Using STM32CubeMX to interface KSZ8863 with MII (STM32F207ZG)

Question asked by Alain on Dec 15, 2017

Hello All,

I'm interfacing a KSZ8863 (Micrel, 3 Port Switch with 2 PHY and 3 MAC) over MII from a STM32F207ZG. I've used the STM32CubeMX to generate the code with the LwIP Stack and FreeRTOS.

So far, I've successfully communicated over SMI to read/write some registers (just debugging, if the bit-banging is working) and I've done some network stuff (Ping/TCP frame send) through port 1 and 2 (ping and tcp sent from computer on port 1 to a device on port 2).

But I'm not able to communicate correctly over the MII interface and send or receive ethernet packages. I think it has something to do with the Ethernet and LwIP configuration in the STM32CubeMX tool, specifically the register addresses. Here is my configuration so far:

 

ETH_Configuration_KSZ8863.PNG

 

I am absolutly not sure, wich settings I have to change (I couldn't find some parameter documentation about those STM32CubeMX settings).

I've changed:

  • the PHY to "user PHY"
  • the PHY name to "KSZ8863"
  • the PHY special control/status register Offset to "0x5", because I think, that this address is used to determine the speed and duplex mode
  • the PHY Speed mask to "0x0060" according to KSZ8863 datasheet
  • the PHY Duplex mask to "0x0140" according to KSZ8863 datasheet

 

My application is running in the following steps (main):

  1. HAL_Init, SystemCock_Config
  2. Starting up SMI communication to read/write registers (debug), including Reset over Pin and disabling the Bypass Mode (SMTXER3)
  3. Initialize FreeRTOS
  4. Start Kernel

 

Does anybody know how to configure those ethernet settings correctly? Or am I completely on the wrong way for interfacing the KSZ8863?

 

This is the Datasheet of the KSZ8863.

 

Thanks

 

Alain

Outcomes