From 21782603b3616c56c84e37894ac44ecebd553cad Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Thu, 8 Aug 2019 17:38:56 -0700 Subject: [PATCH] px4_fmu-v5x: add networking * fixed dropped CONFIG_LIBC_FLOATINGPOINT=y * fix RMII TX pinning * update platforms/nuttx/NuttX/nuttx w/ f7 eth --- .../px4/fmu-v5x/nuttx-config/include/board.h | 24 ++++++++++++ boards/px4/fmu-v5x/nuttx-config/nsh/defconfig | 38 +++++++++++++++++-- boards/px4/fmu-v5x/src/board_config.h | 1 + boards/px4/fmu-v5x/src/init.c | 2 + platforms/nuttx/NuttX/nuttx | 2 +- 5 files changed, 62 insertions(+), 5 deletions(-) diff --git a/boards/px4/fmu-v5x/nuttx-config/include/board.h b/boards/px4/fmu-v5x/nuttx-config/include/board.h index 21c382b7ba..ac02f6fe6a 100644 --- a/boards/px4/fmu-v5x/nuttx-config/include/board.h +++ b/boards/px4/fmu-v5x/nuttx-config/include/board.h @@ -460,6 +460,30 @@ #define GPIO_SDMMC2_D2 GPIO_SDMMC2_D2_2 #define GPIO_SDMMC2_D3 GPIO_SDMMC2_D3_2 +/* The STM32 F7 connects to a TI DP83848TSQ/NOPB + * using RMII + * + * STM32 F7 BOARD DP83848TSQ/NOPB + * GPIO SIGNAL PIN NAME + * -------- ------------ ------------- + * PA7 ETH_CRS_DV CRS_DV + * PC1 ETH_MDC MDC + * PA2 ETH_MDIO MDIO + * PA1 ETH_REF_CL X1 + * PC4 ETH_RXD0 RX_D0 + * PC5 ETH_RXD1 RX_D1 + * PB11 ETH_TX_EN TX_EN + * PG13 ETH_TXD0 TX_D0 + * PB13 ETH_TXD1 TX_D1 + * + * The PHY address is 1, since COL/PHYAD0 features a pull up. + */ + +#define GPIO_ETH_RMII_TX_EN GPIO_ETH_RMII_TX_EN_1 +#define GPIO_ETH_RMII_TXD0 GPIO_ETH_RMII_TXD0_2 +#define GPIO_ETH_RMII_TXD1 GPIO_ETH_RMII_TXD1_1 + + /* USB * * OTG_FS_DM PA11 diff --git a/boards/px4/fmu-v5x/nuttx-config/nsh/defconfig b/boards/px4/fmu-v5x/nuttx-config/nsh/defconfig index 88a2615c32..b4941f2ec4 100644 --- a/boards/px4/fmu-v5x/nuttx-config/nsh/defconfig +++ b/boards/px4/fmu-v5x/nuttx-config/nsh/defconfig @@ -13,9 +13,9 @@ # CONFIG_MMCSD_SPI is not set # CONFIG_NSH_DISABLEBG is not set # CONFIG_NSH_DISABLESCRIPT is not set +# CONFIG_NSH_DISABLE_ARP is not set # CONFIG_NSH_DISABLE_DF is not set # CONFIG_NSH_DISABLE_EXEC is not set -# CONFIG_NSH_DISABLE_EXIT is not set # CONFIG_NSH_DISABLE_GET is not set # CONFIG_NSH_DISABLE_ITEF is not set # CONFIG_NSH_DISABLE_LOOPS is not set @@ -56,6 +56,7 @@ CONFIG_DEFAULT_SMALL=y CONFIG_DEV_FIFO_SIZE=0 CONFIG_DEV_PIPE_MAXSIZE=1024 CONFIG_DEV_PIPE_SIZE=70 +CONFIG_ETH0_PHY_DP83848C=y CONFIG_FAT_DMAMEMORY=y CONFIG_FAT_LCNAMES=y CONFIG_FAT_LFN=y @@ -81,6 +82,8 @@ CONFIG_I2C=y CONFIG_I2C_RESET=y CONFIG_IDLETHREAD_STACKSIZE=750 CONFIG_LIBC_FLOATINGPOINT=y +CONFIG_IOB_NBUFFERS=24 +CONFIG_IOB_THROTTLE=0 CONFIG_LIBC_LONG_LONG=y CONFIG_LIBC_STRERROR=y CONFIG_MAX_TASKS=64 @@ -97,6 +100,24 @@ CONFIG_MTD_BYTE_WRITE=y CONFIG_MTD_PARTITION=y CONFIG_MTD_RAMTRON=y CONFIG_NFILE_DESCRIPTORS=20 +CONFIG_NET=y +CONFIG_NETDB_DNSCLIENT=y +CONFIG_NETDB_DNSCLIENT_ENTRIES=8 +CONFIG_NETDB_DNSSERVER_NOADDR=y +CONFIG_NETDEV_PHY_IOCTL=y +CONFIG_NETUTILS_TELNETD=y +CONFIG_NET_ARP_IPIN=y +CONFIG_NET_ARP_SEND=y +CONFIG_NET_BROADCAST=y +CONFIG_NET_ICMP=y +CONFIG_NET_ICMP_SOCKET=y +CONFIG_NET_SOCKOPTS=y +CONFIG_NET_SOLINGER=y +CONFIG_NET_TCP=y +CONFIG_NET_TCPBACKLOG=y +CONFIG_NET_TCP_WRITE_BUFFERS=y +CONFIG_NET_UDP=y +CONFIG_NET_UDP_CHECKSUMS=y CONFIG_NFILE_STREAMS=8 CONFIG_NSH_ARCHINIT=y CONFIG_NSH_ARCHROMFS=y @@ -104,18 +125,20 @@ CONFIG_NSH_ARGCAT=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_CMDPARMS=y CONFIG_NSH_CROMFSETC=y -CONFIG_NSH_DISABLE_IFCONFIG=y -CONFIG_NSH_DISABLE_IFUPDOWN=y CONFIG_NSH_DISABLE_MB=y CONFIG_NSH_DISABLE_MH=y -CONFIG_NSH_DISABLE_TELNETD=y +CONFIG_NSH_DRIPADDR=0XC0A800FE +CONFIG_NSH_IPADDR=0XC0A8007B CONFIG_NSH_LINELEN=128 CONFIG_NSH_MAXARGUMENTS=12 CONFIG_NSH_NESTDEPTH=8 +CONFIG_NSH_NOMAC=y CONFIG_NSH_QUOTE=y CONFIG_NSH_ROMFSETC=y CONFIG_NSH_ROMFSSECTSIZE=128 CONFIG_NSH_STRERROR=y +CONFIG_NSH_TELNET=y +CONFIG_NSH_TELNET_LOGIN=y CONFIG_NSH_VARS=y CONFIG_NXFONTS_DISABLE_16BPP=y CONFIG_NXFONTS_DISABLE_1BPP=y @@ -168,6 +191,7 @@ CONFIG_STM32F7_BKPSRAM=y CONFIG_STM32F7_DMA1=y CONFIG_STM32F7_DMA2=y CONFIG_STM32F7_DMACAPABLE=y +CONFIG_STM32F7_ETHMAC=y CONFIG_STM32F7_FLOWCONTROL_BROKEN=y CONFIG_STM32F7_I2C1=y CONFIG_STM32F7_I2C2=y @@ -176,6 +200,11 @@ CONFIG_STM32F7_I2C4=y CONFIG_STM32F7_I2C_DYNTIMEO=y CONFIG_STM32F7_I2C_DYNTIMEO_STARTSTOP=10 CONFIG_STM32F7_OTGFS=y +CONFIG_STM32F7_PHYSR=16 +CONFIG_STM32F7_PHYSR_100MBPS=0x0 +CONFIG_STM32F7_PHYSR_FULLDUPLEX=0x01 +CONFIG_STM32F7_PHYSR_MODE=0x04 +CONFIG_STM32F7_PHYSR_SPEED=0x2 CONFIG_STM32F7_PWR=y CONFIG_STM32F7_RTC=y CONFIG_STM32F7_RTC_HSECLOCK=y @@ -210,6 +239,7 @@ CONFIG_STM32F7_USART_SWAP=y CONFIG_STM32F7_WWDG=y CONFIG_SYSTEM_CDCACM=y CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_PING=y CONFIG_TASK_NAME_SIZE=24 CONFIG_TIME_EXTENDED=y CONFIG_UART4_BAUD=57600 diff --git a/boards/px4/fmu-v5x/src/board_config.h b/boards/px4/fmu-v5x/src/board_config.h index 7a0f0c9867..030bca52c0 100644 --- a/boards/px4/fmu-v5x/src/board_config.h +++ b/boards/px4/fmu-v5x/src/board_config.h @@ -495,6 +495,7 @@ #define VDD_3V3_SPEKTRUM_POWER_EN(on_true) px4_arch_gpiowrite(GPIO_VDD_3V3_SPEKTRUM_POWER_EN, (on_true)) #define READ_VDD_3V3_SPEKTRUM_POWER_EN() px4_arch_gpioread(GPIO_VDD_3V3_SPEKTRUM_POWER_EN) #define VDD_3V3_SD_CARD_EN(on_true) px4_arch_gpiowrite(GPIO_VDD_3V3_SD_CARD_EN, (on_true)) +#define VDD_3V3_ETH_POWER_EN(on_true) px4_arch_gpiowrite(GPIO_ETH_POWER_EN, (on_true)) /* Tone alarm output */ diff --git a/boards/px4/fmu-v5x/src/init.c b/boards/px4/fmu-v5x/src/init.c index 3122d0d4c1..83f76d1945 100644 --- a/boards/px4/fmu-v5x/src/init.c +++ b/boards/px4/fmu-v5x/src/init.c @@ -182,6 +182,8 @@ stm32_boardinitialize(void) stm32_usbinitialize(); + VDD_3V3_ETH_POWER_EN(true); + } /**************************************************************************** diff --git a/platforms/nuttx/NuttX/nuttx b/platforms/nuttx/NuttX/nuttx index 14f4dc735a..d8da511082 160000 --- a/platforms/nuttx/NuttX/nuttx +++ b/platforms/nuttx/NuttX/nuttx @@ -1 +1 @@ -Subproject commit 14f4dc735a6f092b7acbf5861c0b9f1ed5e19216 +Subproject commit d8da511082646d83a54c6905daca13f0a1a609f0