Skip to content

Commit 6704f0c

Browse files
committed
board: frdm_mcxn236: Enable MICFIL on frdm_mcxn236
1. Enable MICFIL on frdm_mcxn236 board. 2. MICFIL CLOCK and DATA Pins are conflict with flexcomm0_lpuart pins, so change flexcomm0_lpuart pins to 'FC0_P2_PIO0_6' and 'FC0_P3_PIO0_7'. Signed-off-by: Zhaoxiang Jin <[email protected]>
1 parent 1f0dbb4 commit 6704f0c

File tree

4 files changed

+78
-7
lines changed

4 files changed

+78
-7
lines changed

boards/nxp/frdm_mcxn236/board.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 NXP
2+
* Copyright 2024-2025 NXP
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
#include <zephyr/init.h>
@@ -103,20 +103,23 @@ void board_early_init_hook(void)
103103

104104
CLOCK_SetupExtClocking(BOARD_XTAL0_CLK_HZ);
105105

106-
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sai0)) || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sai1))
106+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sai0)) || \
107+
DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sai1)) || \
108+
DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(micfil))
107109
/* < Set up PLL1 */
108110
const pll_setup_t pll1_Setup = {
109111
.pllctrl = SCG_SPLLCTRL_SOURCE(1U) | SCG_SPLLCTRL_SELI(3U) |
110112
SCG_SPLLCTRL_SELP(1U),
111113
.pllndiv = SCG_SPLLNDIV_NDIV(25U),
112114
.pllpdiv = SCG_SPLLPDIV_PDIV(10U),
113115
.pllmdiv = SCG_SPLLMDIV_MDIV(256U),
114-
.pllRate = 24576000U};
116+
.pllRate = 24576000U
117+
};
115118

116119
/* Configure PLL1 to the desired values */
117120
CLOCK_SetPLL1Freq(&pll1_Setup);
118-
/* Set PLL1 CLK0 divider to value 1 */
119-
CLOCK_SetClkDiv(kCLOCK_DivPLL1Clk0, 1U);
121+
/* Set PLL1 CLK0 divider to value 2, then the clock is 12288000Hz. */
122+
CLOCK_SetClkDiv(kCLOCK_DivPLL1Clk0, 2U);
120123
#endif
121124

122125
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm0))
@@ -160,6 +163,7 @@ void board_early_init_hook(void)
160163

161164
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0))
162165
CLOCK_EnableClock(kCLOCK_Gpio0);
166+
CLOCK_EnableClock(kCLOCK_Port0);
163167
#endif
164168

165169
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1))
@@ -339,6 +343,15 @@ void board_early_init_hook(void)
339343
CLOCK_EnableClock(kCLOCK_Sai1);
340344
#endif
341345

346+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(micfil), okay)
347+
CLOCK_SetClkDiv(kCLOCK_DivMicfilFClk, 1U);
348+
CLOCK_AttachClk(kPLL1_CLK0_to_MICFILF);
349+
CLOCK_EnableClock(kCLOCK_Micfil);
350+
351+
PORT0->PCR[16] = 0x00001900;
352+
PORT0->PCR[17] = 0x00001900;
353+
#endif
354+
342355
/* Set SystemCoreClock variable. */
343356
SystemCoreClock = CLOCK_INIT_CORE_CLOCK;
344357
}

boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
&pinctrl {
99
pinmux_flexcomm0_lpuart: pinmux_flexcomm0_lpuart {
1010
group0 {
11-
pinmux = <FC0_P0_PIO0_16>,
12-
<FC0_P1_PIO0_17>;
11+
pinmux = <FC0_P2_PIO0_6>,
12+
<FC0_P3_PIO0_7>;
1313
slew-rate = "fast";
1414
drive-strength = "low";
1515
input-enable;
@@ -246,4 +246,14 @@
246246
drive-open-drain;
247247
};
248248
};
249+
250+
pinmux_micfil: pinmux_micfil {
251+
group0 {
252+
pinmux = <PDM0_CLK_PIO0_16>,
253+
<PDM0_DATA0_PIO0_17>;
254+
drive-strength = "high";
255+
slew-rate = "fast";
256+
input-enable;
257+
};
258+
};
249259
};

boards/nxp/frdm_mcxn236/frdm_mcxn236.dts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,3 +441,9 @@ dvp_20pin_interface: &video_sdma {};
441441
pinctrl-0 = <&pinmux_sai1>;
442442
pinctrl-names = "default";
443443
};
444+
445+
&micfil {
446+
status = "okay";
447+
pinctrl-0 = <&pinmux_micfil>;
448+
pinctrl-names = "default";
449+
};

dts/arm/nxp/nxp_mcxn23x_common.dtsi

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,48 @@
985985
nxp,rx-dma-channel = <3>;
986986
status = "disabled";
987987
};
988+
989+
micfil: micfil@10c000 {
990+
compatible = "nxp,micfil";
991+
#address-cells = <1>;
992+
#size-cells = <0>;
993+
interrupts = <48 0>;
994+
reg = <0x10c000 0x1000>;
995+
clocks = <&syscon MCUX_MICFIL_CLK>;
996+
status = "disabled";
997+
quality-mode = <1>;
998+
cic-decimation-rate = <0>;
999+
fifo-watermark = <15>;
1000+
sample-rate = <16000>;
1001+
1002+
channel0: micfil-channel@0 {
1003+
reg = <0>;
1004+
status = "disabled";
1005+
dc-remover-cutoff-freq = <2>;
1006+
decimation-filter-gain = <4>;
1007+
};
1008+
1009+
channel1: micfil-channel@1 {
1010+
reg = <1>;
1011+
status = "disabled";
1012+
dc-remover-cutoff-freq = <2>;
1013+
decimation-filter-gain = <4>;
1014+
};
1015+
1016+
channel2: micfil-channel@2 {
1017+
reg = <2>;
1018+
status = "disabled";
1019+
dc-remover-cutoff-freq = <2>;
1020+
decimation-filter-gain = <4>;
1021+
};
1022+
1023+
channel3: micfil-channel@3 {
1024+
reg = <3>;
1025+
status = "disabled";
1026+
dc-remover-cutoff-freq = <2>;
1027+
decimation-filter-gain = <4>;
1028+
};
1029+
};
9881030
};
9891031

9901032
&systick {

0 commit comments

Comments
 (0)