Discussion:
freedom-k64f netnsh application
(too old to reply)
yahoo@charnell.plus.com [nuttx]
2018-01-31 19:15:50 UTC
Permalink
Hi,

I have a Kinetis FRDM-K64F board which I would like to develop software
on using the Nuttx RTOS.

I have programmed the board with the netnsh application but the nsh
shell reports that the eth0 link is down. I have enabled the network
debug features and think I may have found some bugs in the
nuttx/arc/arm/src/kinetis_enet.c file.

Is anyone using this board who I can discuss this with?

Kind regards

Stewart Charnell
Alan Carvalho de Assis acassis@gmail.com [nuttx]
2018-01-31 22:22:48 UTC
Permalink
Hi Stewart,

I think this board was contribute by David Sidrane, he is a little bit
away these days.

But I think you can post your findings here.

BR,

Alan
Post by ***@charnell.plus.com [nuttx]
Hi,
I have a Kinetis FRDM-K64F board which I would like to develop software
on using the Nuttx RTOS.
I have programmed the board with the netnsh application but the nsh
shell reports that the eth0 link is down. I have enabled the network
debug features and think I may have found some bugs in the
nuttx/arc/arm/src/kinetis_enet.c file.
Is anyone using this board who I can discuss this with?
Kind regards
Stewart Charnell
Alan Carvalho de Assis acassis@gmail.com [nuttx]
2018-02-01 13:49:36 UTC
Permalink
HI Stewart,

Yes, you are right, the schematic show it is KSZ8081:

https://www.nxp.com/downloads/en/schematics/FRDM-K64F_SCH.pdf

Greg needs to approve your patch first and apply it. So yes you can
submit the patch or send a PR to nuttx git repository.

BR,

Alan
Post by ***@charnell.plus.com [nuttx]
Hi Alan,
After enabling network debug features and looking at specs I think the
FRDM-K64F board uses the KSZ8081 PHY, so the BOARD_PHY_STATUS setting in
nuttx/arc/arm/src/kinetis_enet.c should be MII_KSZ8081_PHYCTRL1, as the
KSZ8081 PHY mode settings are in the PHYCTRL1 register. If I make this
change to kinetis_enet.c nsh reports the eth0 link up and I can ping the
FRDM-K64F board and it can ping other devices on the network.
I have generated a patch file, should I send it?
KR,
Stewart
yahoo@charnell.plus.com [nuttx]
2018-01-31 22:56:27 UTC
Permalink
Hi Alan,

I tried to post this reply directly on the Yahoo Nuttx Group but didn't
appear to work?

After enabling network bebug features, and looking through specs, it is
apparent that the FRDM-K64F board I have uses the KSZ8081 PHY. For the
KSZ8081 PHY the BOARD_PHY_STATUS setting in
nuttx/arc/arm/src/kinetis_enet.c should be MII_KSZ8081_PHYCTRL1, as the
KSZ8081 PHY mode settings are in the PHYCTRL1 register. If I make this,
and some other changes, to kinetis_enet.c nsh reports the eth0 link up
and I can ping the FRDM-K64F board and it can ping other devices on the
network.

I have attached a patch file of the changes I made, don't know if that
is appropriate as presume it needs someone else to review and verify?

KR

Stewart
yahoo@charnell.plus.com [nuttx]
2018-02-01 06:30:09 UTC
Permalink
Hi Alan,

Not sure my attachment worked so have added it again.

KR

Stewart
yahoo@charnell.plus.com [nuttx]
2018-02-01 07:14:26 UTC
Permalink
Very sorry for all the emails, getting used to the web interface.

I don't appear to be able to add attachments, these are the changes I made:

diff --git a/arch/arm/src/kinetis/kinetis_enet.c b/arch/arm/src/kinetis/kinetis_enet.c
index 4a7e1ba..07915d1 100644
--- a/arch/arm/src/kinetis/kinetis_enet.c
+++ b/arch/arm/src/kinetis/kinetis_enet.c
@@ -158,19 +158,21 @@
# define BOARD_PHYID1 MII_PHYID1_KSZ8041
# define BOARD_PHYID2 MII_PHYID2_KSZ8041
# define BOARD_PHY_STATUS MII_KSZ8041_PHYCTRL2
+# define BOARD_PHY_10BASET(s) (((s) & (1 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
+# define BOARD_PHY_100BASET(s) (((s) & (2 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
+# define BOARD_PHY_ISDUPLEX(s) (((s) & (4 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
#elif defined(CONFIG_ETH0_PHY_KSZ8081)
# define BOARD_PHY_NAME "KSZ8081"
# define BOARD_PHYID1 MII_PHYID1_KSZ8081
# define BOARD_PHYID2 MII_PHYID2_KSZ8081
-# define BOARD_PHY_STATUS MII_KSZ8081_PHYCTRL2
+# define BOARD_PHY_STATUS MII_KSZ8081_PHYCTRL1
+# define BOARD_PHY_10BASET(s) (((s) & (1 << MII_PHYCTRL1_MODE_SHIFT)) != 0)
+# define BOARD_PHY_100BASET(s) (((s) & (2 << MII_PHYCTRL1_MODE_SHIFT)) != 0)
+# define BOARD_PHY_ISDUPLEX(s) (((s) & (4 << MII_PHYCTRL1_MODE_SHIFT)) != 0)
#else
# error "Unrecognized or missing PHY selection"
#endif

-#define BOARD_PHY_10BASET(s) (((s) & (1 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
-#define BOARD_PHY_100BASET(s) (((s) & (2 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
-#define BOARD_PHY_ISDUPLEX(s) (((s) & (4 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
-
/* Estimate the MII_SPEED in order to get an MDC close to 2.5MHz,
based on the internal module (ENET) clock:
*

KR

Stewart
Sebastien Lorquet sebastien@lorquet.fr [nuttx]
2018-02-01 09:09:31 UTC
Permalink
Hello

ALL yahoo email systems have problems these days. I also experience these delays
in other groups.

Sebastien
Post by ***@charnell.plus.com [nuttx]
 
Very sorry for all the emails, getting used to the web interface.
diff --git a/arch/arm/src/kinetis/kinetis_enet.c
b/arch/arm/src/kinetis/kinetis_enet.c
index 4a7e1ba..07915d1 100644
--- a/arch/arm/src/kinetis/kinetis_enet.c
+++ b/arch/arm/src/kinetis/kinetis_enet.c
@@ -158,19 +158,21 @@
 #  define BOARD_PHYID1          MII_PHYID1_KSZ8041
 #  define BOARD_PHYID2          MII_PHYID2_KSZ8041
 #  define BOARD_PHY_STATUS      MII_KSZ8041_PHYCTRL2
+#  define BOARD_PHY_10BASET(s)  (((s) & (1 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
+#  define BOARD_PHY_100BASET(s) (((s) & (2 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
+#  define BOARD_PHY_ISDUPLEX(s) (((s) & (4 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
 #elif defined(CONFIG_ETH0_PHY_KSZ8081)
 #  define BOARD_PHY_NAME        "KSZ8081"
 #  define BOARD_PHYID1          MII_PHYID1_KSZ8081
 #  define BOARD_PHYID2          MII_PHYID2_KSZ8081
-#  define BOARD_PHY_STATUS      MII_KSZ8081_PHYCTRL2
+#  define BOARD_PHY_STATUS      MII_KSZ8081_PHYCTRL1
+#  define BOARD_PHY_10BASET(s)  (((s) & (1 << MII_PHYCTRL1_MODE_SHIFT)) != 0)
+#  define BOARD_PHY_100BASET(s) (((s) & (2 << MII_PHYCTRL1_MODE_SHIFT)) != 0)
+#  define BOARD_PHY_ISDUPLEX(s) (((s) & (4 << MII_PHYCTRL1_MODE_SHIFT)) != 0)
 #else
 #  error "Unrecognized or missing PHY selection"
 #endif
 
-#define BOARD_PHY_10BASET(s)  (((s) & (1 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
-#define BOARD_PHY_100BASET(s) (((s) & (2 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
-#define BOARD_PHY_ISDUPLEX(s) (((s) & (4 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
-
 /* Estimate the MII_SPEED in order to get an MDC close to 2.5MHz,
  *
KR
Stewart
Alan Carvalho de Assis acassis@gmail.com [nuttx]
2018-02-01 11:05:40 UTC
Permalink
Hi Stewart,

Your patch appears correct, it is isolating the code that was suppose
to work with KSZ8041 from your modification to KSZ8081.

+1

BR,

Alan
Post by ***@charnell.plus.com [nuttx]
Very sorry for all the emails, getting used to the web interface.
diff --git a/arch/arm/src/kinetis/kinetis_enet.c
b/arch/arm/src/kinetis/kinetis_enet.c
index 4a7e1ba..07915d1 100644
--- a/arch/arm/src/kinetis/kinetis_enet.c
+++ b/arch/arm/src/kinetis/kinetis_enet.c
@@ -158,19 +158,21 @@
# define BOARD_PHYID1 MII_PHYID1_KSZ8041
# define BOARD_PHYID2 MII_PHYID2_KSZ8041
# define BOARD_PHY_STATUS MII_KSZ8041_PHYCTRL2
+# define BOARD_PHY_10BASET(s) (((s) & (1 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
+# define BOARD_PHY_100BASET(s) (((s) & (2 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
+# define BOARD_PHY_ISDUPLEX(s) (((s) & (4 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
#elif defined(CONFIG_ETH0_PHY_KSZ8081)
# define BOARD_PHY_NAME "KSZ8081"
# define BOARD_PHYID1 MII_PHYID1_KSZ8081
# define BOARD_PHYID2 MII_PHYID2_KSZ8081
-# define BOARD_PHY_STATUS MII_KSZ8081_PHYCTRL2
+# define BOARD_PHY_STATUS MII_KSZ8081_PHYCTRL1
+# define BOARD_PHY_10BASET(s) (((s) & (1 << MII_PHYCTRL1_MODE_SHIFT)) != 0)
+# define BOARD_PHY_100BASET(s) (((s) & (2 << MII_PHYCTRL1_MODE_SHIFT)) != 0)
+# define BOARD_PHY_ISDUPLEX(s) (((s) & (4 << MII_PHYCTRL1_MODE_SHIFT)) != 0)
#else
# error "Unrecognized or missing PHY selection"
#endif
-#define BOARD_PHY_10BASET(s) (((s) & (1 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
-#define BOARD_PHY_100BASET(s) (((s) & (2 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
-#define BOARD_PHY_ISDUPLEX(s) (((s) & (4 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
-
/* Estimate the MII_SPEED in order to get an MDC close to 2.5MHz,
*
KR
Stewart
yahoo@charnell.plus.com [nuttx]
2018-02-01 21:25:32 UTC
Permalink
Hi Alan,

Thanks. Do I need to do anything special to submit the patch?

KR

Stewart
spudarnia@yahoo.com [nuttx]
2018-02-01 21:29:17 UTC
Permalink
That patch was committed several hours ago.

Loading...