From 6a7ca81e4f593832ff0335d267ab007bd200a6bf Mon Sep 17 00:00:00 2001 From: Luke Harrison Date: Mon, 29 Jan 2024 16:53:49 +0200 Subject: [PATCH] stm32g0.c: Disable UCPD on boot The UCPD is not used with Katapult but it can result in unexpected behaviour on certain pins due to the internal pull resistors unless disabled. Signed-off-by: Luke Harrison looxonline@gmail.com --- src/stm32/stm32g0.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/stm32/stm32g0.c b/src/stm32/stm32g0.c index 41f7f6f..5802038 100644 --- a/src/stm32/stm32g0.c +++ b/src/stm32/stm32g0.c @@ -145,6 +145,8 @@ bootloader_request(void) void armcm_main(void) { + // Disable internal pull-down resistors on UCPDx CCx pins + SYSCFG->CFGR1 |= (SYSCFG_CFGR1_UCPD1_STROBE | SYSCFG_CFGR1_UCPD2_STROBE); SCB->VTOR = (uint32_t)VectorTable; // Reset clock registers (in case bootloader has changed them)