From e59929b1d26138c03dde9b52247c071ed535ed3d Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Fri, 6 Feb 2015 09:21:49 +0000 Subject: STM32F3 CDC_IAD demo working git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7661 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/STM32F30x/USB_CDC_IAD/Makefile | 2 +- ...30x-USB_CDC_IAD (OpenOCD, Flash and Run).launch | 2 +- .../USB_CDC_IAD/driver/ChibiOS Virtual COM.inf | 54 ++++++++++++++++++++++ testhal/STM32/STM32F30x/USB_CDC_IAD/usbcfg.c | 36 +++++++++------ 4 files changed, 77 insertions(+), 17 deletions(-) create mode 100644 testhal/STM32/STM32F30x/USB_CDC_IAD/driver/ChibiOS Virtual COM.inf (limited to 'testhal') 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 @@ - + 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, -- cgit v1.2.3