Initial OTG support for STM32H7 and some minor improvements arch/arm/src/stm32h7/stm32h7x3xx_rcc.c: add support for HSI48 clock configs/nucleo-f207zg: add support for USB and initialize CDCACM if configured configs/nucleo-h743zi: add support for USB and initialize CDCACM if configured drivers/usbdev/Kconfig: fix type for USBDEV_TRACE_INITIALIDSET configs/teensy-3.x/usbnsh/defconfig: update config according to change in USBDEV_TRACE_INITIALIDSET Approved-by: Gregory Nutt <gnutt@nuttx.org>
149 lines
5.5 KiB
C
149 lines
5.5 KiB
C
/****************************************************************************
|
|
* configs/nucleo-f207zg/src/nucleo-f207zg.h
|
|
*
|
|
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
|
* Author: Mateusz Szafoni <raiden00@railab.me>
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
*
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in
|
|
* the documentation and/or other materials provided with the
|
|
* distribution.
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
* used to endorse or promote products derived from this software
|
|
* without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
*
|
|
****************************************************************************/
|
|
|
|
#ifndef __CONFIGS_NUCLEO_F207ZG_SRC_NUCLEO_F207ZG_H
|
|
#define __CONFIGS_NUCLEO_F207ZG_SRC_NUCLEO_F207ZG_H
|
|
|
|
/****************************************************************************
|
|
* Included Files
|
|
****************************************************************************/
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
/****************************************************************************
|
|
* Pre-processor Definitions
|
|
****************************************************************************/
|
|
|
|
/* LED definitions **********************************************************/
|
|
/* LED
|
|
*
|
|
* The Nucleo-144 board has numerous LEDs but only three, LD1 a Green LED, LD2 a
|
|
* Blue LED and LD3 a Red LED, that can be controlled by software. The following
|
|
* definitions assume the default Solder Bridges are installed.
|
|
*/
|
|
|
|
#define GPIO_LD1 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_50MHz | GPIO_OUTPUT_CLEAR | \
|
|
GPIO_PORTB | GPIO_PIN0)
|
|
#define GPIO_LD2 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_50MHz | GPIO_OUTPUT_CLEAR | \
|
|
GPIO_PORTB | GPIO_PIN7)
|
|
#define GPIO_LD3 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_50MHz | GPIO_OUTPUT_CLEAR | \
|
|
GPIO_PORTB | GPIO_PIN14)
|
|
|
|
#define GPIO_LED_GREEN GPIO_LD1
|
|
#define GPIO_LED_BLUE GPIO_LD2
|
|
#define GPIO_LED_RED GPIO_LD3
|
|
|
|
#define LED_DRIVER_PATH "/dev/userleds"
|
|
|
|
/* Button definitions *******************************************************/
|
|
/* The Nucleo F207ZG supports two buttons; only one button is controllable
|
|
* by software:
|
|
*
|
|
* B1 USER: user button connected to the I/O PC13 of the STM32F207ZGT6.
|
|
* B2 RESET: push button connected to NRST is used to RESET the
|
|
* STM32F207ZGT6.
|
|
*
|
|
* NOTE that EXTI interrupts are configured.
|
|
*/
|
|
|
|
#define MIN_IRQBUTTON BUTTON_USER
|
|
#define MAX_IRQBUTTON BUTTON_USER
|
|
#define NUM_IRQBUTTONS 1
|
|
|
|
#define GPIO_BTN_USER (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTC|GPIO_PIN13)
|
|
|
|
/* USB OTG FS
|
|
*
|
|
* PA9 OTG_FS_VBUS VBUS sensing (also connected to the green LED)
|
|
* PG6 OTG_FS_PowerSwitchOn
|
|
* PG7 OTG_FS_Overcurrent
|
|
*/
|
|
|
|
#define GPIO_OTGFS_VBUS (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz| \
|
|
GPIO_OPENDRAIN|GPIO_PORTA|GPIO_PIN9)
|
|
|
|
#define GPIO_OTGFS_PWRON (GPIO_OUTPUT|GPIO_FLOAT|GPIO_SPEED_100MHz| \
|
|
GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN6)
|
|
|
|
#ifdef CONFIG_USBHOST
|
|
# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_EXTI|GPIO_FLOAT| \
|
|
GPIO_SPEED_100MHz|GPIO_PUSHPULL| \
|
|
GPIO_PORTG|GPIO_PIN7)
|
|
|
|
#else
|
|
# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz| \
|
|
GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN7)
|
|
#endif
|
|
|
|
/* PWM */
|
|
|
|
#define NUCLEOF207ZG_PWMTIMER 1
|
|
|
|
/****************************************************************************
|
|
* Public Data
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
* Public Function Prototypes
|
|
****************************************************************************/
|
|
|
|
int stm32_bringup(void);
|
|
|
|
/************************************************************************************
|
|
* Name: stm32_pwm_setup
|
|
*
|
|
* Description:
|
|
* Initialize PWM and register the PWM device.
|
|
*
|
|
************************************************************************************/
|
|
|
|
#ifdef CONFIG_PWM
|
|
int stm32_pwm_setup(void);
|
|
#endif
|
|
|
|
/************************************************************************************
|
|
* Name: stm32_adc_setup
|
|
*
|
|
* Description:
|
|
* Initialize ADC and register the ADC driver.
|
|
*
|
|
************************************************************************************/
|
|
|
|
#ifdef CONFIG_ADC
|
|
int stm32_adc_setup(void);
|
|
#endif
|
|
|
|
#endif /* __CONFIGS_NUCLEO_F207ZG_SRC_NUCLEO_F207ZG_H */
|