cancel
Showing results for 
Search instead for 
Did you mean: 

Using STM32CubeMX to interface KSZ8863 with MII (STM32F207ZG)

ame
Associate II
Posted on December 15, 2017 at 17:21

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:

0690X00000609FiQAI.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

http://ww1.microchip.com/downloads/en/DeviceDoc/00002335B.pdf

.

Thanks

Alain

2 REPLIES 2
BPadm
Associate II

HI Alain,

Im using the same ICs and stuck in configuration.

Can you help if you have figured it out?

Noname1937
Associate III

@BPadm​  @ame​ 

I've got a KSZ8081 on my project and I can't even get it to ping (I'm in MII mode). Do you have any example projects that at least ping?

How did you configure the PHY if DP83843 is the only PHY available and the custom PHY does not fit with the datasheet?