-
Notifications
You must be signed in to change notification settings - Fork 8k
Enable i2s_codec sample on mcxn5xx_evk #96954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
3919bdb
542bfb4
89451d2
2c9d813
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,14 +18,16 @@ | |
#define BOARD_USB_PHY_TXCAL45DM (0x07U) | ||
|
||
usb_phy_config_struct_t usbPhyConfig = { | ||
BOARD_USB_PHY_D_CAL, BOARD_USB_PHY_TXCAL45DP, BOARD_USB_PHY_TXCAL45DM, | ||
BOARD_USB_PHY_D_CAL, | ||
BOARD_USB_PHY_TXCAL45DP, | ||
BOARD_USB_PHY_TXCAL45DM, | ||
}; | ||
#endif | ||
|
||
/* Board xtal frequency in Hz */ | ||
#define BOARD_XTAL0_CLK_HZ 24000000U | ||
#define BOARD_XTAL0_CLK_HZ 24000000U | ||
/* Core clock frequency: 150MHz */ | ||
#define CLOCK_INIT_CORE_CLOCK 150000000U | ||
#define CLOCK_INIT_CORE_CLOCK 150000000U | ||
/* System clock frequency. */ | ||
extern uint32_t SystemCoreClock; | ||
|
||
|
@@ -34,21 +36,21 @@ void power_mode_od(void) | |
{ | ||
/* Set the DCDC VDD regulator to 1.2 V voltage level */ | ||
spc_active_mode_dcdc_option_t opt = { | ||
.DCDCVoltage = kSPC_DCDC_OverdriveVoltage, | ||
.DCDCVoltage = kSPC_DCDC_OverdriveVoltage, | ||
.DCDCDriveStrength = kSPC_DCDC_NormalDriveStrength, | ||
}; | ||
SPC_SetActiveModeDCDCRegulatorConfig(SPC0, &opt); | ||
|
||
/* Set the LDO_CORE VDD regulator to 1.2 V voltage level */ | ||
spc_active_mode_core_ldo_option_t ldo_opt = { | ||
.CoreLDOVoltage = kSPC_CoreLDO_OverDriveVoltage, | ||
.CoreLDOVoltage = kSPC_CoreLDO_OverDriveVoltage, | ||
.CoreLDODriveStrength = kSPC_CoreLDO_NormalDriveStrength, | ||
}; | ||
SPC_SetActiveModeCoreLDORegulatorConfig(SPC0, &ldo_opt); | ||
|
||
/* Specifies the 1.2V operating voltage for the SRAM's read/write timing margin */ | ||
spc_sram_voltage_config_t cfg = { | ||
.operateVoltage = kSPC_sramOperateAt1P2V, | ||
.operateVoltage = kSPC_sramOperateAt1P2V, | ||
.requestVoltageUpdate = true, | ||
}; | ||
SPC_SetSRAMOperateVoltage(SPC0, &cfg); | ||
|
@@ -115,14 +117,12 @@ void board_early_init_hook(void) | |
#endif | ||
|
||
/* Set up PLL0 */ | ||
const pll_setup_t pll0Setup = { | ||
.pllctrl = SCG_APLLCTRL_SOURCE(1U) | SCG_APLLCTRL_SELI(27U) | | ||
SCG_APLLCTRL_SELP(13U), | ||
.pllndiv = SCG_APLLNDIV_NDIV(8U), | ||
.pllpdiv = SCG_APLLPDIV_PDIV(1U), | ||
.pllmdiv = SCG_APLLMDIV_MDIV(50U), | ||
.pllRate = 150000000U | ||
}; | ||
const pll_setup_t pll0Setup = {.pllctrl = SCG_APLLCTRL_SOURCE(1U) | SCG_APLLCTRL_SELI(27U) | | ||
SCG_APLLCTRL_SELP(13U), | ||
.pllndiv = SCG_APLLNDIV_NDIV(8U), | ||
.pllpdiv = SCG_APLLPDIV_PDIV(1U), | ||
.pllmdiv = SCG_APLLMDIV_MDIV(50U), | ||
.pllRate = 150000000U}; | ||
/* Configure PLL0 to the desired values */ | ||
CLOCK_SetPLL0Freq(&pll0Setup); | ||
/* PLL0 Monitor is disabled */ | ||
|
@@ -136,20 +136,20 @@ void board_early_init_hook(void) | |
|
||
CLOCK_SetupExtClocking(BOARD_XTAL0_CLK_HZ); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if you can enable them in separate patches? If one of them breaks the system one of them would have a hard time doing a bisection. Please use 1 commit per a logical change so that code can be easier to be reviewed and also bisection and debugging in the future be easier. |
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sai0)) || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sai1)) | ||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sai0)) || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sai1)) || \ | ||
DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(micfil)) | ||
/* < Set up PLL1 */ | ||
const pll_setup_t pll1_Setup = { | ||
.pllctrl = SCG_SPLLCTRL_SOURCE(1U) | SCG_SPLLCTRL_SELI(3U) | | ||
SCG_SPLLCTRL_SELP(1U), | ||
.pllndiv = SCG_SPLLNDIV_NDIV(25U), | ||
.pllpdiv = SCG_SPLLPDIV_PDIV(10U), | ||
.pllmdiv = SCG_SPLLMDIV_MDIV(256U), | ||
.pllRate = 24576000U}; | ||
const pll_setup_t pll1_Setup = {.pllctrl = SCG_SPLLCTRL_SOURCE(1U) | SCG_SPLLCTRL_SELI(3U) | | ||
SCG_SPLLCTRL_SELP(1U), | ||
.pllndiv = SCG_SPLLNDIV_NDIV(25U), | ||
.pllpdiv = SCG_SPLLPDIV_PDIV(10U), | ||
.pllmdiv = SCG_SPLLMDIV_MDIV(256U), | ||
.pllRate = 24576000U}; | ||
|
||
/* Configure PLL1 to the desired values */ | ||
CLOCK_SetPLL1Freq(&pll1_Setup); | ||
/* Set PLL1 CLK0 divider to value 1 */ | ||
CLOCK_SetClkDiv(kCLOCK_DivPLL1Clk0, 1U); | ||
CLOCK_SetClkDiv(kCLOCK_DivPLL1Clk0, 2U); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm0)) | ||
|
@@ -213,6 +213,7 @@ void board_early_init_hook(void) | |
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) | ||
CLOCK_EnableClock(kCLOCK_Gpio0); | ||
CLOCK_EnableClock(kCLOCK_Port0); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) | ||
|
@@ -355,8 +356,8 @@ void board_early_init_hook(void) | |
while (0U == (SCG0->LDOCSR & SCG_LDOCSR_VOUT_OK_MASK)) { | ||
}; | ||
} | ||
SYSCON->AHBCLKCTRLSET[2] |= SYSCON_AHBCLKCTRL2_USB_HS_MASK | | ||
SYSCON_AHBCLKCTRL2_USB_HS_PHY_MASK; | ||
SYSCON->AHBCLKCTRLSET[2] |= | ||
SYSCON_AHBCLKCTRL2_USB_HS_MASK | SYSCON_AHBCLKCTRL2_USB_HS_PHY_MASK; | ||
SCG0->SOSCCFG &= ~(SCG_SOSCCFG_RANGE_MASK | SCG_SOSCCFG_EREFS_MASK); | ||
/* xtal = 20 ~ 30MHz */ | ||
SCG0->SOSCCFG = (1U << SCG_SOSCCFG_RANGE_SHIFT) | (1U << SCG_SOSCCFG_EREFS_SHIFT); | ||
|
@@ -366,8 +367,8 @@ void board_early_init_hook(void) | |
break; | ||
} | ||
} | ||
SYSCON->CLOCK_CTRL |= SYSCON_CLOCK_CTRL_CLKIN_ENA_MASK | | ||
SYSCON_CLOCK_CTRL_CLKIN_ENA_FM_USBH_LPT_MASK; | ||
SYSCON->CLOCK_CTRL |= | ||
SYSCON_CLOCK_CTRL_CLKIN_ENA_MASK | SYSCON_CLOCK_CTRL_CLKIN_ENA_FM_USBH_LPT_MASK; | ||
CLOCK_EnableClock(kCLOCK_UsbHs); | ||
CLOCK_EnableClock(kCLOCK_UsbHsPhy); | ||
CLOCK_EnableUsbhsPhyPllClock(kCLOCK_Usbphy480M, BOARD_XTAL0_CLK_HZ); | ||
|
@@ -450,6 +451,15 @@ void board_early_init_hook(void) | |
CLOCK_EnableClock(kCLOCK_Sai1); | ||
#endif | ||
|
||
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(micfil)) | ||
CLOCK_SetClkDiv(kCLOCK_DivMicfilFClk, 1U); | ||
CLOCK_AttachClk(kPLL1_CLK0_to_MICFILF); | ||
CLOCK_EnableClock(kCLOCK_Micfil); | ||
|
||
PORT0->PCR[16] = 0x00001900; | ||
PORT0->PCR[17] = 0x00001900; | ||
#endif | ||
|
||
/* Set SystemCoreClock variable. */ | ||
SystemCoreClock = CLOCK_INIT_CORE_CLOCK; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2025 NXP | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commit message body is not giving us any extra info. We should try to use more of a natural language description of what the change is about focusing mostly on why the change is needed. Also mention in the commit message things that are out of the ordinary which people reading the git log history might want to be aware about. Commit title is nice and clear mostly saying what we need to now. So, the commit message should look something like this:
Signed-off-by: Tomas Barak [email protected]
|
||
|
||
CONFIG_DMA_TCD_QUEUE_SIZE=4 | ||
CONFIG_AUDIO_CODEC_DA7212=y | ||
CONFIG_SAMPLE_FREQ=16000 | ||
CONFIG_I2S_INIT_BUFFERS=1 | ||
CONFIG_USE_CODEC_CLOCK=y | ||
CONFIG_USE_DMIC=y | ||
CONFIG_DMIC_CHANNELS=2 | ||
CONFIG_EXTRA_BLOCKS=10 | ||
CONFIG_SAMPLE_WIDTH=32 | ||
CONFIG_BYTES_PER_SAMPLE=4 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright 2025 NXP | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/ { | ||
aliases { | ||
i2s-codec-tx = &sai1; | ||
i2s-tx = &sai1; | ||
}; | ||
}; | ||
|
||
&sai1 { | ||
mclk-output; | ||
}; | ||
|
||
dmic_dev: &micfil { | ||
channel0: micfil-channel@0 { | ||
status = "okay"; | ||
}; | ||
|
||
channel1: micfil-channel@1 { | ||
status = "okay"; | ||
}; | ||
}; |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A commit message should be focused on why the changes is needed and less on what is does. What it does should be somehow obvious from the code (if it is not then explain it briefly in the commit message).
So here your commit message should be something like this:
If those were detected by a tool (e.g checkpatch.pl) please also mention this in the commit message.
Also, this change can be marked as trivial sent in a different PR and merged faster your if current PR is delayed by some dependencies.