This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 8d406fee1ec27372f5fd5cb7db40d1d012a29a06
Author: raiden00pl <[email protected]>
AuthorDate: Tue Nov 17 14:41:06 2026 +0100

    boards/nucleo-n657x0-q: Add Ethernet support.
    
    Add the RMII pins of the LAN8742A PHY and a netnsh configuration.
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: raiden00pl <[email protected]>
---
 .../arm/stm32n6/boards/nucleo-n657x0-q/index.rst   | 12 +++--
 .../nucleo-n657x0-q/configs/netnsh/defconfig       | 59 ++++++++++++++++++++++
 boards/arm/stm32n6/nucleo-n657x0-q/include/board.h | 21 ++++++++
 3 files changed, 89 insertions(+), 3 deletions(-)

diff --git 
a/Documentation/platforms/arm/stm32n6/boards/nucleo-n657x0-q/index.rst 
b/Documentation/platforms/arm/stm32n6/boards/nucleo-n657x0-q/index.rst
index c67186783a4..5d4fd0abc38 100644
--- a/Documentation/platforms/arm/stm32n6/boards/nucleo-n657x0-q/index.rst
+++ b/Documentation/platforms/arm/stm32n6/boards/nucleo-n657x0-q/index.rst
@@ -40,9 +40,9 @@ Features
 
    This is the initial NuttX port for the STM32N6 family. The supported
    peripheral set is intentionally minimal: USART1 (the ST-LINK VCOM
-   console), GPIO, RCC, PWR, the SysTick-based timer, and the three
-   on-board user LEDs. Other on-chip peripherals and on-board features
-   (XSPI flash boot, networking, user button, USB, MIPI, NPU, etc) are
+   console), GPIO, RCC, PWR, the SysTick-based timer, the three
+   on-board user LEDs and Ethernet. Other on-chip peripherals and on-board 
features
+   (XSPI flash boot, user button, USB, MIPI, NPU, etc) are
    not yet wired up. The CPU is currently clocked at 200 MHz from PLL1.
    Raising it to the standard 600 / 800 MHz operating points is deferred
    to a follow-up change.
@@ -183,6 +183,12 @@ the three on-board LEDs are exposed at ``/dev/userleds`` 
and can be
 exercised from userspace.  Run ``leds`` from the NSH prompt to spawn
 the daemon that cycles through the LEDs.
 
+netnsh
+------
+
+NSH with Ethernet on the LAN8742A PHY (RMII): DHCP client, ``ping``,
+``telnetd`` and ``mdio``.
+
 License Exceptions
 ==================
 
diff --git a/boards/arm/stm32n6/nucleo-n657x0-q/configs/netnsh/defconfig 
b/boards/arm/stm32n6/nucleo-n657x0-q/configs/netnsh/defconfig
new file mode 100644
index 00000000000..b11bc61d8f6
--- /dev/null
+++ b/boards/arm/stm32n6/nucleo-n657x0-q/configs/netnsh/defconfig
@@ -0,0 +1,59 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed 
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that 
includes your
+# modifications.
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_BOARD="nucleo-n657x0-q"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_NUCLEO_N657X0_Q=y
+CONFIG_ARCH_CHIP="stm32n6"
+CONFIG_ARCH_CHIP_STM32=y
+CONFIG_ARCH_CHIP_STM32N657X0=y
+CONFIG_ARCH_CHIP_STM32N6=y
+CONFIG_ARCH_INTERRUPTSTACK=4096
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_BOARD_LOOPSPERMSEC=21000
+CONFIG_BUILTIN=y
+CONFIG_FS_PROCFS=y
+CONFIG_FS_PROCFS_REGISTER=y
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_NET=y
+CONFIG_NETDEV_PHY_IOCTL=y
+CONFIG_NETINIT_DHCPC=y
+CONFIG_NETUTILS_TELNETD=y
+CONFIG_NET_ETH_PKTSIZE=1514
+CONFIG_NET_ICMP_SOCKET=y
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_STATISTICS=y
+CONFIG_NET_TCP=y
+CONFIG_NET_UDP=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_READLINE=y
+CONFIG_RAM_SIZE=4193280
+CONFIG_RAM_START=0x34000400
+CONFIG_RAW_BINARY=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_HPWORK=y
+CONFIG_SCHED_LPWORK=y
+CONFIG_SCHED_WAITPID=y
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_PHYSR=31
+CONFIG_STM32_PHYSR_100FD=0x0018
+CONFIG_STM32_PHYSR_100HD=0x0008
+CONFIG_STM32_PHYSR_10FD=0x0014
+CONFIG_STM32_PHYSR_10HD=0x0004
+CONFIG_STM32_PHYSR_ALTCONFIG=y
+CONFIG_STM32_PHYSR_ALTMODE=0x001c
+CONFIG_STM32_USART1=y
+CONFIG_SYSTEM_DHCPC_RENEW=y
+CONFIG_SYSTEM_MDIO=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_SYSTEM_PING=y
+CONFIG_USART1_SERIAL_CONSOLE=y
diff --git a/boards/arm/stm32n6/nucleo-n657x0-q/include/board.h 
b/boards/arm/stm32n6/nucleo-n657x0-q/include/board.h
index 839305caee1..a48260e1c7a 100644
--- a/boards/arm/stm32n6/nucleo-n657x0-q/include/board.h
+++ b/boards/arm/stm32n6/nucleo-n657x0-q/include/board.h
@@ -196,6 +196,27 @@
 #define GPIO_USART1_TX   (GPIO_USART1_TX_3 | GPIO_SPEED_50MHZ)
 #define GPIO_USART1_RX   (GPIO_USART1_RX_3 | GPIO_SPEED_50MHZ)
 
+/* Ethernet GPIOs ***********************************************************/
+
+/* ETH1 RMII to the LAN8742A PHY at MDIO address 0: PG11 MDC, PF4 MDIO,
+ * PF7 REF_CLK, PF10 CRS_DV, PF14 PF15 RXD0-1, PF11 TX_EN, PF12 PF13
+ * TXD0-1.  The PHY drives the 50 MHz REF_CLK.
+ */
+
+#define GPIO_ETH_MDC            (GPIO_ETH_MDC_2 | GPIO_SPEED_100MHZ)
+#define GPIO_ETH_MDIO           (GPIO_ETH_MDIO_2 | GPIO_SPEED_100MHZ)
+#define GPIO_ETH_RMII_REF_CLK   (GPIO_ETH_RMII_REF_CLK_1 | GPIO_SPEED_100MHZ)
+#define GPIO_ETH_RMII_CRS_DV    (GPIO_ETH_RMII_CRS_DV_1 | GPIO_SPEED_100MHZ)
+#define GPIO_ETH_RMII_RXD0      (GPIO_ETH_RMII_RXD0_1 | GPIO_SPEED_100MHZ)
+#define GPIO_ETH_RMII_RXD1      (GPIO_ETH_RMII_RXD1_1 | GPIO_SPEED_100MHZ)
+#define GPIO_ETH_RMII_TX_EN     (GPIO_ETH_RMII_TX_EN_1 | GPIO_SPEED_100MHZ)
+#define GPIO_ETH_RMII_TXD0      (GPIO_ETH_RMII_TXD0_1 | GPIO_SPEED_100MHZ)
+#define GPIO_ETH_RMII_TXD1      (GPIO_ETH_RMII_TXD1_1 | GPIO_SPEED_100MHZ)
+
+/* The PTP clock is HCLK, as the Ethernet driver assumes */
+
+#define STM32_RCC_CCIPR2_ETH1PTPSEL RCC_CCIPR2_ETH1PTPSEL_HCLK
+
 /****************************************************************************
  * Public Data
  ****************************************************************************/

Reply via email to