@@ -120,19 +120,25 @@ extern "C" {
120120
121121WEAK void initVariant (void )
122122{
123- /* Initialize the 3V3 discharge to be OFF and the output power to be ON */
124- __HAL_RCC_GPIOE_CLK_ENABLE ();
123+
125124 GPIO_InitTypeDef GPIO_InitStruct;
126- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
125+ __HAL_RCC_GPIOE_CLK_ENABLE ();
126+ __HAL_RCC_GPIOC_CLK_ENABLE ();
127+
128+ /* Set the DISCHARGE pin and the USB_DETECT pin to FLOAT */
129+ GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
127130 GPIO_InitStruct.Pull = GPIO_NOPULL;
128- GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
129131 GPIO_InitStruct.Pin = GPIO_PIN_6;
130- HAL_GPIO_Init (GPIOE, &GPIO_InitStruct);
131- HAL_GPIO_WritePin (GPIOE, GPIO_PIN_6, GPIO_PIN_SET);
132+ HAL_GPIO_Init (GPIOE, &GPIO_InitStruct); /* PE6 DISCHRG */
133+ HAL_GPIO_Init (GPIOC, &GPIO_InitStruct); /* PC6 is USB_DETECT */
134+
135+ /* Turn on the 3V3 regulator */
132136 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
137+ GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
133138 GPIO_InitStruct.Pin = GPIO_PIN_4;
134139 HAL_GPIO_Init (GPIOE, &GPIO_InitStruct);
135140 HAL_GPIO_WritePin (GPIOE, GPIO_PIN_4, GPIO_PIN_SET);
141+
136142}
137143
138144/* *
0 commit comments