Author Topic: Kinetis K60 Ethernet phy MDIO comm. problem  (Read 2528 times)

Offline Ray

  • Newbie
  • *
  • Posts: 17
    • View Profile
Kinetis K60 Ethernet phy MDIO comm. problem
« on: May 30, 2023, 08:08:57 PM »
Hi Mark,
As you know I have had moderate success interfacing a DP83848 phy into a uTasker ethernet based application despite the MDIO being inoperative.
As I debug this in the simulator, I can see when kinetis_ENET.h is called to initialize code, but I actually can't find where #include "../../Hardware/Kinetis/kinetis_ENET.h"  is added, so no preprocessor appear to be invoked from the settings in app_hw_kinetis.h, and all variables are flagged as error by the MSVC intellicode. 

If I add like this in the app_hw_kinetis.h
#include "../../Hardware/Kinetis/kinetis.h"                              // include the Kinetis processor header at this location
#include "../../Hardware/Kinetis/kinetis_ENET.h"                       // include the Kinetis processor header at this location

My preprocessor defines correctly highlight with intellicode, but I get hundreds of compiler errors.

Can you tell me where the kinetis_ENET.h is supposed to be #included?

Thanks
Ray


Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Kinetis K60 Ethernet phy MDIO comm. problem
« Reply #1 on: May 30, 2023, 10:25:20 PM »
Hi Ray

In kinetis.c

#if (defined ETH_INTERFACE && defined ETHERNET_AVAILABLE && !defined NO_INTERNAL_ETHERNET)
/* =================================================================== */
/*                          Ethernet Controller                        */
/* =================================================================== */
    #include "kinetis_ENET.h"                                            // include Ethernet controller hardware driver code
#endif


It is not possible to include it from a header file since it contains code and then the code would be included in multiple locations.

VS normally handles highlighting well. Try a clean/rebuild which may sort it out.

Regards

Mark

Offline Ray

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Kinetis K60 Ethernet phy MDIO comm. problem
« Reply #2 on: May 31, 2023, 03:05:07 AM »
Thanks Mark

It's strange how intellisense is spotty in my VS2022 for this file - but if I double click the kinetis_ENET.h in kinetis.c  the kinetis_ENET.h see's preprocessor info highlighted again.

Unfortunately, I'm still not getting anything but 0xffff when I query the phy registers on the command line. I know my MDIO lines are placed properly this time with a 1.5k p/u I think I need to very carefully attach some skywires to my previous MQX based design to see if MDIO is actually working on MQX code.

 

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Kinetis K60 Ethernet phy MDIO comm. problem
« Reply #3 on: May 31, 2023, 08:01:57 PM »
Hi Ray

don't forget that the PHY has an address that is set via straps. Make sure that its address matches PHY_ADDRESS.
Or you can try SCAN_PHY_ADD which will scan all possible addresses to see whether the ID can be read on one of them.

Good luck

Regards

Mark


Offline Ray

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Kinetis K60 Ethernet phy MDIO comm. problem
« Reply #4 on: May 31, 2023, 10:38:58 PM »
Hi Mark
I absolutely did not check that  :)   As I was reading thru the pdf manual it was mentioning the default phy address was 00001  4 weak pull downs, one weak pull up.  Yes, my PHY_ADDRESS was defined to 0.   setting to 1 and now I can read phy registers!!   

I've been waiting months to check that one off my list!

Thanks for the help!!

ray

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Kinetis K60 Ethernet phy MDIO comm. problem
« Reply #5 on: May 31, 2023, 10:41:46 PM »
Hi Ray

I am please that you managed to catch the issue.

Regards

Mark