boards: stm32f3_disco: Add USB support
Add USB support to STM32F3DISCOVERY board Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
This commit is contained in:
parent
38d2567e08
commit
80d69ea47f
7 changed files with 53 additions and 0 deletions
|
@ -53,4 +53,12 @@
|
||||||
#define FLASH_DEV_BASE_ADDRESS ST_STM32F3_FLASH_CONTROLLER_40022000_BASE_ADDRESS_0
|
#define FLASH_DEV_BASE_ADDRESS ST_STM32F3_FLASH_CONTROLLER_40022000_BASE_ADDRESS_0
|
||||||
#define FLASH_DEV_NAME ST_STM32F3_FLASH_CONTROLLER_40022000_LABEL
|
#define FLASH_DEV_NAME ST_STM32F3_FLASH_CONTROLLER_40022000_LABEL
|
||||||
|
|
||||||
|
#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_NUM_IN_ENDPOINTS ST_STM32_USB_40005C00_NUM_IN_ENDPOINTS
|
||||||
|
#define CONFIG_USB_NUM_OUT_ENDPOINTS ST_STM32_USB_40005C00_NUM_OUT_ENDPOINTS
|
||||||
|
#define CONFIG_USB_RAM_SIZE ST_STM32_USB_40005C00_RAM_SIZE
|
||||||
|
|
||||||
/* End of SoC Level DTS fixup file */
|
/* End of SoC Level DTS fixup file */
|
||||||
|
|
|
@ -27,6 +27,17 @@ uint32_t HAL_GetTick(void)
|
||||||
return k_uptime_get_32();
|
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.
|
* @brief Perform basic hardware initialization at boot.
|
||||||
*
|
*
|
||||||
|
|
|
@ -92,6 +92,8 @@ features:
|
||||||
+-----------+------------+-------------------------------------+
|
+-----------+------------+-------------------------------------+
|
||||||
| SPI | on-chip | spi |
|
| SPI | on-chip | spi |
|
||||||
+-----------+------------+-------------------------------------+
|
+-----------+------------+-------------------------------------+
|
||||||
|
| USB | on-chip | USB device |
|
||||||
|
+-----------+------------+-------------------------------------+
|
||||||
|
|
||||||
Other hardware features are not yet supported on Zephyr porting.
|
Other hardware features are not yet supported on Zephyr porting.
|
||||||
|
|
||||||
|
@ -126,6 +128,8 @@ Default Zephyr Peripheral Mapping:
|
||||||
- SPI2_SCK : PB13
|
- SPI2_SCK : PB13
|
||||||
- SPI2_MISO : PB14
|
- SPI2_MISO : PB14
|
||||||
- SPI2_MOSI : PB15
|
- SPI2_MOSI : PB15
|
||||||
|
- USB_DM : PA11
|
||||||
|
- USB_DP : PA12
|
||||||
- USER_PB : PA0
|
- USER_PB : PA0
|
||||||
- LD3 : PE9
|
- LD3 : PE9
|
||||||
- LD4 : PE8
|
- LD4 : PE8
|
||||||
|
@ -156,6 +160,11 @@ STM32F3DISCOVERY has up to 2 I2Cs. I2C1 is connected to the LSM303DLHC and is
|
||||||
an ultra-compact low-power system-in-package featuring a 3D digital linear
|
an ultra-compact low-power system-in-package featuring a 3D digital linear
|
||||||
acceleration sensor and a 3D digital magnetic sensor.
|
acceleration sensor and a 3D digital magnetic sensor.
|
||||||
|
|
||||||
|
USB
|
||||||
|
===
|
||||||
|
STM32F3DISCOVERY has a USB 2.0 full-speed device interface available through
|
||||||
|
its mini USB connector (USB USER).
|
||||||
|
|
||||||
Programming and Debugging
|
Programming and Debugging
|
||||||
*************************
|
*************************
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,10 @@ static const struct pin_config pinconf[] = {
|
||||||
{STM32_PIN_PB14, STM32F3_PINMUX_FUNC_PB14_SPI2_MISO},
|
{STM32_PIN_PB14, STM32F3_PINMUX_FUNC_PB14_SPI2_MISO},
|
||||||
{STM32_PIN_PB15, STM32F3_PINMUX_FUNC_PB15_SPI2_MOSI},
|
{STM32_PIN_PB15, STM32F3_PINMUX_FUNC_PB15_SPI2_MOSI},
|
||||||
#endif /* CONFIG_SPI_2 */
|
#endif /* CONFIG_SPI_2 */
|
||||||
|
#ifdef CONFIG_USB_DC_STM32
|
||||||
|
{STM32_PIN_PA11, STM32F3_PINMUX_FUNC_PA11_USB_DM},
|
||||||
|
{STM32_PIN_PA12, STM32F3_PINMUX_FUNC_PA12_USB_DP},
|
||||||
|
#endif /* CONFIG_USB_DC_STM */
|
||||||
};
|
};
|
||||||
|
|
||||||
static int pinmux_stm32_init(struct device *port)
|
static int pinmux_stm32_init(struct device *port)
|
||||||
|
|
|
@ -98,3 +98,7 @@
|
||||||
&spi2 {
|
&spi2 {
|
||||||
status = "ok";
|
status = "ok";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&usb {
|
||||||
|
status = "ok";
|
||||||
|
};
|
||||||
|
|
|
@ -76,6 +76,10 @@
|
||||||
(STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL)
|
(STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL)
|
||||||
#define STM32F3_PINMUX_FUNC_PA7_SPI1_MOSI \
|
#define STM32F3_PINMUX_FUNC_PA7_SPI1_MOSI \
|
||||||
(STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL)
|
(STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL)
|
||||||
|
#define STM32F3_PINMUX_FUNC_PA11_USB_DM \
|
||||||
|
(STM32_PINMUX_ALT_FUNC_14 | STM32_PUSHPULL_NOPULL)
|
||||||
|
#define STM32F3_PINMUX_FUNC_PA12_USB_DP \
|
||||||
|
(STM32_PINMUX_ALT_FUNC_14 | STM32_PUSHPULL_NOPULL)
|
||||||
|
|
||||||
#define STM32F3_PINMUX_FUNC_PB8_I2C1_SCL \
|
#define STM32F3_PINMUX_FUNC_PB8_I2C1_SCL \
|
||||||
(STM32_PINMUX_ALT_FUNC_4 | STM32_OPENDRAIN_PULLUP)
|
(STM32_PINMUX_ALT_FUNC_4 | STM32_OPENDRAIN_PULLUP)
|
||||||
|
|
|
@ -154,6 +154,19 @@
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
label = "SPI_1";
|
label = "SPI_1";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
usb: usb@40005c00 {
|
||||||
|
compatible = "st,stm32-usb";
|
||||||
|
reg = <0x40005c00 0x400>;
|
||||||
|
interrupts = <20 0>;
|
||||||
|
interrupt-names = "usb";
|
||||||
|
num-bidir-endpoints = <8>;
|
||||||
|
num-in-endpoints = <0>;
|
||||||
|
num-out-endpoints = <0>;
|
||||||
|
ram-size = <512>;
|
||||||
|
status = "disabled";
|
||||||
|
label= "USB";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue