mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
Add support for STM32F107 OTG FS (doesn't work) and update USB support for Viewtools STM32F107~
This commit is contained in:
@@ -6314,3 +6314,9 @@
|
|||||||
* stm32l15xxx_pinmap.h: Fix a typo in USB pin definitions (2013-12-25).
|
* stm32l15xxx_pinmap.h: Fix a typo in USB pin definitions (2013-12-25).
|
||||||
* configs/viewtools-stm32f107: Fix building of USB for F103 and F107.
|
* configs/viewtools-stm32f107: Fix building of USB for F103 and F107.
|
||||||
F103 has device only; F107 has OTG FS (2013-12-25).
|
F103 has device only; F107 has OTG FS (2013-12-25).
|
||||||
|
* arch/arm/src/stm32/stm32f10xxx_rcc.c and chip/stm32f10xxx_rcc.h: Add
|
||||||
|
clocking support for STM32F107 USB OTG FS (which does not work)
|
||||||
|
(2013-12-26).
|
||||||
|
* configs/viewtool-stm32f107: Updates to USB for F103 and USB OTG FS
|
||||||
|
for F107 (2013-12-16).
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,7 @@
|
|||||||
# define RCC_CFGR_PLLMUL_CLKx15 (13 << RCC_CFGR_PLLMUL_SHIFT) /* 1101: PLL input clock x 15 */
|
# define RCC_CFGR_PLLMUL_CLKx15 (13 << RCC_CFGR_PLLMUL_SHIFT) /* 1101: PLL input clock x 15 */
|
||||||
# define RCC_CFGR_PLLMUL_CLKx16 (14 << RCC_CFGR_PLLMUL_SHIFT) /* 111x: PLL input clock x 16 */
|
# define RCC_CFGR_PLLMUL_CLKx16 (14 << RCC_CFGR_PLLMUL_SHIFT) /* 111x: PLL input clock x 16 */
|
||||||
#ifndef CONFIG_STM32_VALUELINE
|
#ifndef CONFIG_STM32_VALUELINE
|
||||||
# define RCC_CFGR_USBPRE (1 << 22) /* Bit 22: USB prescaler */
|
# define RCC_CFGR_USBPRE (1 << 22) /* Bit 22: USB/OTG FS prescaler */
|
||||||
#endif
|
#endif
|
||||||
#define RCC_CFGR_MCO_SHIFT (24) /* Bits 27-24: Microcontroller Clock Output */
|
#define RCC_CFGR_MCO_SHIFT (24) /* Bits 27-24: Microcontroller Clock Output */
|
||||||
#define RCC_CFGR_MCO_MASK (15 << RCC_CFGR_MCO_SHIFT)
|
#define RCC_CFGR_MCO_MASK (15 << RCC_CFGR_MCO_SHIFT)
|
||||||
@@ -272,6 +272,7 @@
|
|||||||
# define RCC_AHBENR_SDIOEN (1 << 10) /* Bit 10: SDIO clock enable */
|
# define RCC_AHBENR_SDIOEN (1 << 10) /* Bit 10: SDIO clock enable */
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_STM32_CONNECTIVITYLINE
|
#ifdef CONFIG_STM32_CONNECTIVITYLINE
|
||||||
|
# define RCC_AHBENR_OTGFSEN (1 << 12) /* Bit 12: USB OTG FS clock enable */
|
||||||
# define RCC_AHBENR_ETHMACEN (1 << 14) /* Bit 14: Ethernet MAC clock enable */
|
# define RCC_AHBENR_ETHMACEN (1 << 14) /* Bit 14: Ethernet MAC clock enable */
|
||||||
# define RCC_AHBENR_ETHMACTXEN (1 << 15) /* Bit 15: Ethernet MAC TX clock enable */
|
# define RCC_AHBENR_ETHMACTXEN (1 << 15) /* Bit 15: Ethernet MAC TX clock enable */
|
||||||
# define RCC_AHBENR_ETHMACRXEN (1 << 16) /* Bit 16: Ethernet MAC RX clock enable */
|
# define RCC_AHBENR_ETHMACRXEN (1 << 16) /* Bit 16: Ethernet MAC RX clock enable */
|
||||||
|
|||||||
@@ -148,10 +148,18 @@ static inline void rcc_enableahb(void)
|
|||||||
regval |= RCC_AHBENR_SDIOEN;
|
regval |= RCC_AHBENR_SDIOEN;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_STM32_ETHMAC) && defined(CONFIG_STM32_CONNECTIVITYLINE)
|
#ifdef CONFIG_STM32_CONNECTIVITYLINE
|
||||||
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
|
/* USB OTG FS clock enable */
|
||||||
|
|
||||||
|
regval |= RCC_AHBENR_OTGFSEN;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_ETHMAC
|
||||||
/* Ethernet clock enable */
|
/* Ethernet clock enable */
|
||||||
|
|
||||||
regval |= (RCC_AHBENR_ETHMACEN | RCC_AHBENR_ETHMACTXEN | RCC_AHBENR_ETHMACRXEN);
|
regval |= (RCC_AHBENR_ETHMACEN | RCC_AHBENR_ETHMACTXEN | RCC_AHBENR_ETHMACRXEN);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
putreg32(regval, STM32_RCC_AHBENR); /* Enable peripherals */
|
putreg32(regval, STM32_RCC_AHBENR); /* Enable peripherals */
|
||||||
@@ -169,10 +177,13 @@ static inline void rcc_enableapb1(void)
|
|||||||
{
|
{
|
||||||
uint32_t regval;
|
uint32_t regval;
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_USB
|
#if defined(CONFIG_STM32_USB) || defined(CONFIG_STM32_OTGFS)
|
||||||
/* USB clock divider. This bit must be valid before enabling the USB
|
/* USB clock divider for USB FD device or USB OTG FS (OTGFS naming for this
|
||||||
* clock in the RCC_APB1ENR register. This bit can’t be reset if the USB
|
* bit is different, but it is the same bit.
|
||||||
* clock is enabled.
|
*
|
||||||
|
* This bit must be valid before enabling the either the USB clock in the
|
||||||
|
* RCC_APB1ENR register ro the OTG FS clock in the AHBENR reigser. This
|
||||||
|
* bit can’t be reset if the USB clock is enabled.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
regval = getreg32(STM32_RCC_CFGR);
|
regval = getreg32(STM32_RCC_CFGR);
|
||||||
|
|||||||
@@ -145,17 +145,95 @@ USB Interface
|
|||||||
7 Shield N/A N/A
|
7 Shield N/A N/A
|
||||||
8 Shield N/A N/A
|
8 Shield N/A N/A
|
||||||
9 Shield N/A N/A
|
9 Shield N/A N/A
|
||||||
PE11 USB_EN GPIO controlled soft pull-up
|
PE11 USB_EN GPIO controlled soft pull-up (if J51 closed)
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
1. GPIO_OTGFS_VBUS (F107) should not be configured. No VBUS sensing
|
1. GPIO_OTGFS_VBUS (F107) should not be configured. No VBUS sensing
|
||||||
2. GPIO_OTGFS_SOF (F107) is not used
|
2. GPIO_OTGFS_SOF (F107) is not used
|
||||||
|
3. The OTG FS module has is own, internal soft pull-up logic. J51 should
|
||||||
|
be open so that PE11 activity does effect USB.
|
||||||
|
|
||||||
Configuration
|
|
||||||
-------------
|
STM32F103 Configuration
|
||||||
To be provided. Some logic is in place, leveraged from other boards.
|
-----------------------
|
||||||
But this logic is not full implemented, not has it ever been built or\
|
|
||||||
tested.
|
System Type -> STM32 Peripheral Support
|
||||||
|
CONFIG_STM32_USB=y : Enable USB FS device
|
||||||
|
|
||||||
|
Device Drivers
|
||||||
|
CONFIG_USBDEV : USB device support
|
||||||
|
|
||||||
|
STATUS: All of the code is in place, but no testing has been performed.
|
||||||
|
|
||||||
|
STM32F107 Configuration
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
System Type -> STM32 Peripheral Support
|
||||||
|
CONFIG_STM32_OTGFS=y : Enable OTG FS
|
||||||
|
|
||||||
|
Device Drivers
|
||||||
|
CONFIG_USBDEV : USB device support
|
||||||
|
|
||||||
|
STATUS: All of the code is in place, but USB is not yet functional.
|
||||||
|
|
||||||
|
CDC/ACM Configuration
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
This will select the CDC/ACM serial device. Defaults for the other
|
||||||
|
options should be okay.
|
||||||
|
|
||||||
|
Device Drivers -> USB Device Driver Support
|
||||||
|
CONFIG_CDCACM=y : Enable the CDC/ACM device
|
||||||
|
|
||||||
|
The following setting enables an example that can can be used to control
|
||||||
|
the CDC/ACM device. It will add two new NSH commands:
|
||||||
|
|
||||||
|
a. sercon will connect the USB serial device (creating /dev/ttyACM0), and
|
||||||
|
b. serdis which will disconnect the USB serial device (destroying
|
||||||
|
/dev/ttyACM0).
|
||||||
|
|
||||||
|
Application Configuration -> Examples:
|
||||||
|
CONFIG_SYSTEM_CDCACM=y : Enable an CDC/ACM example
|
||||||
|
|
||||||
|
USB MSC Configuration
|
||||||
|
---------------------
|
||||||
|
[WARNING: This configuration has not yet been verified]
|
||||||
|
|
||||||
|
The Mass Storage Class (MSC) class driver can be selected in order to
|
||||||
|
export the microSD card to the host computer. MSC support is selected:
|
||||||
|
|
||||||
|
Device Drivers -> USB Device Driver Support
|
||||||
|
CONFIG_USBMSC=y : Enable the USB MSC class driver
|
||||||
|
CONFIG_USBMSC_EPBULKOUT=1 : Use EP1 for the BULK OUT endpoint
|
||||||
|
CONFIG_USBMSC_EPBULKIN=2 : Use EP2 for the BULK IN endpoint
|
||||||
|
|
||||||
|
The following setting enables an add-on that can can be used to control
|
||||||
|
the USB MSC device. It will add two new NSH commands:
|
||||||
|
|
||||||
|
a. msconn will connect the USB serial device and export the microSD
|
||||||
|
card to the host, and
|
||||||
|
b. msdis which will disconnect the USB serial device.
|
||||||
|
|
||||||
|
Application Configuration -> System Add-Ons:
|
||||||
|
CONFIG_SYSTEM_USBMSC=y : Enable the USBMSC add-on
|
||||||
|
CONFIG_SYSTEM_USBMSC_NLUNS=1 : One LUN
|
||||||
|
CONFIG_SYSTEM_USBMSC_DEVMINOR1=0 : Minor device zero
|
||||||
|
CONFIG_SYSTEM_USBMSC_DEVPATH1="/dev/mmcsd0"
|
||||||
|
: Use a single, LUN: The microSD
|
||||||
|
: block driver.
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
|
||||||
|
a. To prevent file system corruption, make sure that the microSD is un-
|
||||||
|
mounted *before* exporting the mass storage device to the host:
|
||||||
|
|
||||||
|
nsh> umount /mnt/sdcard
|
||||||
|
nsh> mscon
|
||||||
|
|
||||||
|
The microSD can be re-mounted after the mass storage class is disconnected:
|
||||||
|
|
||||||
|
nsh> msdis
|
||||||
|
nsh> mount -t vfat /dev/mtdblock0 /mnt/at25
|
||||||
|
|
||||||
microSD Card Interface
|
microSD Card Interface
|
||||||
======================
|
======================
|
||||||
@@ -183,9 +261,44 @@ microSD Card Interface
|
|||||||
cannot be used with the STM32F107 (unless the pin-out just happens to match up
|
cannot be used with the STM32F107 (unless the pin-out just happens to match up
|
||||||
with an SPI-based card interface???)
|
with an SPI-based card interface???)
|
||||||
|
|
||||||
Configuration
|
Configuration (STM32F103 only)
|
||||||
-------------
|
------------------------------
|
||||||
To be provided (for the STM32F103 only)
|
[WARNING: This configuration has not yet been verified]
|
||||||
|
|
||||||
|
Enabling SDIO-based MMC/SD support:
|
||||||
|
|
||||||
|
System Type->STM32 Peripheral Support
|
||||||
|
CONFIG_STM32_SDIO=y : Enable SDIO support
|
||||||
|
CONFIG_STM32_DMA2=y : DMA2 is needed by the driver
|
||||||
|
|
||||||
|
Device Drivers -> MMC/SD Driver Support
|
||||||
|
CONFIG_MMCSD=y : Enable MMC/SD support
|
||||||
|
CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance
|
||||||
|
CONFIG_MMCSD_HAVECARDDETECT=y : Supports card-detect PIOs
|
||||||
|
CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards
|
||||||
|
CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support
|
||||||
|
CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support
|
||||||
|
CONFIG_SDIO_DMA=y : Use SDIO DMA
|
||||||
|
CONFIG_SDIO_BLOCKSETUP=y : Needs to know block sizes
|
||||||
|
|
||||||
|
Library Routines
|
||||||
|
CONFIG_SCHED_WORKQUEUE=y : Driver needs work queue support
|
||||||
|
|
||||||
|
Application Configuration -> NSH Library
|
||||||
|
CONFIG_NSH_ARCHINIT=y : NSH board-initialization
|
||||||
|
|
||||||
|
Using the SD card
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
1) After booting, an SDIO device will appear as /dev/mmcsd0
|
||||||
|
|
||||||
|
2) If you try mounting an SD card with nothing in the slot, the
|
||||||
|
mount will fail:
|
||||||
|
|
||||||
|
nsh> mount -t vfat /dev/mmcsd1 /mnt/sd1
|
||||||
|
nsh: mount: mount failed: 19
|
||||||
|
|
||||||
|
STATUS: All of the code is in place, but no testing has been performed.
|
||||||
|
|
||||||
ViewTool DP83848 Ethernet Module
|
ViewTool DP83848 Ethernet Module
|
||||||
================================
|
================================
|
||||||
@@ -424,6 +537,9 @@ Configurations
|
|||||||
CONFIG_WINDOWS_CYGWIN=y : POSIX environment under windows
|
CONFIG_WINDOWS_CYGWIN=y : POSIX environment under windows
|
||||||
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
|
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
|
||||||
|
|
||||||
|
6. USB support is disabled by default. See the section above entitled,
|
||||||
|
"USB Interface"
|
||||||
|
|
||||||
nsh:
|
nsh:
|
||||||
|
|
||||||
This configuration directory provide the basic NuttShell (NSH).
|
This configuration directory provide the basic NuttShell (NSH).
|
||||||
@@ -453,6 +569,9 @@ Configurations
|
|||||||
CONFIG_WINDOWS_CYGWIN=y : POSIX environment under windows
|
CONFIG_WINDOWS_CYGWIN=y : POSIX environment under windows
|
||||||
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
|
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
|
||||||
|
|
||||||
|
4. USB support is disabled by default. See the section above entitled,
|
||||||
|
"USB Interface"
|
||||||
|
|
||||||
highpri:
|
highpri:
|
||||||
|
|
||||||
This configuration was used to verify the NuttX high priority, nested
|
This configuration was used to verify the NuttX high priority, nested
|
||||||
|
|||||||
@@ -102,7 +102,10 @@
|
|||||||
#define STM32_APB1_TIM6_CLKIN (STM32_PCLK1_FREQUENCY)
|
#define STM32_APB1_TIM6_CLKIN (STM32_PCLK1_FREQUENCY)
|
||||||
#define STM32_APB1_TIM7_CLKIN (STM32_PCLK1_FREQUENCY)
|
#define STM32_APB1_TIM7_CLKIN (STM32_PCLK1_FREQUENCY)
|
||||||
|
|
||||||
/* USB divider -- Divide PLL clock by 1.5 */
|
/* USB divider -- Divide PLL clock by 1.5
|
||||||
|
*
|
||||||
|
* USB clock = PLLOUT / 1.5 = 72MHz / 1.5 = 48MHz
|
||||||
|
*/
|
||||||
|
|
||||||
#define STM32_CFGR_USBPRE 0
|
#define STM32_CFGR_USBPRE 0
|
||||||
|
|
||||||
|
|||||||
@@ -106,9 +106,19 @@
|
|||||||
#define STM32_APB1_TIM6_CLKIN (STM32_PCLK1_FREQUENCY)
|
#define STM32_APB1_TIM6_CLKIN (STM32_PCLK1_FREQUENCY)
|
||||||
#define STM32_APB1_TIM7_CLKIN (STM32_PCLK1_FREQUENCY)
|
#define STM32_APB1_TIM7_CLKIN (STM32_PCLK1_FREQUENCY)
|
||||||
|
|
||||||
|
/* USB divider -- Divide PLL clock by 1.5
|
||||||
|
*
|
||||||
|
* USB clock = PLLOUT / 1.5 = 72MHz / 1.5 = 48MHz
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define STM32_CFGR_USBPRE 0
|
||||||
|
|
||||||
/* MCO output driven by PLL3. From above, we already have PLL3 input frequency as:
|
/* MCO output driven by PLL3. From above, we already have PLL3 input frequency as:
|
||||||
*
|
*
|
||||||
* STM32_PLL_PREDIV2 = 5, 25MHz / 5 => 5MHz
|
* STM32_PLL_PREDIV2 = 5, 25MHz / 5 => 5MHz
|
||||||
|
*
|
||||||
|
* NOTE: The Viewtool DP83848C module has its on, on-board 50MHz clock. No
|
||||||
|
* MCO clock need be provided on that board.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_STM32_MII_MCO) || defined(CONFIG_STM32_RMII_MCO)
|
#if defined(CONFIG_STM32_MII_MCO) || defined(CONFIG_STM32_RMII_MCO)
|
||||||
|
|||||||
@@ -46,6 +46,22 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-Processor Definitions
|
* Pre-Processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
|
/* Default MMC/SD SLOT number */
|
||||||
|
|
||||||
|
#ifdef HAVE_MMCSD
|
||||||
|
# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != VIEWTOOL_MMCSD_SLOTNO
|
||||||
|
# error "Only one MMC/SD slot: VIEWTOOL_MMCSD_SLOTNO"
|
||||||
|
# undef CONFIG_NSH_MMCSDSLOTNO
|
||||||
|
# define CONFIG_NSH_MMCSDSLOTNO VIEWTOOL_MMCSD_SLOTNO
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef CONFIG_NSH_MMCSDSLOTNO
|
||||||
|
# define CONFIG_NSH_MMCSDSLOTNO VIEWTOOL_MMCSD_SLOTNO
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Debug ********************************************************************/
|
/* Debug ********************************************************************/
|
||||||
|
|
||||||
@@ -77,5 +93,9 @@
|
|||||||
|
|
||||||
int nsh_archinitialize(void)
|
int nsh_archinitialize(void)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_MMCSD
|
||||||
|
return stm32_sdinitialize(CONFIG_NSH_MMCSDSLOTNO);
|
||||||
|
#else
|
||||||
return OK;
|
return OK;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,13 +54,6 @@
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBDEV
|
|
||||||
# define HAVE_USB 1
|
|
||||||
#else
|
|
||||||
# warning CONFIG_STM32_OTGFS (F107) or CONFIG_STM32_USB (F103) is enabled but CONFIG_USBDEV is not
|
|
||||||
# undef HAVE_USB
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
@@ -85,12 +78,33 @@
|
|||||||
void stm32_usbdev_initialize(void)
|
void stm32_usbdev_initialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
||||||
#warning REVISIT: The Viewtool board does, indeed, have a soft connect GPIO
|
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO and power enable GPIO */
|
#ifdef CONFIG_ARCH_CHIP_STM32F103VCT6
|
||||||
#warning REVISIT: GPIO setup
|
stm32_configgpio(GPIO_USB_PULLUP);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_usbpullup
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* If USB is supported and the board supports a pullup via GPIO (for USB software
|
||||||
|
* connect and disconnect), then the board software must provide stm32_pullup.
|
||||||
|
* See include/nuttx/usb/usbdev.h for additional description of this method.
|
||||||
|
* Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be
|
||||||
|
* NULL.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_CHIP_STM32F103VCT6
|
||||||
|
int stm32_usbpullup(FAR struct usbdev_s *dev, bool enable)
|
||||||
|
{
|
||||||
|
usbtrace(TRACE_DEVPULLUP, (uint16_t)enable);
|
||||||
|
stm32_gpiowrite(GPIO_USB_PULLUP, !enable);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
/* Configuration ************************************************************/
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_SYSTEM_USBMSC_DEVMINOR1
|
#ifndef CONFIG_SYSTEM_USBMSC_DEVMINOR1
|
||||||
# define CONFIG_SYSTEM_USBMSC_DEVMINOR1 0
|
# define CONFIG_SYSTEM_USBMSC_DEVMINOR1 VIEWTOOL_MMCSD_SLOTNO
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Debug ********************************************************************/
|
/* Debug ********************************************************************/
|
||||||
@@ -92,11 +92,11 @@
|
|||||||
int usbmsc_archinitialize(void)
|
int usbmsc_archinitialize(void)
|
||||||
{
|
{
|
||||||
/* If system/usbmsc is built as an NSH command, then SD slot should
|
/* If system/usbmsc is built as an NSH command, then SD slot should
|
||||||
* already have been initized in nsh_archinitialize() (see up_nsh.c). In
|
* already have been initialized in nsh_archinitialize() (see up_nsh.c). In
|
||||||
* this case, there is nothing further to be done here.
|
* this case, there is nothing further to be done here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONFIG_NSH_BUILTIN_APPS
|
#if defined(HAVE_MMCSD) && !defined(CONFIG_NSH_BUILTIN_APPS)
|
||||||
return stm32_sdinitialize(CONFIG_SYSTEM_USBMSC_DEVMINOR1);
|
return stm32_sdinitialize(CONFIG_SYSTEM_USBMSC_DEVMINOR1);
|
||||||
#else
|
#else
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
@@ -46,6 +46,51 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
/* Configuration **************************************************************/
|
||||||
|
/* Assume that everything is supported */
|
||||||
|
|
||||||
|
#define HAVE_USBDEV 1
|
||||||
|
#define HAVE_MMCSD 1
|
||||||
|
|
||||||
|
/* Handle chip differences */
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_CHIP_STM32F103VCT6)
|
||||||
|
# undef CONFIG_STM32_OTGFS
|
||||||
|
#elif defined(CONFIG_ARCH_CHIP_STM32F107VC)
|
||||||
|
# undef CONFIG_STM32_USB
|
||||||
|
# undef CONFIG_STM32_SDIO
|
||||||
|
#else
|
||||||
|
# error Unknown chip on Viewtool board
|
||||||
|
# undef HAVE_USBDEV
|
||||||
|
# undef HAVE_MMCSD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Check if USB is enabled */
|
||||||
|
|
||||||
|
#if !defined(CONFIG_STM32_OTGFS) && !defined(CONFIG_STM32_USB)
|
||||||
|
# undef HAVE_USBDEV
|
||||||
|
#elif !defined(CONFIG_USBDEV)
|
||||||
|
# warning CONFIG_STM32_OTGFS (F107) or CONFIG_STM32_USB (F103) is enabled but CONFIG_USBDEV is not
|
||||||
|
# undef HAVE_USB
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Can't support MMC/SD features if the SDIO peripheral is disabled */
|
||||||
|
|
||||||
|
#ifndef CONFIG_STM32_SDIO
|
||||||
|
# undef HAVE_MMCSD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Can't support MMC/SD features if mountpoints are disabled */
|
||||||
|
|
||||||
|
#ifdef CONFIG_DISABLE_MOUNTPOINT
|
||||||
|
# undef HAVE_MMCSD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Default MMC/SD slot number/device minor number */
|
||||||
|
|
||||||
|
#define VIEWTOOL_MMCSD_SLOTNO 0
|
||||||
|
|
||||||
|
/* GPIO Configuration *********************************************************/
|
||||||
/* LEDs
|
/* LEDs
|
||||||
*
|
*
|
||||||
* There are four LEDs on the ViewTool STM32F103/F107 board that can be controlled
|
* There are four LEDs on the ViewTool STM32F103/F107 board that can be controlled
|
||||||
@@ -114,7 +159,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_CHIP_STM32F103VCT6
|
#ifdef CONFIG_ARCH_CHIP_STM32F103VCT6
|
||||||
# define GPIO_SD_CD (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_EXTI|GPIO_PORTA|GPIO_PIN8)
|
# define GPIO_SD_CD (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_EXTI|GPIO_PORTA|GPIO_PIN8)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* USB
|
/* USB
|
||||||
@@ -137,13 +182,20 @@
|
|||||||
* 7 Shield N/A N/A
|
* 7 Shield N/A N/A
|
||||||
* 8 Shield N/A N/A
|
* 8 Shield N/A N/A
|
||||||
* 9 Shield N/A N/A
|
* 9 Shield N/A N/A
|
||||||
* PE11 USB_EN GPIO controlled soft pull-up
|
* PE11 USB_EN GPIO controlled soft pull-up (if J51 closed)
|
||||||
*
|
*
|
||||||
* NOTES:
|
* NOTES:
|
||||||
* 1. GPIO_OTGFS_VBUS (F107) should not be configured. No VBUS sensing
|
* 1. GPIO_OTGFS_VBUS (F107) should not be configured. No VBUS sensing
|
||||||
* 2. GPIO_OTGFS_SOF (F107) is not used
|
* 2. GPIO_OTGFS_SOF (F107) is not used
|
||||||
|
* 3. The OTG FS module has is own, internal soft pull-up logic. J51 should
|
||||||
|
* be open so that PE11 activity does effect USB.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_CHIP_STM32F103VCT6
|
||||||
|
# define GPIO_USB_PULLUP (GPIO_OUTPUT|GPIO_CNF_OUTOD|GPIO_MODE_50MHz|\
|
||||||
|
GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN11)
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user