From f1341dad9caad626c73caf4694e3cc42c1f350d2 Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Thu, 2 Mar 2017 09:36:05 -0600 Subject: [PATCH] Add support to USB Device on STM32F103-Minimum board --- configs/stm32f103-minimum/README.txt | 44 ++++++++++++++++++++ configs/stm32f103-minimum/src/Makefile | 4 ++ configs/stm32f103-minimum/src/stm32_usbdev.c | 4 +- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/configs/stm32f103-minimum/README.txt b/configs/stm32f103-minimum/README.txt index 6b2db76939..82f9f33ce8 100644 --- a/configs/stm32f103-minimum/README.txt +++ b/configs/stm32f103-minimum/README.txt @@ -13,6 +13,8 @@ Contents - Timer Inputs/Outputs - Using 128KiB of Flash instead of 64KiB - Quadrature Encoder + - SDCard support + - USB Console support - STM32F103 Minimum - specific Configuration Options - Configurations @@ -305,6 +307,48 @@ SDCard support: PA5, MOSI to PA7 and MISO to PA6. Note: some chinese boards use MOSO instead of MISO. +USB Console support: +==================== + + The STM32F103C8 has a USB Device controller, then we can use NuttX support + to USB Device. We can the console over USB enabling these options: + + System Type ---> + STM32 Peripheral Support ---> + [*] USB Device + + It will enable: CONFIG_STM32_USB=y + + Board Selection ---> + -*- Enable boardctl() interface + [*] Enable USB device controls + + It will enable: CONFIG_BOARDCTL_USBDEVCTRL=y + + Device Drivers ---> + -*- USB Device Driver Support ---> + [*] USB Modem (CDC/ACM) support ---> + + It will enable: CONFIG_CDCACM=y and many default options. + + Device Drivers ---> + -*- USB Device Driver Support ---> + [*] USB Modem (CDC/ACM) support ---> + [*] CDC/ACM console device + + It will enable: CONFIG_CDCACM_CONSOLE=y + + Device Drivers ---> + [*] Serial Driver Support ---> + Serial console (No serial console) ---> + (X) No serial console + + It will enable: CONFIG_NO_SERIAL_CONSOLE=y + + After flashing the firmware in the board, unplug and plug it in the computer + and it will create a /dev/ttyACM0 device in the Linux. Use minicom with this + device to get access to NuttX NSH console (press Enter three times to start) + STM32F103 Minimum - specific Configuration Options ================================================== diff --git a/configs/stm32f103-minimum/src/Makefile b/configs/stm32f103-minimum/src/Makefile index 387e2bfe6a..5e937a4ac0 100644 --- a/configs/stm32f103-minimum/src/Makefile +++ b/configs/stm32f103-minimum/src/Makefile @@ -89,4 +89,8 @@ ifeq ($(CONFIG_WL_NRF24L01),y) CSRCS += stm32_wireless.c endif +ifeq ($(CONFIG_USBDEV),y) +CSRCS += stm32_usbdev.c +endif + include $(TOPDIR)/configs/Board.mk diff --git a/configs/stm32f103-minimum/src/stm32_usbdev.c b/configs/stm32f103-minimum/src/stm32_usbdev.c index ecbd707fb7..92fc01f095 100644 --- a/configs/stm32f103-minimum/src/stm32_usbdev.c +++ b/configs/stm32f103-minimum/src/stm32_usbdev.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/stm32f103-minimum/src/stm32_usbdev.c * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * Laurent Latil * @@ -60,7 +60,7 @@ * Name: stm32_usbinitialize * * Description: - * Called to setup USB-related GPIO pins for the Hy-Mini STM32v board. + * Called to setup USB-related GPIO pins for the STM32F103 Minimum board. * ************************************************************************************/