boards: olimexino_stm32: Add USB support

Add USB support to OLIMEXINO-STM32 board

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
This commit is contained in:
Yannis Damigos 2017-10-28 14:48:48 +03:00 committed by Kumar Gala
commit 38d2567e08
12 changed files with 74 additions and 0 deletions

View file

@ -51,4 +51,10 @@
#define CONFIG_SPI_3_NAME ST_STM32_SPI_40003C00_LABEL
#define CONFIG_SPI_3_IRQ ST_STM32_SPI_40003C00_IRQ_0
#define CONFIG_USB_BASE_ADDRESS ST_STM32_USB_40005C00_BASE_ADDRESS
#define CONFIG_USB_IRQ ST_STM32_USB_40005C00_IRQ_USB
#define CONFIG_USB_IRQ_PRI ST_STM32_USB_40005C00_IRQ_USB_PRIORITY
#define CONFIG_USB_NUM_BIDIR_ENDPOINTS ST_STM32_USB_40005C00_NUM_BIDIR_ENDPOINTS
#define CONFIG_USB_RAM_SIZE ST_STM32_USB_40005C00_RAM_SIZE
/* End of SoC Level DTS fixup file */

View file

@ -27,6 +27,17 @@ uint32_t HAL_GetTick(void)
return k_uptime_get_32();
}
/**
* @brief This function provides minimum delay (in milliseconds) based
* on variable incremented.
* @param Delay: specifies the delay time length, in milliseconds.
* @return None
*/
void HAL_Delay(__IO uint32_t Delay)
{
k_sleep(Delay);
}
/**
* @brief Perform basic hardware initialization at boot.
*

View file

@ -7,3 +7,4 @@
config BOARD_OLIMEXINO_STM32
bool "OLIMEXINO-STM32 Development Board"
depends on SOC_STM32F103XB
select USB_DC_STM32_DISCONN_ENABLE if USB

View file

@ -44,4 +44,17 @@ config PWM_STM32_1
endif # PWM
if USB_DC_STM32_DISCONN_ENABLE
config USB_DC_STM32_DISCONN_GPIO_PORT_NAME
default "GPIOC"
config USB_DC_STM32_DISCONN_PIN
default 12
config USB_DC_STM32_DISCONN_PIN_LEVEL
default 0
endif # USB_DC_STM32_DISCONN_ENABLE
endif # BOARD_OLIMEXINO_STM32

View file

@ -45,6 +45,8 @@ hardware features:
+-----------+------------+----------------------+
| SPI | on-chip | spi |
+-----------+------------+----------------------+
| USB | on-chip | USB device |
+-----------+------------+----------------------+
Other hardware features are not supported by the Zephyr kernel.
@ -319,6 +321,15 @@ OLIMEXINO-STM32 board has up to 1 I2C. The default I2C mapping for Zephyr is:
- I2C2_SCL : PB10
- I2C2_SDA : PB11
USB
===
OLIMEXINO-STM32 board has a USB 2.0 full-speed device interface available
through its mini USB connector.
- USB_DM : PA11
- USB_DP : PA12
Jumpers
=======

View file

@ -74,3 +74,7 @@
&spi2 {
status = "ok";
};
&usb {
status = "ok";
};

View file

@ -10,3 +10,4 @@ supported:
- gpio
- i2c
- spi
- usb_device

View file

@ -45,6 +45,10 @@ static const struct pin_config pinconf[] = {
#ifdef CONFIG_PWM_STM32_1
{STM32_PIN_PA8, STM32F1_PINMUX_FUNC_PA8_PWM1_CH1},
#endif /* CONFIG_PWM_STM32_1 */
#ifdef USB_DC_STM32
{STM32_PIN_PA11, STM32F1_PINMUX_FUNC_PA11_USB_DM},
{STM32_PIN_PA12, STM32F1_PINMUX_FUNC_PA12_USB_DP},
#endif /* USB_DC_STM32 */
};
static int pinmux_stm32_init(struct device *port)

View file

@ -27,6 +27,9 @@
#define STM32F1_PINMUX_FUNC_PA7_SPI1_MASTER_MOSI STM32_PIN_SPI_MASTER_MOSI
#define STM32F1_PINMUX_FUNC_PA7_SPI1_SLAVE_MOSI STM32_PIN_SPI_SLAVE_MOSI
#define STM32F1_PINMUX_FUNC_PA11_USB_DM STM32_PIN_USB
#define STM32F1_PINMUX_FUNC_PA12_USB_DP STM32_PIN_USB
#define STM32F1_PINMUX_FUNC_PD5_USART2_TX STM32_PIN_USART_TX
#define STM32F1_PINMUX_FUNC_PD6_USART2_RX STM32_PIN_USART_RX

View file

@ -67,6 +67,14 @@
#define EP_TYPE_INTR PCD_EP_TYPE_INTR
#endif
#ifndef CONFIG_USB_NUM_IN_ENDPOINTS
#define CONFIG_USB_NUM_IN_ENDPOINTS 0
#endif /* CONFIG_USB_NUM_IN_ENDPOINTS */
#ifndef CONFIG_USB_NUM_OUT_ENDPOINTS
#define CONFIG_USB_NUM_OUT_ENDPOINTS 0
#endif /* CONFIG_USB_NUM_OUT_ENDPOINTS */
/* Total in ep number = bidirectional ep number + in ep number */
#define NUM_IN_EP (CONFIG_USB_NUM_BIDIR_ENDPOINTS + \
CONFIG_USB_NUM_IN_ENDPOINTS)

View file

@ -23,5 +23,16 @@
status = "disabled";
label = "SPI_2";
};
usb: usb@40005c00 {
compatible = "st,stm32-usb";
reg = <0x40005c00 0x400>;
interrupts = <20 0>;
interrupt-names = "usb";
num-bidir-endpoints = <8>;
ram-size = <512>;
status = "disabled";
label= "USB";
};
};
};

View file

@ -105,5 +105,6 @@
/* Hardware master NSS output enabled */
#define STM32_PIN_SPI_MASTER_NSS_OE (STM32_MODE_OUTPUT | STM32_CNF_ALT_FUNC | STM32_CNF_PUSH_PULL)
#define STM32_PIN_SPI_SLAVE_NSS (STM32_MODE_INPUT | STM32_CNF_IN_FLOAT)
#define STM32_PIN_USB (STM32_MODE_INPUT | STM32_CNF_IN_PUPD)
#endif /* _STM32_PINCTRLF1_H_ */