Skip to content
Snippets Groups Projects
Commit ac100387 authored by David Sidrane's avatar David Sidrane Committed by Lorenz Meier
Browse files

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.
parent 6f973f1d
No related branches found
No related tags found
No related merge requests found
......@@ -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
}
/************************************************************************************
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment