Files
zephyr_dsp/boards/nucleo_g474re.overlay

69 lines
1.7 KiB
Plaintext

/ {
aliases {
/* alias used by DT_ALIAS(led0) in app code */
led0 = &ld2;
};
/* simple gpio-leds node */
leds {
compatible = "gpio-leds";
ld2: led_0 {
gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>; // LD2 -> PA5
label = "LD2";
};
};
};
&gpioa {
status = "okay";
};
&gpioc {
status = "okay";
};
/* ── Audio ADC ─────────────────────────────────────────
*
* ADC1 is already enabled by the board DTS with:
* - pinctrl on PA0 (ADC1_IN1) — Arduino header A0
* - SYNC clock, prescaler /4 → 42.5 MHz ADC clock
*
* We just add the channel config here.
*
* Conversion time = (641 + 12.5) / 42.5 MHz = 15.4 µs
* Max sample rate ≈ 65 kHz — plenty for 44.1 kHz
* Actual 44.1 kHz rate is set by a timer in code.
*/
&adc1 {
#address-cells = <1>;
#size-cells = <0>;
channel@1 {
reg = <1>; // IN1 = PA0
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_TICKS, 641)>;
zephyr,resolution = <12>;
};
};
/* ── TIM6 — ADC sample clock ─────────────────────────
*
* Basic timer, no PWM/capture — just counting.
* TRGO output triggers ADC1 conversions.
*
* Timer clock = 170 MHz (APB1, no prescaler)
* ARR = (170,000,000 / 44,100) - 1 = 3854
* Actual rate = 170,000,000 / 3855 = ~44,099 Hz
*
* Trigger routing (TIM6_TRGO → ADC1) is done in code
* via STM32 LL/HAL — devicetree just enables the clock.
*/
&timers6 {
status = "okay";
st,prescaler = <0>;
counter {
status = "okay";
};
};