Skip to content

Commit f7b2638

Browse files
aaronyegxnashif
authored andcommitted
soc: ambiq: enable the TPIU clock source
This commit enables the TPIU clock source in Apollo3 and Apollo4 soc initialization if LOG_BACKEND_SWO is used. Signed-off-by: Aaron Ye <[email protected]>
1 parent fe3c0ec commit f7b2638

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

soc/ambiq/apollo3x/soc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,10 @@ void soc_early_init_hook(void)
2828
#ifdef CONFIG_PM
2929
ambiq_power_init();
3030
#endif
31+
32+
#ifdef CONFIG_LOG_BACKEND_SWO
33+
/* Select HFRC/8 (6MHz) for the TPIU clock source */
34+
MCUCTRL->TPIUCTRL_b.CLKSEL = MCUCTRL_TPIUCTRL_CLKSEL_HFRCDIV8;
35+
MCUCTRL->TPIUCTRL_b.ENABLE = MCUCTRL_TPIUCTRL_ENABLE_EN;
36+
#endif
3137
}

soc/ambiq/apollo4x/soc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,10 @@ void soc_early_init_hook(void)
2323
#ifdef CONFIG_PM
2424
ambiq_power_init();
2525
#endif
26+
27+
#ifdef CONFIG_LOG_BACKEND_SWO
28+
/* Select HFRC 48MHz for the TPIU clock source */
29+
MCUCTRL->DBGCTRL_b.CM4CLKSEL = MCUCTRL_DBGCTRL_CM4CLKSEL_HFRC48;
30+
MCUCTRL->DBGCTRL_b.CM4TPIUENABLE = MCUCTRL_DBGCTRL_CM4TPIUENABLE_EN;
31+
#endif
2632
}

0 commit comments

Comments
 (0)