mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 12:03:33 +08:00
USB Fix:iForce Soft Disconnect
The STM32F404 OTG FS has an internal soft pull-up. The HW also has one too. So we need to overcome it to force a soft disconnect.
This commit is contained in:
committed by
Lorenz Meier
parent
6f973f1d6c
commit
ac1003875a
@@ -154,6 +154,10 @@ __EXPORT void stm32_boardinitialize(void)
|
||||
stm32_configgpio(GPIO_ADC1_IN10);
|
||||
|
||||
|
||||
/* configure USB interfaces */
|
||||
|
||||
stm32_usbinitialize();
|
||||
|
||||
/* configure SPI interfaces */
|
||||
|
||||
stm32_spiinitialize();
|
||||
|
||||
@@ -55,6 +55,10 @@
|
||||
#include "up_arch.h"
|
||||
#include "stm32.h"
|
||||
#include "board_config.h"
|
||||
#include "stm32_otgfs.h"
|
||||
|
||||
#define GPIO_DP (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN12)
|
||||
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
@@ -78,13 +82,31 @@
|
||||
|
||||
__EXPORT void stm32_usbinitialize(void)
|
||||
{
|
||||
/* The OTG FS has an internal soft pull-up */
|
||||
/* The OTG FS has an internal soft pull-up.
|
||||
* The HW also has one too. So we need to overcome it.
|
||||
* to force a soft disconnect.
|
||||
*/
|
||||
|
||||
/* Issue the Reset to the OTGFS Block */
|
||||
|
||||
uint32_t regval = getreg32(STM32_RCC_AHB2RSTR);
|
||||
regval |= RCC_AHB2RSTR_OTGFSRST;
|
||||
putreg32(regval, STM32_RCC_AHB2RSTR);
|
||||
|
||||
/* Drive the DP Pin Low */
|
||||
|
||||
stm32_configgpio(GPIO_DP);
|
||||
|
||||
/* Release the Reset to the OTGFS Block */
|
||||
|
||||
regval &= ~RCC_AHB2RSTR_OTGFSRST;
|
||||
|
||||
putreg32(regval, STM32_RCC_AHB2RSTR);
|
||||
|
||||
|
||||
/* Configure the OTG FS VBUS sensing GPIO */
|
||||
|
||||
#ifdef CONFIG_STM32_OTGFS
|
||||
px4_arch_configgpio(GPIO_OTGFS_VBUS);
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user