Page tree
Skip to end of metadata
Go to start of metadata

DFSDM外设(Ditial Filter for Sigma-Delta Modulator)用作通用ADC。 它得益于外部模拟前端接口和内部数字滤波器。它可以用于各种应用,如:音频录制与MEMS麦克风,能源测量与STPMS2[2]电表或电机控制。

特性:

  • Up to 8 external analog frontend serial interfaces (SPI, manchester coded single wire interface, clock output), for various sigma-delta modulators
  • Up to 8 internal digital parallel interfaces (from internal ADC[3] or memory data stream via DMA[4] or CPU)
  • Up to 6 digital filters, that offers up to 24-bit final ADC resolution
  • Conversions that can be launched continuously, or using various triggers: by software, TIM[5], LPTIM[6], EXTI[7] or synchronously with DFSDM filter 0
  • Event detectors: analog watchdog high/low thresholds, short-circuit detector, extremes detector
  • Break generation to TIM[5] on analog watchdog or short-circuit detector events


外设分配

DomainPeripheralRuntime allocationComment
InstanceCortex-A7
secure
(OP-TEE)
Cortex-A7
non-secure
(Linux)
Cortex-M4

(STM32Cube)
AnalogDFSDMDFSDM
Assignment (single choice)


下例显示了如何配置把DFSDM ADC channel 1 分配给DFSDM filter0:

  • 将PB13配置为DFSDM CLKOUT备用功能(默认为AF3,低功耗模式为ANALOG)。
  • 将PC3配置为DFSDMDATA1备用功能(默认为AF3,对于低功耗模式为ANALOG)。
  • 添加sd-modulator。
  • 配置并启用DFSDM,将channel 1配置为使用SPI(上升沿),并将其关联到filter0。
dfsdm_clkout_pins_a: dfsdm-clkout-pins-0 {
	pins {
		pinmux = <STM32_PINMUX('B', 13, AF3)>;     /* DFSDM_CKOUT */
		bias-disable;
		drive-push-pull;
		slew-rate = <1>;
	};
};

dfsdm_clkout_sleep_pins_a: dfsdm-clkout-sleep-pins-0 {
	pins {
		pinmux = <STM32_PINMUX('B', 13, ANALOG)>;  /* DFSDM_CKOUT */
	};
};

dfsdm_data1_pins_a: dfsdm-data1-pins-0 {
	pins {
		pinmux = <STM32_PINMUX('C', 3, AF3)>;      /* DFSDM_DATA1 */
	};
};

dfsdm_data1_sleep_pins_a: dfsdm-data1-sleep-pins-0 {
	pins {
		pinmux = <STM32_PINMUX('C', 3, ANALOG)>;   /* DFSDM_DATA1 */
	};
};

sd_adc1: adc-1 {
	compatible = "sd-modulator";
	#io-channel-cells = <0>;
};

&dfsdm {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&dfsdm_clkout_pins_a &dfsdm_data1_pins_a>;                        /* default pins */
	pinctrl-1 = <&dfsdm_clkout_sleep_pins_a &dfsdm_data1_sleep_pins_a>;            /* sleep pins for low-power mode */
	spi-max-frequency = <2048000>;                                                 /* desired maximum clock rate */
	status = "okay";
	dfsdm0: filter@0 {
		st,adc-channels = <1>;                                                 /* Assign channel 1 to this filter */
		st,adc-channel-names = "in1";                                          /* Give it a name */
		st,adc-channel-types = "SPI_R";                                        /* SPI data on rising edge */
		st,adc-channel-clk-src = "CLKOUT_F";                                   /* internal clock source used for conversion */
		io-channels = <&sd_adc1>;                                              /* phandle to the external sd-modulator */
		st,filter-order = <1>;
		status = "okay";
	};
};
  • No labels