Skip to content

Commit 5a51fe5

Browse files
FRASTMnashif
authored andcommitted
soc: arm: stm32g0 with USB-C PD cannot use CC1 and CC2 pins by default
With this patch, the UCPD1 _CC1 and _CC2 pins are disabling the USB Type-C and Power Delivery Dead Battery. Signed-off-by: Francois Ramu <[email protected]>
1 parent 9e30ab5 commit 5a51fe5

File tree

1 file changed

+10
-0
lines changed
  • soc/arm/st_stm32/stm32g0

1 file changed

+10
-0
lines changed

soc/arm/st_stm32/stm32g0/soc.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
#include <arch/arm/aarch32/cortex_m/cmsis.h>
1717
#include <linker/linker-defs.h>
1818
#include <string.h>
19+
#if defined(SYSCFG_CFGR1_UCPD1_STROBE) || defined(SYSCFG_CFGR1_UCPD2_STROBE)
20+
#include <stm32_ll_system.h>
21+
#include <stm32_ll_bus.h>
22+
#endif /* SYSCFG_CFGR1_UCPD1_STROBE || SYSCFG_CFGR1_UCPD2_STROBE */
1923

2024
/**
2125
* @brief Perform basic hardware initialization at boot.
@@ -44,6 +48,12 @@ static int stm32g0_init(const struct device *arg)
4448
/* At reset, system core clock is set to 16 MHz from HSI */
4549
SystemCoreClock = 16000000;
4650

51+
#if defined(SYSCFG_CFGR1_UCPD1_STROBE) || defined(SYSCFG_CFGR1_UCPD2_STROBE)
52+
/* Disable the internal Pull-Up in Dead Battery pins of UCPD peripheral */
53+
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG);
54+
LL_SYSCFG_DisableDBATT(LL_SYSCFG_UCPD1_STROBE | LL_SYSCFG_UCPD2_STROBE);
55+
#endif /* SYSCFG_CFGR1_UCPD1_STROBE || SYSCFG_CFGR1_UCPD2_STROBE */
56+
4757
return 0;
4858
}
4959

0 commit comments

Comments
 (0)