Skip to content

Commit

Permalink
Merge pull request #6912 from bkleiner/bkleiner_h7_enable_usb_voltage…
Browse files Browse the repository at this point in the history
…_detect

h7: fix vcp on cold boot & dfu reset
  • Loading branch information
DzikuVx committed May 3, 2021
2 parents 350345d + b8485f6 commit 18755bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/main/drivers/serial_usb_vcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ void usbVcpInitHardware(void)

/* Start Device Process */
USBD_Start(&USBD_Device);

#ifdef STM32H7
HAL_PWREx_EnableUSBVoltageDetector();
delay(100); // Cold boot failures observed without this, even when USB cable is not connected
#endif

#else
Set_System();
Set_USBClock();
Expand Down
7 changes: 5 additions & 2 deletions src/main/drivers/system_stm32h7xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ bool isMPUSoftReset(void)
return false;
}

#define SYSMEMBOOT_VECTOR_TABLE ((uint32_t *)0x1ff09800)
uint32_t systemBootloaderAddress(void)
{
return SYSMEMBOOT_VECTOR_TABLE[1];
#if defined(STM32H743xx) || defined(STM32H750xx) || defined(STM32H723xx) || defined(STM32H725xx)
return 0x1ff09800;
#else
#error Unknown MCU
#endif
}

void systemClockSetup(uint8_t cpuUnderclock)
Expand Down

0 comments on commit 18755bd

Please sign in to comment.