Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h7: fix vcp on cold boot & dfu reset #6912

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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