• AVR Freaks

Harmony TCP/IP Stack

Author
morgan1361
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/03/22 07:28:09
  • Location: 0
  • Status: offline
2019/05/14 13:02:36 (permalink)
0

Harmony TCP/IP Stack

Hello all,
 
I have a project that requires using the KSZ9477S with a PIC32MZ.  I have everything functioning using MIIM and hardware configuration straps.  The problem is that the SGMII port (port 7) will not function without some register configuration (apparently this is a silicon issue).  These registers are also not configurable via the MIIM interface, only I2C or SPI.  So I have a redone the board to accommodate the I2C and removed the MIIM.  Now the harmony TCP/IP stack fails to initialize.  I have stepped through the stack line by line and it just remains in a "BUSY" status.  Is it possible to use this stack without an MIIM interface?  Yes, I removed the "USE_MIIM" define from sys_config.h.  I would really like to avoid having to "spoof" the stack into thinking everything is OK, as this creates a whole mess of other issues with future projects.  Any thoughts or ideas on whether this is possible or if I have to use a different Ethernet stack?  Thanks in advance.
#1
rainad
Moderator
  • Total Posts : 1150
  • Reward points : 0
  • Joined: 2009/05/01 13:39:25
  • Location: 0
  • Status: online
Re: Harmony TCP/IP Stack 2019/05/15 06:51:26 (permalink)
0
The TCP/IP stack needs to initialize the PHY. For this it uses the MIIM driver.
By default this driver uses the MIIM interface, that's part of the ETH controller.
If your PHY doesn't work/have the standard MIIM/SMI interface, you need to create a version of the MIIM driver that does that:
- the MIIM driver is a virtual driver, so you can replace it with anything that implements those publicly exposed functions.
- If the PHY is configured OK as it is (power on configuration), then simply mimic a MIIM driver that returns success without doing actually anything.
- If you really need to configure the PHY, then implement the MIIM driver functionality using the I2C/SPI interface.
As mentioned, the stack won't know what  the MIIM driver does internally, it just expects an object having the MIIM API.
 
#2
morgan1361
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/03/22 07:28:09
  • Location: 0
  • Status: offline
Re: Harmony TCP/IP Stack 2019/05/15 08:39:26 (permalink)
0
Rainad,
 
I was afraid of that.  So several questions then. 
 
 
Does anything need to be done to the PHY driver file that I created for the KSZ9477 or does modifying the MIIM driver cover that as well? 
 
Any ideas whether or not Microchip has future plans on revising this issue?   Using MIIM is fine and kind of the standard for smaller port count switches, but it is not uncommon for higher port count switches (i.e. 5+ ports) or ones that support SGMII (e.g. SFP's) to have registers not accessible via MIIM.  Microchip makes many of these switches, yet the only code examples they give are for embedded linux on an MPU (using a different TCP/IP stack).  I guess because this is because Harmony doesn't natively support them. 
 
Why does this define exist then "DRV_ETHPHY_USE_DRV_MIIM"?  What does it do?
 
Thank you again for your assistance
#3
rainad
Moderator
  • Total Posts : 1150
  • Reward points : 0
  • Joined: 2009/05/01 13:39:25
  • Location: 0
  • Status: online
Re: Harmony TCP/IP Stack 2019/05/15 11:01:57 (permalink)
0
I'll try few answers.
 
morgan1361
Does anything need to be done to the PHY driver file that I created for the KSZ9477 or does modifying the MIIM driver cover that as well? 

The MIIM driver is just a communication channel to the PHY. It doesn't do anything by itself, other than allowing you to read/write registers on the PHY. What exactly registers you need to set up, is different from PHY to PHY, or switch in your case.
But take a look at the switches that are already supported, to see how they need to be programmed: KSZ8863, for example.
 
morgan1361
Any ideas whether or not Microchip has future plans on revising this issue? 

 
The problem, as you noted, is that these switches are normally used on higher performance platforms: MPUs and such, usually running Linux.
We've just started to add Harmony TCP/IP support for some of the MPUs. So the answer to your question is yes. But I cannot  promise any deadline for it now.
 
morgan1361
 Why does this define exist then "DRV_ETHPHY_USE_DRV_MIIM"?  What does it do?

Initially the TCP/IP stack (actually the MAC driver) was talking to the PHY using directly the MIIM interface.
This was replaced with the MIIM driver, to allow support for other interfaces: I2C, SPI, etc.
This is the default setting right now and most of the supported PHY's won't even work without the MIIM driver being present. This symbol "DRV_ETHPHY_USE_DRV_MIIM" will be removed from the code/configuration.
 
#4
morgan1361
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/03/22 07:28:09
  • Location: 0
  • Status: offline
Re: Harmony TCP/IP Stack 2019/05/15 13:06:55 (permalink)
0
Rainad,
 
Thank you very much for your prompt and informed responses.  I will see if I can beat the MIIM driver into submission. :)
#5
Jump to:
© 2019 APG vNext Commercial Version 4.5