Skip to content

Commit c6700e8

Browse files
NeilChen93kartben
authored andcommitted
boards: nxp: frdm_mcxa156: Support lptmr for NXP frdm_mcxa156 board
Support lptmr for NXP frdm_mcxa156 board. Test using tests/drivers/counter/counter_basic_api. Signed-off-by: Neil Chen <cheng.chen_1@nxp.com>
1 parent faba3cd commit c6700e8

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

boards/nxp/frdm_mcxa156/board.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,25 @@ static int frdm_mcxa156_init(void)
129129
CLOCK_AttachClk(kFRO12M_to_ADC0);
130130

131131
CLOCK_EnableClock(kCLOCK_GateADC0);
132+
#endif
133+
134+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lptmr0))
135+
136+
/*
137+
* Clock Select Decides what input source the lptmr will clock from
138+
*
139+
* 0 <- Reserved
140+
* 1 <- 16K FRO
141+
* 2 <- Reserved
142+
* 3 <- Combination of clocks configured in MRCC_LPTMR0_CLKSEL[MUX] field
143+
*/
144+
#if DT_PROP(DT_NODELABEL(lptmr0), clk_source) == 0x1
145+
CLOCK_SetupFRO16KClocking(kCLKE_16K_SYSTEM | kCLKE_16K_COREMAIN);
146+
#elif DT_PROP(DT_NODELABEL(lptmr0), clk_source) == 0x3
147+
CLOCK_SetClockDiv(kCLOCK_DivLPTMR0, 1u);
148+
CLOCK_AttachClk(kFRO12M_to_LPTMR0);
149+
#endif /* DT_PROP(DT_NODELABEL(lptmr0), clk_source) */
150+
132151
#endif
133152

134153
/* Set SystemCoreClock variable. */

boards/nxp/frdm_mcxa156/doc/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ The FRDM-MCXA156 board configuration supports the following hardware features:
5858
+-----------+------------+-------------------------------------+
5959
| DAC | on-chip | dac |
6060
+-----------+------------+-------------------------------------+
61+
| LPTMR | on-chip | counter |
62+
+-----------+------------+-------------------------------------+
6163
| PWM | on-chip | pwm |
6264
+-----------+------------+-------------------------------------+
6365

boards/nxp/frdm_mcxa156/frdm_mcxa156.dts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,7 @@
107107
pinctrl-0 = <&pinmux_lpadc0>;
108108
pinctrl-names = "default";
109109
};
110+
111+
&lptmr0 {
112+
status = "okay";
113+
};

boards/nxp/frdm_mcxa156/frdm_mcxa156.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ supported:
1818
- adc
1919
- flash
2020
- gpio
21+
- counter
2122
- dac
2223
- pwm
2324
vendor: nxp

0 commit comments

Comments
 (0)