Parcourir la source

Added USB serial

Per Mårtensson il y a 1 an
Parent
commit
cdbb22ca5b
10 fichiers modifiés avec 200 ajouts et 123 suppressions
  1. 7 0
      Core/Inc/cdc.h
  2. 10 8
      Core/Inc/main.h
  3. 14 0
      Core/Inc/tusb_config.h
  4. 55 0
      Core/Src/cdc.c
  5. 2 2
      Core/Src/ide.c
  6. 28 10
      Core/Src/main.c
  7. 2 2
      Core/Src/stm32f7xx_it.c
  8. 63 45
      Core/Src/usb_descriptors.c
  9. 17 12
      ide-usb.ioc
  10. 2 44
      mx.scratch

+ 7 - 0
Core/Inc/cdc.h

@@ -0,0 +1,7 @@
+#ifndef _CDC_H
+#define _CDC_H
+
+#include <stdint.h>
+void cdctask(void);
+static void echo_serial_port(uint8_t itf, uint8_t buf[], uint32_t count);
+#endif

+ 10 - 8
Core/Inc/main.h

@@ -66,10 +66,10 @@ void Error_Handler(void);
 #define IDE_DD6_GPIO_Port GPIOE
 #define IDE_DIOR_Pin GPIO_PIN_4
 #define IDE_DIOR_GPIO_Port GPIOC
-#define LED_ORANGE_Pin GPIO_PIN_0
-#define LED_ORANGE_GPIO_Port GPIOB
-#define LED_RED_Pin GPIO_PIN_1
-#define LED_RED_GPIO_Port GPIOB
+#define LED_2_Pin GPIO_PIN_0
+#define LED_2_GPIO_Port GPIOB
+#define LED_3_Pin GPIO_PIN_1
+#define LED_3_GPIO_Port GPIOB
 #define IDE_DD7_Pin GPIO_PIN_7
 #define IDE_DD7_GPIO_Port GPIOE
 #define IDE_DD8_Pin GPIO_PIN_8
@@ -90,8 +90,8 @@ void Error_Handler(void);
 #define IDE_DD15_GPIO_Port GPIOE
 #define IDE_RESET_Pin GPIO_PIN_10
 #define IDE_RESET_GPIO_Port GPIOB
-#define LED_GREEN_Pin GPIO_PIN_11
-#define LED_GREEN_GPIO_Port GPIOB
+#define LED_1_Pin GPIO_PIN_11
+#define LED_1_GPIO_Port GPIOB
 #define IDE_DA0_Pin GPIO_PIN_8
 #define IDE_DA0_GPIO_Port GPIOD
 #define IDE_DA1_Pin GPIO_PIN_9
@@ -112,10 +112,12 @@ void Error_Handler(void);
 #define IDE_DD2_GPIO_Port GPIOD
 #define IDE_DD3_Pin GPIO_PIN_3
 #define IDE_DD3_GPIO_Port GPIOD
+#define TXS0108E_OE2_Pin GPIO_PIN_7
+#define TXS0108E_OE2_GPIO_Port GPIOB
 #define TXS0108E_OE_Pin GPIO_PIN_8
 #define TXS0108E_OE_GPIO_Port GPIOB
-#define LED_BLUE_Pin GPIO_PIN_9
-#define LED_BLUE_GPIO_Port GPIOB
+#define LED_4_Pin GPIO_PIN_9
+#define LED_4_GPIO_Port GPIOB
 
 /* USER CODE BEGIN Private defines */
 

+ 14 - 0
Core/Inc/tusb_config.h

@@ -1,3 +1,9 @@
+
+#ifndef CFG_TUD_ENDPOINT0_SIZE
+#define CFG_TUD_ENDPOINT0_SIZE    64
+#endif
+#define CFG_TUD_ENABLED       1
+#define CFG_TUD_CDC               2
 #define CFG_TUSB_MCU                 OPT_MCU_STM32F7
 #define CFG_TUSB_OS                  OPT_OS_FREERTOS
 #define BOARD_DEVICE_RHPORT_SPEED    OPT_MODE_HIGH_SPEED
@@ -5,3 +11,11 @@
 #define CFG_TUSB_RHPORT1_MODE        (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
 #define CFG_TUD_MSC                  1
 #define CFG_TUD_MSC_EP_BUFSIZE       8192
+
+
+// CDC FIFO size of TX and RX
+#define CFG_TUD_CDC_RX_BUFSIZE   (TUD_OPT_HIGH_SPEED ? 512 : 64)
+#define CFG_TUD_CDC_TX_BUFSIZE   (TUD_OPT_HIGH_SPEED ? 512 : 64)
+
+// CDC Endpoint transfer buffer size, more is faster
+#define CFG_TUD_CDC_EP_BUFSIZE   (TUD_OPT_HIGH_SPEED ? 512 : 64)

+ 55 - 0
Core/Src/cdc.c

@@ -0,0 +1,55 @@
+#include "main.h"
+#include "cmsis_os.h"
+#include "cdc.h"
+#include "tusb.h"
+
+// echo to either Serial0 or Serial1
+// with Serial0 as all lower case, Serial1 as all upper case
+static void echo_serial_port(uint8_t itf, uint8_t buf[], uint32_t count)
+{
+  uint8_t const case_diff = 'a' - 'A';
+
+  for(uint32_t i=0; i<count; i++)
+  {
+    if (itf == 0)
+    {
+      // echo back 1st port as lower case
+      if (isupper(buf[i])) buf[i] += case_diff;
+    }
+    else
+    {
+      // echo back 2nd port as upper case
+      if (islower(buf[i])) buf[i] -= case_diff;
+    }
+
+    tud_cdc_n_write_char(itf, buf[i]);
+  }
+  tud_cdc_n_write_flush(itf);
+}
+
+//--------------------------------------------------------------------+
+// USB CDC
+//--------------------------------------------------------------------+
+void cdctask(void)
+{
+  uint8_t itf;
+
+  for (itf = 0; itf < CFG_TUD_CDC; itf++)
+  {
+    // connected() check for DTR bit
+    // Most but not all terminal client set this when making connection
+    // if ( tud_cdc_n_connected(itf) )
+    {
+      if ( tud_cdc_n_available(itf) )
+      {
+        uint8_t buf[64];
+
+        uint32_t count = tud_cdc_n_read(itf, buf, sizeof(buf));
+
+        // echo back to both serial ports
+        echo_serial_port(0, buf, count);
+        echo_serial_port(1, buf, count);
+      }
+    }
+  }
+}

+ 2 - 2
Core/Src/ide.c

@@ -54,7 +54,7 @@ static inline void ide_set_bus_mode(uint32_t mode) {
 #define PORTD_BUS_BSRR_MASK 0b0000000000001111
 #define PORTE_BUS_BSRR_MASK 0b1111111111110000
 
-#define CORE_CLOCK_HZ 168E6 // 168 MHz
+#define CORE_CLOCK_HZ 218E6 // 168 MHz
 #define CORE_CYCLE_TIME_S (1 / CORE_CLOCK_HZ)
 #define CORE_CYCLE_TIME_NS ((int)(CORE_CYCLE_TIME_S * 1E9 + 1)) // 6ns
 #define NDELAY_CYCLES_PER_ITERATION 3
@@ -112,7 +112,7 @@ static void ide_error() {
 
 	HAL_GPIO_WritePin(IDE_RESET_GPIO_Port, IDE_RESET_Pin, GPIO_PIN_RESET);
 	while(1) {
-		HAL_GPIO_TogglePin(LED_RED_GPIO_Port, LED_RED_Pin);
+		HAL_GPIO_TogglePin(LED_2_GPIO_Port, LED_2_Pin);
 		osDelay(100);
 	}
 }

+ 28 - 10
Core/Src/main.c

@@ -25,6 +25,7 @@
 /* USER CODE BEGIN Includes */
 #include "tusb.h"
 #include "ide_async.h"
+#include "cdc.h"
 /* USER CODE END Includes */
 
 /* Private typedef -----------------------------------------------------------*/
@@ -63,6 +64,13 @@ const osThreadAttr_t ide_attributes = {
   .stack_size = 1024 * 4,
   .priority = (osPriority_t) osPriorityNormal,
 };
+/* Definitions for ide */
+osThreadId_t cdcHandle;
+const osThreadAttr_t cdc_attributes = {
+  .name = "cdc",
+  .stack_size = 1024 * 4,
+  .priority = (osPriority_t) osPriorityNormal,
+};
 /* USER CODE BEGIN PV */
 
 /* USER CODE END PV */
@@ -75,13 +83,15 @@ static void MX_USART2_UART_Init(void);
 static void MX_USB_OTG_HS_PCD_Init(void);
 void tinyusb_task(void *argument);
 void ide_task(void *argument);
-
+void cdc_task(void *argument);
+void cdctask(void);
 /* USER CODE BEGIN PFP */
 
 /* USER CODE END PFP */
 
 /* Private user code ---------------------------------------------------------*/
 /* USER CODE BEGIN 0 */
+
 #ifdef DEBUG
 int _write (int fhdl, const void *buf, size_t count) {
   uint8_t const* buf8 = (uint8_t const*) buf;
@@ -155,6 +165,8 @@ int main(void)
   /* creation of ide */
   ideHandle = osThreadNew(ide_task, NULL, &ide_attributes);
 
+  /* creation of cdc */
+  cdcHandle = osThreadNew(cdc_task, NULL, &cdc_attributes);
   /* USER CODE BEGIN RTOS_THREADS */
   /* add threads, ... */
   /* USER CODE END RTOS_THREADS */
@@ -331,9 +343,6 @@ static void MX_USB_OTG_HS_PCD_Init(void)
   hpcd_USB_OTG_HS.Init.vbus_sensing_enable = DISABLE;
   hpcd_USB_OTG_HS.Init.use_dedicated_ep1 = DISABLE;
   hpcd_USB_OTG_HS.Init.use_external_vbus = DISABLE;
-     __HAL_RCC_OTGPHYC_CLK_ENABLE();
-       __HAL_RCC_USB_OTG_HS_CLK_ENABLE();
-       __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE();
   if (HAL_PCD_Init(&hpcd_USB_OTG_HS) != HAL_OK)
   {
     Error_Handler();
@@ -367,8 +376,8 @@ static void MX_GPIO_Init(void)
   HAL_GPIO_WritePin(GPIOC, IDE_DIOR_Pin|IDE_CS0_Pin|IDE_CS1_Pin|IDE_DIOW_Pin, GPIO_PIN_RESET);
 
   /*Configure GPIO pin Output Level */
-  HAL_GPIO_WritePin(GPIOB, LED_ORANGE_Pin|LED_RED_Pin|IDE_RESET_Pin|LED_GREEN_Pin
-                          |TXS0108E_OE_Pin|LED_BLUE_Pin, GPIO_PIN_RESET);
+  HAL_GPIO_WritePin(GPIOB, LED_2_Pin|LED_3_Pin|IDE_RESET_Pin|LED_1_Pin
+                          |TXS0108E_OE2_Pin|TXS0108E_OE_Pin|LED_4_Pin, GPIO_PIN_RESET);
 
   /*Configure GPIO pin Output Level */
   HAL_GPIO_WritePin(GPIOD, IDE_DA0_Pin|IDE_DA1_Pin|IDE_DA2_Pin, GPIO_PIN_RESET);
@@ -390,10 +399,10 @@ static void MX_GPIO_Init(void)
   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
   HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 
-  /*Configure GPIO pins : LED_ORANGE_Pin LED_RED_Pin LED_GREEN_Pin TXS0108E_OE_Pin
-                           LED_BLUE_Pin */
-  GPIO_InitStruct.Pin = LED_ORANGE_Pin|LED_RED_Pin|LED_GREEN_Pin|TXS0108E_OE_Pin
-                          |LED_BLUE_Pin;
+  /*Configure GPIO pins : LED_2_Pin LED_3_Pin LED_1_Pin TXS0108E_OE2_Pin
+                           TXS0108E_OE_Pin LED_4_Pin */
+  GPIO_InitStruct.Pin = LED_2_Pin|LED_3_Pin|LED_1_Pin|TXS0108E_OE2_Pin
+                          |TXS0108E_OE_Pin|LED_4_Pin;
   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
   GPIO_InitStruct.Pull = GPIO_NOPULL;
   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
@@ -445,6 +454,15 @@ void tinyusb_task(void *argument)
   /* USER CODE END 5 */
 }
 
+void cdc_task(void *argument)
+{
+  /* USER CODE BEGIN 5 */
+  /* Infinite loop */
+  while(1) {
+    cdctask();
+  }
+  /* USER CODE END 5 */
+}
 /* USER CODE BEGIN Header_ide_task */
 /**
 * @brief Function implementing the ide thread.

+ 2 - 2
Core/Src/stm32f7xx_it.c

@@ -189,8 +189,8 @@ void SysTick_Handler(void)
 void OTG_HS_IRQHandler(void)
 {
   /* USER CODE BEGIN OTG_HS_IRQn 0 */
-	tud_int_handler(BOARD_DEVICE_RHPORT_NUM);
-	  return;
+  tud_int_handler(BOARD_DEVICE_RHPORT_NUM);
+  return;
   /* USER CODE END OTG_HS_IRQn 0 */
   HAL_PCD_IRQHandler(&hpcd_USB_OTG_HS);
   /* USER CODE BEGIN OTG_HS_IRQn 1 */

+ 63 - 45
Core/Src/usb_descriptors.c

@@ -43,9 +43,9 @@ tusb_desc_device_t const desc_device =
     .bLength            = sizeof(tusb_desc_device_t),
     .bDescriptorType    = TUSB_DESC_DEVICE,
     .bcdUSB             = 0x0200,
-    .bDeviceClass       = 0x00,
-    .bDeviceSubClass    = 0x00,
-    .bDeviceProtocol    = 0x00,
+    .bDeviceClass       = TUSB_CLASS_MISC,
+    .bDeviceSubClass    = MISC_SUBCLASS_COMMON,
+    .bDeviceProtocol    = MISC_PROTOCOL_IAD,
     .bMaxPacketSize0    = CFG_TUD_ENDPOINT0_SIZE,
 
     .idVendor           = 0xCafe,
@@ -72,29 +72,27 @@ uint8_t const * tud_descriptor_device_cb(void)
 
 enum
 {
+	  ITF_NUM_CDC_0 = 0,
+	  ITF_NUM_CDC_0_DATA,
+	  ITF_NUM_CDC_1,
+	  ITF_NUM_CDC_1_DATA,
   ITF_NUM_MSC,
   ITF_NUM_TOTAL
 };
 
-#define CONFIG_TOTAL_LEN    (TUD_CONFIG_DESC_LEN + TUD_MSC_DESC_LEN)
+#define CONFIG_TOTAL_LEN    (TUD_CONFIG_DESC_LEN + CFG_TUD_CDC *TUD_CDC_DESC_LEN + TUD_MSC_DESC_LEN)
 
-#if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX
-  // LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number
-  //  0 control, 1 In, 2 Bulk, 3 Iso, 4 In, 5 Bulk etc ...
-  #define EPNUM_MSC_OUT   0x02
-  #define EPNUM_MSC_IN    0x82
 
-#elif CFG_TUSB_MCU == OPT_MCU_SAMG
-  // SAMG doesn't support a same endpoint number with different direction IN and OUT
-  //  e.g EP1 OUT & EP1 IN cannot exist together
-  #define EPNUM_MSC_OUT   0x01
-  #define EPNUM_MSC_IN    0x82
+  #define EPNUM_MSC_OUT   0x05
+  #define EPNUM_MSC_IN    0x85
 
-#else
-  #define EPNUM_MSC_OUT   0x01
-  #define EPNUM_MSC_IN    0x81
+#define EPNUM_CDC_0_NOTIF   0x81
+#define EPNUM_CDC_0_OUT     0x02
+#define EPNUM_CDC_0_IN      0x82
 
-#endif
+#define EPNUM_CDC_1_NOTIF   0x83
+#define EPNUM_CDC_1_OUT     0x04
+#define EPNUM_CDC_1_IN      0x84
 
 uint8_t const desc_fs_configuration[] =
 {
@@ -102,7 +100,11 @@ uint8_t const desc_fs_configuration[] =
   TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
 
   // Interface number, string index, EP Out & EP In address, EP size
-  TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 0, EPNUM_MSC_OUT, EPNUM_MSC_IN, 64),
+  TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 5, EPNUM_MSC_OUT, EPNUM_MSC_IN, 64),
+
+  // Interface number, string index, EP notification address and size, EP data address (out, in) and size.
+  TUD_CDC_DESCRIPTOR(ITF_NUM_CDC_0, 4, EPNUM_CDC_0_NOTIF, 8, EPNUM_CDC_0_OUT, EPNUM_CDC_0_IN, 64),
+  TUD_CDC_DESCRIPTOR(ITF_NUM_CDC_1, 4, EPNUM_CDC_1_NOTIF, 8, EPNUM_CDC_1_OUT, EPNUM_CDC_1_IN, 64),
 };
 
 #if TUD_OPT_HIGH_SPEED
@@ -112,7 +114,11 @@ uint8_t const desc_hs_configuration[] =
   TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
 
   // Interface number, string index, EP Out & EP In address, EP size
-  TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 0, EPNUM_MSC_OUT, EPNUM_MSC_IN, 512),
+  TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 5, EPNUM_MSC_OUT, EPNUM_MSC_IN, 512),
+
+  // Interface number, string index, EP notification address and size, EP data address (out, in) and size.
+  TUD_CDC_DESCRIPTOR(ITF_NUM_CDC_0, 4, EPNUM_CDC_0_NOTIF, 8, EPNUM_CDC_0_OUT, EPNUM_CDC_0_IN, 512),
+  TUD_CDC_DESCRIPTOR(ITF_NUM_CDC_1, 5, EPNUM_CDC_1_NOTIF, 8, EPNUM_CDC_1_OUT, EPNUM_CDC_1_IN, 512),
 };
 #endif
 
@@ -134,52 +140,64 @@ uint8_t const * tud_descriptor_configuration_cb(uint8_t index)
 //--------------------------------------------------------------------+
 // String Descriptors
 //--------------------------------------------------------------------+
-
+// String Descriptor Index
+enum {
+  STRID_LANGID = 0,
+  STRID_MANUFACTURER,
+  STRID_PRODUCT,
+  STRID_SERIAL,
+};
 // array of pointer to string descriptors
 char const* string_desc_arr [] =
 {
   (const char[]) { 0x09, 0x04 }, // 0: is supported language is English (0x0409)
   "Sweproj",                     // 1: Manufacturer
   "IDEUSB",              // 2: Product
-  "000001",                      // 3: Serials, should use chip ID
+ "000001",                      // 3: Serials, should use chip ID
+  "Sweproj CDC",                 // 4: CDC Interface
+  "Sweproj MSC",                 // 5: MSC Interface
 };
 
-static uint16_t _desc_str[32];
+static uint16_t _desc_str[32+1];
 
 // Invoked when received GET STRING DESCRIPTOR request
 // Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
-uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
-{
+uint16_t const *tud_descriptor_string_cb(uint8_t index, uint16_t langid) {
   (void) langid;
+  size_t chr_count;
+
+  switch ( index ) {
+    case STRID_LANGID:
+      memcpy(&_desc_str[1], string_desc_arr[0], 2);
+      chr_count = 1;
+      break;
 
-  uint8_t chr_count;
+    case STRID_SERIAL:
+      chr_count = 16;
+      break;
 
-  if ( index == 0)
-  {
-    memcpy(&_desc_str[1], string_desc_arr[0], 2);
-    chr_count = 1;
-  }else
-  {
-    // Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
-    // https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
+    default:
+      // Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
+      // https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
 
-    if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
+      if ( !(index < sizeof(string_desc_arr) / sizeof(string_desc_arr[0])) ) return NULL;
 
-    const char* str = string_desc_arr[index];
+      const char *str = string_desc_arr[index];
 
-    // Cap at max char
-    chr_count = strlen(str);
-    if ( chr_count > 31 ) chr_count = 31;
+      // Cap at max char
+      chr_count = strlen(str);
+      size_t const max_count = sizeof(_desc_str) / sizeof(_desc_str[0]) - 1; // -1 for string type
+      if ( chr_count > max_count ) chr_count = max_count;
 
-    // Convert ASCII string into UTF-16
-    for(uint8_t i=0; i<chr_count; i++)
-    {
-      _desc_str[1+i] = str[i];
-    }
+      // Convert ASCII string into UTF-16
+      for ( size_t i = 0; i < chr_count; i++ ) {
+        _desc_str[1 + i] = str[i];
+      }
+      break;
   }
 
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8) | (2 * chr_count + 2));
 
   return _desc_str;
 }

+ 17 - 12
ide-usb.ioc

@@ -6,7 +6,7 @@ FREERTOS.FootprintOK=true
 FREERTOS.IPParameters=Tasks01,FootprintOK
 FREERTOS.Tasks01=tinyusb,24,1024,tinyusb_task,Default,NULL,Dynamic,NULL,NULL;ide,24,1024,ide_task,Default,NULL,Dynamic,NULL,NULL
 File.Version=6
-GPIO.groupedBy=Show All
+GPIO.groupedBy=Group By Peripherals
 KeepUserPlacement=false
 Mcu.CPN=STM32F730Z8T6
 Mcu.Family=STM32F7
@@ -51,18 +51,19 @@ Mcu.Pin32=PD0
 Mcu.Pin33=PD1
 Mcu.Pin34=PD2
 Mcu.Pin35=PD3
-Mcu.Pin36=PB8
-Mcu.Pin37=PB9
-Mcu.Pin38=VP_FREERTOS_VS_CMSIS_V2
-Mcu.Pin39=VP_RTC_VS_RTC_Activate
+Mcu.Pin36=PB7
+Mcu.Pin37=PB8
+Mcu.Pin38=PB9
+Mcu.Pin39=VP_FREERTOS_VS_CMSIS_V2
 Mcu.Pin4=PC15-OSC32_OUT
-Mcu.Pin40=VP_SYS_VS_Systick
+Mcu.Pin40=VP_RTC_VS_RTC_Activate
+Mcu.Pin41=VP_SYS_VS_Systick
 Mcu.Pin5=PH0-OSC_IN
 Mcu.Pin6=PH1-OSC_OUT
 Mcu.Pin7=PA2
 Mcu.Pin8=PA3
 Mcu.Pin9=PC4
-Mcu.PinsNb=41
+Mcu.PinsNb=42
 Mcu.ThirdPartyNb=0
 Mcu.UserConstants=
 Mcu.UserName=STM32F730Z8Tx
@@ -88,11 +89,11 @@ PA2.Signal=USART2_TX
 PA3.Mode=Asynchronous
 PA3.Signal=USART2_RX
 PB0.GPIOParameters=GPIO_Label
-PB0.GPIO_Label=LED_ORANGE
+PB0.GPIO_Label=LED_2
 PB0.Locked=true
 PB0.Signal=GPIO_Output
 PB1.GPIOParameters=GPIO_Label
-PB1.GPIO_Label=LED_RED
+PB1.GPIO_Label=LED_3
 PB1.Locked=true
 PB1.Signal=GPIO_Output
 PB10.GPIOParameters=GPIO_Speed,GPIO_Label
@@ -101,13 +102,17 @@ PB10.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
 PB10.Locked=true
 PB10.Signal=GPIO_Output
 PB11.GPIOParameters=GPIO_Label
-PB11.GPIO_Label=LED_GREEN
+PB11.GPIO_Label=LED_1
 PB11.Locked=true
 PB11.Signal=GPIO_Output
 PB14.Mode=Internal_Phy_Device
 PB14.Signal=USB_OTG_HS_DM
 PB15.Mode=Internal_Phy_Device
 PB15.Signal=USB_OTG_HS_DP
+PB7.GPIOParameters=GPIO_Label
+PB7.GPIO_Label=TXS0108E_OE2
+PB7.Locked=true
+PB7.Signal=GPIO_Output
 PB8.GPIOParameters=GPIO_Speed,GPIO_Label,GPIO_FM8
 PB8.GPIO_FM8=__NULL
 PB8.GPIO_Label=TXS0108E_OE
@@ -115,7 +120,7 @@ PB8.GPIO_Speed=GPIO_SPEED_FREQ_LOW
 PB8.Locked=true
 PB8.Signal=GPIO_Output
 PB9.GPIOParameters=GPIO_Label
-PB9.GPIO_Label=LED_BLUE
+PB9.GPIO_Label=LED_4
 PB9.Locked=true
 PB9.Signal=GPIO_Output
 PC11.GPIOParameters=GPIO_Label
@@ -249,7 +254,7 @@ ProjectManager.ToolChainLocation=
 ProjectManager.UAScriptAfterPath=
 ProjectManager.UAScriptBeforePath=
 ProjectManager.UnderRoot=true
-ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_RTC_Init-RTC-false-HAL-true,4-MX_USART2_UART_Init-USART2-false-HAL-true,5-MX_USB_DEVICE_Init-USB_DEVICE-false-HAL-false,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
+ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_RTC_Init-RTC-false-HAL-true,4-MX_USART2_UART_Init-USART2-false-HAL-true,5-MX_USB_OTG_HS_PCD_Init-USB_OTG_HS-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
 RCC.48MHZClocksFreq_Value=48000000
 RCC.AHBFreq_Value=216000000
 RCC.APB1CLKDivider=RCC_HCLK_DIV4

+ 2 - 44
mx.scratch

@@ -14,44 +14,7 @@
       <ProjectName>ide-usb</ProjectName>
       <ProjectNature>C</ProjectNature>
       <Secure />
-      <filestoremove>
-        <file>
-          <name>USB_DEVICE/App/usb_device.c</name>
-        </file>
-        <file>
-          <name>../Src/custom.c</name>
-        </file>
-        <file>
-          <name>USB_DEVICE/Target/usbd_conf.c</name>
-        </file>
-        <file>
-          <name>USB_DEVICE/App/usbd_desc.c</name>
-        </file>
-        <file>
-          <name>USB_DEVICE/App/usbd_storage_if.c</name>
-        </file>
-        <file>
-          <name>Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c</name>
-        </file>
-        <file>
-          <name>Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c</name>
-        </file>
-        <file>
-          <name>Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c</name>
-        </file>
-        <file>
-          <name>Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc.c</name>
-        </file>
-        <file>
-          <name>Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_bot.c</name>
-        </file>
-        <file>
-          <name>Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_data.c</name>
-        </file>
-        <file>
-          <name>Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_scsi.c</name>
-        </file>
-      </filestoremove>
+      <filestoremove />
       <sourceEntriesToRemove>
         <sourceEntry />
       </sourceEntriesToRemove>
@@ -108,12 +71,7 @@
             <Aincludes>
               <include />
             </Aincludes>
-            <Cincludes>
-              <include>Middlewares/ST/STM32_USB_Device_Library/Core/Inc</include>
-              <include>Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Inc</include>
-              <include>USB_DEVICE/App</include>
-              <include>USB_DEVICE/Target</include>
-            </Cincludes>
+            <Cincludes />
           </inctoremove>
         </config>
       </configs>