From 3f11266838bdeab12f7bfb101a93267d8768117b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20J=C3=A4ger?= Date: Thu, 11 Mar 2021 14:20:21 +0100 Subject: [PATCH] Disable pull-down on PB4 and PB6 for STM32G4 MCUs This pull-down caused issues with the latching power-good function in a board which required PB6 to be configured as an input. --- src/setup.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/setup.cpp b/src/setup.cpp index 25b00c8..68492ba 100644 --- a/src/setup.cpp +++ b/src/setup.cpp @@ -85,6 +85,7 @@ uint32_t timestamp; #ifndef UNIT_TEST #include +#include static inline void timestamp_inc(struct k_timer *timer_id) { @@ -104,6 +105,11 @@ void setup() */ void *temp = k_malloc(4); k_free(temp); + +#ifdef CONFIG_SOC_SERIES_STM32G4X + // disable 5k pull-down required for USB-C PD on PB4 and PB6 so that they can be used as inputs + PWR->CR3 |= PWR_CR3_UCPD_DBDIS; +#endif } #endif