aboutsummaryrefslogtreecommitdiffstats
path: root/testhal
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-02-06 09:21:49 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-02-06 09:21:49 +0000
commite59929b1d26138c03dde9b52247c071ed535ed3d (patch)
tree37720f2f45549ffdf27b2495bef1aad5ec72367a /testhal
parentb2fb8483c6a4c7738fda9282ff3bbd498cf2096e (diff)
downloadChibiOS-e59929b1d26138c03dde9b52247c071ed535ed3d.tar.gz
ChibiOS-e59929b1d26138c03dde9b52247c071ed535ed3d.tar.bz2
ChibiOS-e59929b1d26138c03dde9b52247c071ed535ed3d.zip
STM32F3 CDC_IAD demo working
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7661 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal')
-rw-r--r--testhal/STM32/STM32F30x/USB_CDC_IAD/Makefile2
-rw-r--r--testhal/STM32/STM32F30x/USB_CDC_IAD/debug/STM32F30x-USB_CDC_IAD (OpenOCD, Flash and Run).launch2
-rw-r--r--testhal/STM32/STM32F30x/USB_CDC_IAD/driver/ChibiOS Virtual COM.inf54
-rw-r--r--testhal/STM32/STM32F30x/USB_CDC_IAD/usbcfg.c36
4 files changed, 77 insertions, 17 deletions
diff --git a/testhal/STM32/STM32F30x/USB_CDC_IAD/Makefile b/testhal/STM32/STM32F30x/USB_CDC_IAD/Makefile
index 2c5d529b2..4b3d40da0 100644
--- a/testhal/STM32/STM32F30x/USB_CDC_IAD/Makefile
+++ b/testhal/STM32/STM32F30x/USB_CDC_IAD/Makefile
@@ -5,7 +5,7 @@
# Compiler options here.
ifeq ($(USE_OPT),)
- USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16
+ USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
endif
# C specific options here (added to USE_OPT).
diff --git a/testhal/STM32/STM32F30x/USB_CDC_IAD/debug/STM32F30x-USB_CDC_IAD (OpenOCD, Flash and Run).launch b/testhal/STM32/STM32F30x/USB_CDC_IAD/debug/STM32F30x-USB_CDC_IAD (OpenOCD, Flash and Run).launch
index a1f5ed451..4ba94fc0d 100644
--- a/testhal/STM32/STM32F30x/USB_CDC_IAD/debug/STM32F30x-USB_CDC_IAD (OpenOCD, Flash and Run).launch
+++ b/testhal/STM32/STM32F30x/USB_CDC_IAD/debug/STM32F30x-USB_CDC_IAD (OpenOCD, Flash and Run).launch
@@ -33,7 +33,7 @@
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
-<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;setup[0]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;setup[1]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;setup[2]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;setup[3]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;setup[4]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;setup[5]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;setup[6]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;setup[7]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;/contentList&gt;"/>
+<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;setup[7]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;setup[6]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;setup[5]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;setup[4]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;setup[3]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;setup[2]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;setup[1]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;setup[0]-setup-usbp-default_handler-(format)&quot; val=&quot;4&quot;/&gt;&lt;/contentList&gt;"/>
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;globalVariableList/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="./build/ch.elf"/>
diff --git a/testhal/STM32/STM32F30x/USB_CDC_IAD/driver/ChibiOS Virtual COM.inf b/testhal/STM32/STM32F30x/USB_CDC_IAD/driver/ChibiOS Virtual COM.inf
new file mode 100644
index 000000000..7e6908513
--- /dev/null
+++ b/testhal/STM32/STM32F30x/USB_CDC_IAD/driver/ChibiOS Virtual COM.inf
@@ -0,0 +1,54 @@
+[Version]
+Signature="$Windows NT$"
+Class=Ports
+ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
+Provider=%PRVDR%
+CatalogFile=stmcdc.cat
+DriverVer=02/06/2015,1.0.0
+
+[SourceDisksNames]
+
+[SourceDisksFiles]
+
+[Manufacturer]
+%MFGNAME%=DeviceList,NT,NTamd64
+
+[DestinationDirs]
+DefaultDestDir = 12
+
+[DeviceList.NT]
+%DESCRIPTION1%=DriverInstall,USB\VID_F055&PID_E063&MI_00
+%DESCRIPTION2%=DriverInstall,USB\VID_F055&PID_E063&MI_02
+
+[DeviceList.NTamd64]
+%DESCRIPTION1%=DriverInstall,USB\VID_F055&PID_E063&MI_00
+%DESCRIPTION2%=DriverInstall,USB\VID_F055&PID_E063&MI_02
+
+[DriverInstall.NT]
+Include=mdmcpq.inf
+CopyFiles=FakeModemCopyFileSection
+AddReg=DriverInstall.NT.AddReg
+
+[DriverInstall.NT.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,usbser.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.NT.Services]
+AddService=usbser, 0x00000002, DriverServiceInst
+
+[DriverServiceInst]
+DisplayName=%SERVICE%
+ServiceType = 1 ; SERVICE_KERNEL_DRIVER
+StartType = 3 ; SERVICE_DEMAND_START
+ErrorControl = 1 ; SERVICE_ERROR_NORMAL
+ServiceBinary= %12%\usbser.sys
+LoadOrderGroup = Base
+
+[Strings]
+PRVDR = "www.chibios.org"
+MFGNAME = "ChibiOS."
+DESCRIPTION1 = "ChibiOS Virtual COM Port 1"
+DESCRIPTION2 = "ChibiOS Virtual COM Port 2"
+SERVICE = "ChibiOS Virtual COM Port"
+DriversDisk = "ChibiOS Drivers Disk"
diff --git a/testhal/STM32/STM32F30x/USB_CDC_IAD/usbcfg.c b/testhal/STM32/STM32F30x/USB_CDC_IAD/usbcfg.c
index 9623ab63b..ef55d2bd8 100644
--- a/testhal/STM32/STM32F30x/USB_CDC_IAD/usbcfg.c
+++ b/testhal/STM32/STM32F30x/USB_CDC_IAD/usbcfg.c
@@ -16,6 +16,9 @@
#include "hal.h"
+#define USB_DEVICE_VID 0xF055 /* You MUST change this.*/
+#define USB_DEVICE_PID 0xE063 /* You MUST change this.*/
+
/*
* Endpoints.
*/
@@ -26,6 +29,9 @@
#define USB_DATA_AVAILABLE_EP_B 4
#define USB_DATA_REQUEST_EP_B 4
+#define USB_INTERRUPT_REQUEST_SIZE 0x10
+#define USB_DATA_SIZE 0x40
+
/*
* Interfaces
*/
@@ -40,13 +46,13 @@
*/
static const uint8_t vcom_device_descriptor_data[] = {
USB_DESC_DEVICE(
- 0x0110, /* bcdUSB (1.1). */
+ 0x0200, /* bcdUSB (1.1). */
0xEF, /* bDeviceClass (misc). */
0x02, /* bDeviceSubClass (common). */
0x01, /* bDeviceProtocol (IAD). */
- 0x40, /* bMaxPacketSize. */
- 0x0483, /* idVendor (ST). */
- 0x5740, /* idProduct. */
+ USB_DATA_SIZE, /* bMaxPacketSize. */
+ USB_DEVICE_VID, /* idVendor. */
+ USB_DEVICE_PID, /* idProduct. */
0x0200, /* bcdDevice. */
1, /* iManufacturer. */
2, /* iProduct. */
@@ -69,7 +75,7 @@ static const USBDescriptor vcom_device_descriptor = {
#define CDC_IF_DESC_SET(comIfNum, datIfNum, comInEp, datOutEp, datInEp) \
/* Interface Descriptor.*/ \
USB_DESC_INTERFACE( \
- 0x00, /* bInterfaceNumber. */ \
+ comIfNum, /* bInterfaceNumber. */ \
0x00, /* bAlternateSetting. */ \
0x01, /* bNumEndpoints. */ \
CDC_COMMUNICATION_INTERFACE_CLASS, /* bInterfaceClass. */ \
@@ -104,8 +110,8 @@ static const USBDescriptor vcom_device_descriptor = {
USB_DESC_ENDPOINT ( \
comInEp, \
USB_EP_MODE_TYPE_INTR, /* bmAttributes. */ \
- 0x0010, /* wMaxPacketSize. */ \
- 0x01), /*******/ /* bInterval. */ \
+ USB_INTERRUPT_REQUEST_SIZE, /* wMaxPacketSize. */ \
+ 0x01), /* bInterval. */ \
\
/* CDC Data Interface Descriptor.*/ \
USB_DESC_INTERFACE( \
@@ -122,13 +128,13 @@ static const USBDescriptor vcom_device_descriptor = {
USB_DESC_ENDPOINT( \
datOutEp, /* bEndpointAddress. */ \
USB_EP_MODE_TYPE_BULK, /* bmAttributes. */ \
- 0x0040, /* wMaxPacketSize. */ \
+ USB_DATA_SIZE, /* wMaxPacketSize. */ \
0x00), /* bInterval. */ \
/* Endpoint, Bulk IN.*/ \
USB_DESC_ENDPOINT( \
datInEp, /* bEndpointAddress. */ \
USB_EP_MODE_TYPE_BULK, /* bmAttributes. */ \
- 0x0040, /* wMaxPacketSize. */ \
+ USB_DATA_SIZE, /* wMaxPacketSize. */ \
0x00) /* bInterval. */
#define IAD_CDC_IF_DESC_SET_SIZE \
@@ -272,7 +278,7 @@ static const USBEndpointConfig ep1config = {
NULL,
sduInterruptTransmitted,
NULL,
- 0x0010,
+ USB_INTERRUPT_REQUEST_SIZE,
0x0000,
&ep1instate,
NULL,
@@ -298,8 +304,8 @@ static const USBEndpointConfig ep2config = {
NULL,
sduDataTransmitted,
sduDataReceived,
- 0x0040,
- 0x0040,
+ USB_DATA_SIZE,
+ USB_DATA_SIZE,
&ep2instate,
&ep2outstate,
1,
@@ -319,7 +325,7 @@ static const USBEndpointConfig ep3config = {
NULL,
sduInterruptTransmitted,
NULL,
- 0x0010,
+ USB_INTERRUPT_REQUEST_SIZE,
0x0000,
&ep3instate,
NULL,
@@ -345,8 +351,8 @@ static const USBEndpointConfig ep4config = {
NULL,
sduDataTransmitted,
sduDataReceived,
- 0x0040,
- 0x0040,
+ USB_DATA_SIZE,
+ USB_DATA_SIZE,
&ep4instate,
&ep4outstate,
1,