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

PanGu开发板的J25扩展座上引出了两个SPI控制器,可以用于连接两个LoRa模块,实现P2P收发测试。

以下是J25扩展座上的SPI1和SPI2配置

PanGu FunctionPin NamePin NumberPin NumberPin NamePanGu Function

5V123.3V

5V34GND

PB556USB_DM

PB1378USB_DP

GND910GND

ANA11112PZ4

ANA01314PZ2SPI1_MOSI

GND1516PZ0SPI1_SCK

PZ71718PI1SPI2_SCK

PZ61920PZ5
SPI1_SSPZ32122GND

GND2324PI3SPI2_MOSI

PH132526PI0SPI2_SS

PI92728PI2SPI2_MISO

GND2930PZ1SPI1_MISO


DTS配置代码如下:

&pinctrl {

	spi2_pins_a: spi2-0 {
		pins1 {
			pinmux = <STM32_PINMUX('I', 1, AF5)>, /* SPI2_SCK */
				 <STM32_PINMUX('I', 3, AF5)>; /* SPI2_MOSI */
			bias-disable;
			drive-push-pull;
			slew-rate = <1>;
		};

		pins2 {
			pinmux = <STM32_PINMUX('I', 2, AF5)>; /* SPI2_MISO */
			bias-disable;
		};
	};

	spi2_sleep_pins_a: spi4-sleep-0 {
		pins {
			pinmux = <STM32_PINMUX('I', 1, ANALOG)>, /* SPI4_SCK */
				 <STM32_PINMUX('I', 2, ANALOG)>, /* SPI4_MISO */
				 <STM32_PINMUX('I', 3, ANALOG)>; /* SPI4_MOSI */
		};
	};
};


&spi1 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&spi1_pins_a>;
	pinctrl-1 = <&spi1_sleep_pins_a>;
	//cs-gpios = <&gpioz 3 0>;
	cs-gpios = <&gpioi 0 0>;
	status = "okay";

	spidev@0 {
		compatible = "spidev";
		reg = <0>;
		spi-max-frequency = <5000000>;
	};
};

&spi2 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&spi2_pins_a>;
	pinctrl-1 = <&spi2_sleep_pins_a>;
	cs-gpios = <&gpioi 0 0>;
	status = "disabled";

	spidev@0 {
		compatible = "spidev";
		reg = <0>;
		spi-max-frequency = <5000000>;
	};
};
  • No labels