am335x-bone-common.dtsi中添加
spi1_pins_default: spi1_pins_default { pinctrl-single,pins = < AM33XX_IOPAD(0x990, PIN_INPUT_PULLUP | MUX_MODE3) /* (A13) mcasp0_aclkx.spi1_sclk */ AM33XX_IOPAD(0x994, PIN_INPUT_PULLUP | MUX_MODE3) /* (B13) mcasp0_fsx.spi1_d0 */ AM33XX_IOPAD(0x998, PIN_OUTPUT_PULLUP | MUX_MODE3) /* (D12) mcasp0_axr0.spi1_d1 */ AM33XX_IOPAD(0x99c, PIN_OUTPUT_PULLUP | MUX_MODE3) /* (C12) mcasp0_ahclkr.spi1_cs0 */ >; };
&spi1 { #address-cells = <1>; #size-cells = <0>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&spi1_pins_default>; channel@0 { #address-cells = <1>; #size-cells = <0>; compatible = "spidev"; reg = <0>; spi-max-frequency = <16000000>; spi-cpha; }; };
编译好后,进入系统,dmesg显示spi1的pinctrl占用了macsp的管脚,注册了spidev1.0设备,短接D0和D1
./spifdv_test -D /dev/spidev1.0
该命令只打印出spi1的mode,发送模式和工作频率,并没有发送数据的过程
sjl3110:
急急急急急急
yongqing wang:
回复 sjl3110:
spitest 有比较多的配置参数
yongqing wang:
回复 yongqing wang:
加个 -h看看
Shine:
回复 sjl3110:
请问有量过SPI管脚的时序吗?
Shine:
回复 Shine:
把SPI管脚都设成PIN_INPUT模式。AM33XX_IOPAD(0x998, PIN_OUTPUT_PULLUP | MUX_MODE3) /* (D12) mcasp0_axr0.spi1_d1 */AM33XX_IOPAD(0x99c, PIN_OUTPUT_PULLUP | MUX_MODE3) /* (C12) mcasp0_ahclkr.spi1_cs0 */