board: nucleo-h743zi USB Host fixups
This commit is contained in:
parent
dcb3fd11ea
commit
87d8e5dda2
@ -1,4 +1,4 @@
|
|||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/stm32f7/stm32_otg.h
|
* arch/arm/src/stm32f7/stm32_otg.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2013, 2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012-2013, 2016 Gregory Nutt. All rights reserved.
|
||||||
@ -31,14 +31,14 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __ARCH_ARM_SRC_STM32F7_STM32_OTG_H
|
#ifndef __ARCH_ARM_SRC_STM32F7_STM32_OTG_H
|
||||||
#define __ARCH_ARM_SRC_STM32F7_STM32_OTG_H
|
#define __ARCH_ARM_SRC_STM32F7_STM32_OTG_H
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
@ -49,11 +49,11 @@
|
|||||||
|
|
||||||
#if defined(CONFIG_STM32F7_OTGFS) || defined(CONFIG_STM32F7_OTGFSHS)
|
#if defined(CONFIG_STM32F7_OTGFS) || defined(CONFIG_STM32F7_OTGFSHS)
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Configuration ********************************************************************/
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_OTG_PRI
|
#ifndef CONFIG_OTG_PRI
|
||||||
# define CONFIG_OTG_PRI NVIC_SYSH_PRIORITY_DEFAULT
|
# define CONFIG_OTG_PRI NVIC_SYSH_PRIORITY_DEFAULT
|
||||||
@ -83,9 +83,9 @@
|
|||||||
# define STM32_OTG_FIFO_SIZE 4096
|
# define STM32_OTG_FIFO_SIZE 4096
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Function Prototypes
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
@ -105,9 +105,9 @@ extern "C"
|
|||||||
* Initialize USB host device controller hardware.
|
* Initialize USB host device controller hardware.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* controller -- If the device supports more than USB host controller, then
|
* controller -- If the device supports more than USB host controller,
|
||||||
* this identifies which controller is being initializeed. Normally, this
|
* then this identifies which controller is being initialized.
|
||||||
* is just zero.
|
* Normally, this is just zero.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* And instance of the USB host interface. The controlling task should
|
* And instance of the USB host interface. The controlling task should
|
||||||
@ -128,17 +128,18 @@ struct usbhost_connection_s;
|
|||||||
FAR struct usbhost_connection_s *stm32_otghost_initialize(int controller);
|
FAR struct usbhost_connection_s *stm32_otghost_initialize(int controller);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the OTG FS device driver
|
* Board logic must provide the stm32_usbsuspend logic if the OTG FS
|
||||||
* is used. This function is called whenever the USB enters or leaves suspend
|
* device driver is used. This function is called whenever the USB enters
|
||||||
* mode. This is an opportunity for the board logic to shutdown clocks, power,
|
* or leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* etc. while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
struct usbdev_s;
|
||||||
void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume);
|
void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/stm32h7/stm32_otg.h
|
* arch/arm/src/stm32h7/stm32_otg.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||||
@ -31,14 +31,14 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __ARCH_ARM_SRC_STM32H7_STM32_OTG_H
|
#ifndef __ARCH_ARM_SRC_STM32H7_STM32_OTG_H
|
||||||
#define __ARCH_ARM_SRC_STM32H7_STM32_OTG_H
|
#define __ARCH_ARM_SRC_STM32H7_STM32_OTG_H
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
@ -49,15 +49,16 @@
|
|||||||
|
|
||||||
#if defined(CONFIG_STM32H7_OTGFS) || defined(CONFIG_STM32H7_OTGHS)
|
#if defined(CONFIG_STM32H7_OTGFS) || defined(CONFIG_STM32H7_OTGHS)
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
/* Configuration ********************************************************************/
|
|
||||||
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_STM32H7_OTGFS)
|
#if defined(CONFIG_STM32H7_OTGFS)
|
||||||
# define STM32_IRQ_OTG STM32_IRQ_OTGFS
|
# define STM32_IRQ_OTG STM32_IRQ_OTGFS
|
||||||
# define STM32_OTG_BASE STM32_OTGFS_BASE /* OTG FS */
|
# define STM32_OTG_BASE STM32_OTGFS_BASE /* OTG FS */
|
||||||
# define STM32_NENDPOINTS (7) /* ep0-8 x 2 for IN and OUT but driver internals use byte to map + one bit for direction */
|
# define STM32_NENDPOINTS (7) /* ep0-8 x 2 for IN and OUT but driver internals use byte to map + one bit for direction */
|
||||||
# define GPIO_OTG_DM GPIO_OTGFS_DM
|
# define GPIO_OTG_DM GPIO_OTGFS_DM
|
||||||
# define GPIO_OTG_DP GPIO_OTGFS_DP
|
# define GPIO_OTG_DP GPIO_OTGFS_DP
|
||||||
# define GPIO_OTG_ID GPIO_OTGFS_ID
|
# define GPIO_OTG_ID GPIO_OTGFS_ID
|
||||||
@ -68,7 +69,7 @@
|
|||||||
#if defined(CONFIG_STM32H7_OTGHS)
|
#if defined(CONFIG_STM32H7_OTGHS)
|
||||||
# define STM32_IRQ_OTG STM32_IRQ_OTGHS
|
# define STM32_IRQ_OTG STM32_IRQ_OTGHS
|
||||||
# define STM32_OTG_BASE STM32_OTGHS_BASE /* OTG HS/FS */
|
# define STM32_OTG_BASE STM32_OTGHS_BASE /* OTG HS/FS */
|
||||||
# define STM32_NENDPOINTS (7) /* ep0-8 x 2 for IN and OUT but driver internals use byte to map + one bit for direction */
|
# define STM32_NENDPOINTS (7) /* ep0-8 x 2 for IN and OUT but driver internals use byte to map + one bit for direction */
|
||||||
# define GPIO_OTG_DM GPIO_OTGHS_DM
|
# define GPIO_OTG_DM GPIO_OTGHS_DM
|
||||||
# define GPIO_OTG_DP GPIO_OTGHS_DP
|
# define GPIO_OTG_DP GPIO_OTGHS_DP
|
||||||
# define GPIO_OTG_ID GPIO_OTGHS_ID
|
# define GPIO_OTG_ID GPIO_OTGHS_ID
|
||||||
@ -76,9 +77,9 @@
|
|||||||
# define STM32_OTG_FIFO_SIZE 4096
|
# define STM32_OTG_FIFO_SIZE 4096
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Function Prototypes
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
@ -99,8 +100,8 @@ extern "C"
|
|||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* controller -- If the device supports more than USB host controller, then
|
* controller -- If the device supports more than USB host controller, then
|
||||||
* this identifies which controller is being initializeed. Normally, this
|
* this identifies which controller is being initialized. Normally,
|
||||||
* is just zero.
|
* this is just zero.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* And instance of the USB host interface. The controlling task should
|
* And instance of the USB host interface. The controlling task should
|
||||||
@ -121,17 +122,18 @@ struct usbhost_connection_s;
|
|||||||
FAR struct usbhost_connection_s *stm32_otgfshost_initialize(int controller);
|
FAR struct usbhost_connection_s *stm32_otgfshost_initialize(int controller);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the OTG FS device driver
|
* Board logic must provide the stm32_usbsuspend logic if the OTG FS
|
||||||
* is used. This function is called whenever the USB enters or leaves suspend
|
* device driver is used. This function is called whenever the USB enters
|
||||||
* mode. This is an opportunity for the board logic to shutdown clocks, power,
|
* or leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* etc. while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
struct usbdev_s;
|
||||||
void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume);
|
void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
|
@ -73,9 +73,7 @@
|
|||||||
#include "stm32_otg.h"
|
#include "stm32_otg.h"
|
||||||
#include "stm32_usbhost.h"
|
#include "stm32_usbhost.h"
|
||||||
|
|
||||||
#if defined(CONFIG_USBHOST) && defined(CONFIG_STM32H7_OTGFS) && defined(CONFIG_EXPERIMENTAL)
|
#if defined(CONFIG_USBHOST) && defined(CONFIG_STM32H7_OTGFS)
|
||||||
|
|
||||||
#warning OTG host not tested for STM32H7!
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
|
@ -4,6 +4,23 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
if ARCH_BOARD_NUCLEO_H743ZI
|
if ARCH_BOARD_NUCLEO_H743ZI
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "STM Nucleo-144 Board Variant"
|
||||||
|
default STM_NUCLEO144_MB1364
|
||||||
|
|
||||||
|
config STM_NUCLEO144_MB1364
|
||||||
|
bool "Nucleo-H743ZI2 (MB1364)"
|
||||||
|
---help---
|
||||||
|
This is the current version of the Nucelo-144 for the H743ZI
|
||||||
|
|
||||||
|
config STM_NUCLEO144_MB1137
|
||||||
|
bool "Nucleo-H743ZI (MB1137)"
|
||||||
|
---help---
|
||||||
|
This is the origional version of the Nucelo-144 for the H743ZI
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
config STM32_ROMFS
|
config STM32_ROMFS
|
||||||
bool "Automount baked-in ROMFS image"
|
bool "Automount baked-in ROMFS image"
|
||||||
default n
|
default n
|
||||||
|
@ -17,11 +17,9 @@ CONFIG_ARMV7M_DCACHE=y
|
|||||||
CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
|
CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
|
||||||
CONFIG_ARMV7M_DTCM=y
|
CONFIG_ARMV7M_DTCM=y
|
||||||
CONFIG_ARMV7M_ICACHE=y
|
CONFIG_ARMV7M_ICACHE=y
|
||||||
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y
|
|
||||||
CONFIG_BOARD_LOOPSPERMSEC=43103
|
CONFIG_BOARD_LOOPSPERMSEC=43103
|
||||||
CONFIG_BUILTIN=y
|
CONFIG_BUILTIN=y
|
||||||
CONFIG_DEBUG_SYMBOLS=y
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
CONFIG_EXPERIMENTAL=y
|
|
||||||
CONFIG_FAT_LCNAMES=y
|
CONFIG_FAT_LCNAMES=y
|
||||||
CONFIG_FS_FAT=y
|
CONFIG_FS_FAT=y
|
||||||
CONFIG_FS_PROCFS=y
|
CONFIG_FS_PROCFS=y
|
||||||
@ -31,7 +29,7 @@ CONFIG_HAVE_CXXINITIALIZE=y
|
|||||||
CONFIG_INTELHEX_BINARY=y
|
CONFIG_INTELHEX_BINARY=y
|
||||||
CONFIG_LIBM=y
|
CONFIG_LIBM=y
|
||||||
CONFIG_MAX_TASKS=16
|
CONFIG_MAX_TASKS=16
|
||||||
CONFIG_MM_REGIONS=3
|
CONFIG_MM_REGIONS=4
|
||||||
CONFIG_NFILE_DESCRIPTORS=8
|
CONFIG_NFILE_DESCRIPTORS=8
|
||||||
CONFIG_NSH_ARCHINIT=y
|
CONFIG_NSH_ARCHINIT=y
|
||||||
CONFIG_NSH_BUILTIN_APPS=y
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
@ -52,6 +52,38 @@
|
|||||||
|
|
||||||
/* Configuration ************************************************************/
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
|
#define HAVE_PROC 1
|
||||||
|
#define HAVE_USBDEV 1
|
||||||
|
#define HAVE_USBHOST 1
|
||||||
|
#define HAVE_USBMONITOR 1
|
||||||
|
|
||||||
|
/* Can't support USB host or device features if USB OTG FS is not enabled */
|
||||||
|
|
||||||
|
#ifndef CONFIG_STM32H7_OTGFS
|
||||||
|
# undef HAVE_USBDEV
|
||||||
|
# undef HAVE_USBHOST
|
||||||
|
# undef HAVE_USBMONITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Can't support USB device monitor if USB device is not enabled */
|
||||||
|
|
||||||
|
#ifndef CONFIG_USBDEV
|
||||||
|
# undef HAVE_USBDEV
|
||||||
|
# undef HAVE_USBMONITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Can't support USB host is USB host is not enabled */
|
||||||
|
|
||||||
|
#ifndef CONFIG_USBHOST
|
||||||
|
# undef HAVE_USBHOST
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Check if we should enable the USB monitor before starting NSH */
|
||||||
|
|
||||||
|
#if !defined(CONFIG_USBDEV_TRACE) || !defined(CONFIG_USBMONITOR)
|
||||||
|
# undef HAVE_USBMONITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
/* procfs File System */
|
/* procfs File System */
|
||||||
|
|
||||||
#ifdef CONFIG_FS_PROCFS
|
#ifdef CONFIG_FS_PROCFS
|
||||||
@ -112,8 +144,13 @@
|
|||||||
#define GPIO_OTGFS_VBUS (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz| \
|
#define GPIO_OTGFS_VBUS (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz| \
|
||||||
GPIO_OPENDRAIN|GPIO_PORTA|GPIO_PIN9)
|
GPIO_OPENDRAIN|GPIO_PORTA|GPIO_PIN9)
|
||||||
|
|
||||||
#define GPIO_OTGFS_PWRON (GPIO_OUTPUT|GPIO_FLOAT|GPIO_SPEED_100MHz| \
|
#if defined(CONFIG_STM_NUCLEO144_MB1137)
|
||||||
|
# define GPIO_OTGFS_PWRON (GPIO_OUTPUT|GPIO_FLOAT|GPIO_SPEED_100MHz| \
|
||||||
GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN6)
|
GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN6)
|
||||||
|
#elif defined(CONFIG_STM_NUCLEO144_MB1364)
|
||||||
|
# define GPIO_OTGFS_PWRON (GPIO_OUTPUT|GPIO_FLOAT|GPIO_SPEED_100MHz| \
|
||||||
|
GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN10)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST
|
#ifdef CONFIG_USBHOST
|
||||||
# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_EXTI|GPIO_FLOAT| \
|
# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_EXTI|GPIO_FLOAT| \
|
||||||
@ -234,12 +271,26 @@ int stm32_gpio_initialize(void);
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* USB-related GPIO pins for the nucleo-144 board.
|
* USB-related GPIO pins for the NUCLEO-H743ZI board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32H7_OTGFS
|
#ifdef CONFIG_STM32H7_OTGFS
|
||||||
void stm32_usbinitialize(void);
|
void weak_function stm32_usbinitialize(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: stm32_usbhost_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality. This function will start a thread that will monitor for
|
||||||
|
* device connection/disconnection events.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(CONFIG_STM32H7_OTGFS) && defined(CONFIG_USBHOST)
|
||||||
|
int stm32_usbhost_initialize(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -44,16 +44,12 @@
|
|||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#define HAVE_USBHOST 1
|
|
||||||
#define CONFIG_USBMONITOR 1
|
|
||||||
|
|
||||||
#ifdef CONFIG_USBMONITOR
|
#ifdef CONFIG_USBMONITOR
|
||||||
#include <nuttx/usb/usbmonitor.h>
|
#include <nuttx/usb/usbmonitor.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGFS
|
#ifdef CONFIG_STM32H7_OTGFS
|
||||||
#include "stm32_usbhost.h"
|
#include "stm32_usbhost.h"
|
||||||
#include "stm32_usb.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "nucleo-h743zi.h"
|
#include "nucleo-h743zi.h"
|
||||||
|
@ -275,7 +275,13 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
|
|
||||||
/* Set the Power Switch by driving the active high enable pin */
|
/* Set the Power Switch by driving the active high enable pin */
|
||||||
|
|
||||||
|
#if defined(CONFIG_STM_NUCLEO144_MB1137)
|
||||||
stm32_gpiowrite(GPIO_OTGFS_PWRON, enable);
|
stm32_gpiowrite(GPIO_OTGFS_PWRON, enable);
|
||||||
|
#elif defined(CONFIG_STM_NUCLEO144_MB1364)
|
||||||
|
stm32_gpiowrite(GPIO_OTGFS_PWRON, !enable);
|
||||||
|
#else
|
||||||
|
# error "Non-supported board"
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user