Skip to content

Commit a19311f

Browse files
amvasil-vmbolivar-nordic
authored andcommitted
soc: stm32: Fix DBGMCU register write for SWO configuration
DBGMCU register, which is used for SWO pin configuration, may not have TRACE_MODE bits in some STM32 MCUs. Replace register access with LL functions selected based on SoC family. Fixes #44584 Signed-off-by: Alexander Vasiliev <[email protected]>
1 parent e7e78cb commit a19311f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

soc/arm/st_stm32/common/soc_config.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
static int st_stm32_common_config(const struct device *dev)
2727
{
2828
#ifdef CONFIG_LOG_BACKEND_SWO
29-
/* TRACE pin assignment for asynchronous mode */
30-
DBGMCU->CR &= ~DBGMCU_CR_TRACE_MODE_Msk;
31-
/* Enable the SWO pin */
32-
DBGMCU->CR |= DBGMCU_CR_TRACE_IOEN;
29+
/* Enable SWO trace asynchronous mode */
30+
#if defined(CONFIG_SOC_SERIES_STM32WBX)
31+
LL_DBGMCU_EnableTraceClock();
32+
#else
33+
LL_DBGMCU_SetTracePinAssignment(LL_DBGMCU_TRACE_ASYNCH);
3334
#endif
35+
#endif /* CONFIG_LOG_BACKEND_SWO */
3436

3537
#if defined(CONFIG_USE_SEGGER_RTT)
3638
/* On some STM32 boards, for unclear reason,

0 commit comments

Comments
 (0)