From 28e566ccfd914b5715f454d6776c91e5b3b2a70d Mon Sep 17 00:00:00 2001
From: Giovanni Di Sirio <gdisirio@gmail.com>
Date: Sat, 6 Feb 2016 11:47:53 +0000
Subject: Fixed bug #703.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8847 35acf78f-673a-0410-8e92-d51de3d6d3f4
---
 demos/STM32/RT-STM32F429-DISCOVERY/mcuconf.h |  4 ++--
 demos/STM32/RT-STM32F429-DISCOVERY/usbcfg.c  | 26 +++++++++++++-------------
 readme.txt                                   |  1 +
 3 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/demos/STM32/RT-STM32F429-DISCOVERY/mcuconf.h b/demos/STM32/RT-STM32F429-DISCOVERY/mcuconf.h
index ae728ce6f..06f802489 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY/mcuconf.h
+++ b/demos/STM32/RT-STM32F429-DISCOVERY/mcuconf.h
@@ -343,8 +343,8 @@
 /*
  * USB driver system settings.
  */
-#define STM32_USB_USE_OTG1                  TRUE
-#define STM32_USB_USE_OTG2                  FALSE
+#define STM32_USB_USE_OTG1                  FALSE
+#define STM32_USB_USE_OTG2                  TRUE
 #define STM32_USB_OTG1_IRQ_PRIORITY         14
 #define STM32_USB_OTG2_IRQ_PRIORITY         14
 #define STM32_USB_OTG1_RX_FIFO_SIZE         512
diff --git a/demos/STM32/RT-STM32F429-DISCOVERY/usbcfg.c b/demos/STM32/RT-STM32F429-DISCOVERY/usbcfg.c
index 07a492758..d541a9ee6 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY/usbcfg.c
+++ b/demos/STM32/RT-STM32F429-DISCOVERY/usbcfg.c
@@ -20,11 +20,11 @@
 SerialUSBDriver SDU1;
 
 /*
- * Endpoints to be used for USBD1.
+ * Endpoints to be used for USBD2.
  */
-#define USBD1_DATA_REQUEST_EP           1
-#define USBD1_DATA_AVAILABLE_EP         1
-#define USBD1_INTERRUPT_REQUEST_EP      2
+#define USBD2_DATA_REQUEST_EP           1
+#define USBD2_DATA_AVAILABLE_EP         1
+#define USBD2_INTERRUPT_REQUEST_EP      2
 
 /*
  * USB Device Descriptor.
@@ -102,7 +102,7 @@ static const uint8_t vcom_configuration_descriptor_data[67] = {
   USB_DESC_BYTE         (0x01),         /* bSlaveInterface0 (Data Class
                                            Interface).                      */
   /* Endpoint 2 Descriptor.*/
-  USB_DESC_ENDPOINT     (USBD1_INTERRUPT_REQUEST_EP|0x80,
+  USB_DESC_ENDPOINT     (USBD2_INTERRUPT_REQUEST_EP|0x80,
                          0x03,          /* bmAttributes (Interrupt).        */
                          0x0008,        /* wMaxPacketSize.                  */
                          0xFF),         /* bInterval.                       */
@@ -118,12 +118,12 @@ static const uint8_t vcom_configuration_descriptor_data[67] = {
                                            4.7).                            */
                          0x00),         /* iInterface.                      */
   /* Endpoint 3 Descriptor.*/
-  USB_DESC_ENDPOINT     (USBD1_DATA_AVAILABLE_EP,       /* bEndpointAddress.*/
+  USB_DESC_ENDPOINT     (USBD2_DATA_AVAILABLE_EP,       /* bEndpointAddress.*/
                          0x02,          /* bmAttributes (Bulk).             */
                          0x0040,        /* wMaxPacketSize.                  */
                          0x00),         /* bInterval.                       */
   /* Endpoint 1 Descriptor.*/
-  USB_DESC_ENDPOINT     (USBD1_DATA_REQUEST_EP|0x80,    /* bEndpointAddress.*/
+  USB_DESC_ENDPOINT     (USBD2_DATA_REQUEST_EP|0x80,    /* bEndpointAddress.*/
                          0x02,          /* bmAttributes (Bulk).             */
                          0x0040,        /* wMaxPacketSize.                  */
                          0x00)          /* bInterval.                       */
@@ -277,8 +277,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     /* Enables the endpoints specified into the configuration.
        Note, this callback is invoked from an ISR so I-Class functions
        must be used.*/
-    usbInitEndpointI(usbp, USBD1_DATA_REQUEST_EP, &ep1config);
-    usbInitEndpointI(usbp, USBD1_INTERRUPT_REQUEST_EP, &ep2config);
+    usbInitEndpointI(usbp, USBD2_DATA_REQUEST_EP, &ep1config);
+    usbInitEndpointI(usbp, USBD2_INTERRUPT_REQUEST_EP, &ep2config);
 
     /* Resetting the state of the CDC subsystem.*/
     sduConfigureHookI(&SDU1);
@@ -327,8 +327,8 @@ const USBConfig usbcfg = {
  * Serial over USB driver configuration.
  */
 const SerialUSBConfig serusbcfg = {
-  &USBD1,
-  USBD1_DATA_REQUEST_EP,
-  USBD1_DATA_AVAILABLE_EP,
-  USBD1_INTERRUPT_REQUEST_EP
+  &USBD2,
+  USBD2_DATA_REQUEST_EP,
+  USBD2_DATA_AVAILABLE_EP,
+  USBD2_INTERRUPT_REQUEST_EP
 };
diff --git a/readme.txt b/readme.txt
index 375142705..f9df37fbc 100644
--- a/readme.txt
+++ b/readme.txt
@@ -76,6 +76,7 @@
 - RT:  Removed the p_msg field from the thread_t structure saving a
        msg_t-sized field from the structure. Messages now use a new field
        into the p_u union. Now synchronous messages are even faster.
+- HAL: Fixed broken demo for STM32F429 (bug #703)(backported to 16.1.3).
 - HAL: Fixed wrong macro definition for palWriteLine (bug #702)(backported
        to 16.1.3).
 - HAL: Fixed error is buffer queues (bug #701)(backported to 16.1.3).
-- 
cgit v1.2.3