2

elinux.org上提到,可以通过更改设备树中引脚的方向并添加以下行来使 D0 成为 SPI1 的输出和 D1 的输入:

ti,pindir-d0-out-d1-in = <1>;

我尝试应用相同的方法,但使用 SPI0,但它似乎不起作用。我正在使用可能存在其他干扰问题的原型 PCB。

有人可以确认/否认相同的方法适用于 SPI0 来交换其各自的 D0 和 D1 吗?

谢谢!

4

3 回答 3

2

我已经在 SPI0 上对其进行了测试,它也可以正常工作

例如我在 am33xx.dtsi 中进行了更改(内核 3.8 后不支持 dts 覆盖)

 spi0: spi@48030000 {
        compatible = "ti,omap4-mcspi";
        #address-cells = <1>;
        #size-cells = <0>;
        reg = <0x48030000 0x400>;
        interrupts = <65>;
        ti,spi-num-cs = <2>;
        ti,hwmods = "spi0";
        //added to swap d0 and d1 in spi0
        ti,pindir-d0-out-d1-in = <1>;
        dmas = <&edma 16
            &edma 17
            &edma 18
            &edma 19>;
        dma-names = "tx0", "rx0", "tx1", "rx1";
        status = "disabled";
    };
于 2015-04-19T12:53:14.813 回答
0

我已经使用 spidev_test 环回程序测试了这种方法,结果与未更改的固件相同。我认为我还有其他需要解决的 SPI 问题。

以下是“倒置”BB-SPIDEV0-00A0.dts 的来源:

/*
 * Copyright (C) 2013 CircuitCo
 *
 * Virtual cape for SPI0 on connector pins P9.22 P9.21 P9.18 P9.17
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
/dts-v1/;
/plugin/;

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";

    /* identification */
    part-number = "BB-SPI0";
    version = "00A0";

    /* state the resources this cape uses */
    exclusive-use =
        /* the pin header uses */
        "P9.17",    /* spi0_cs0 */
        "P9.18",    /* spi0_d1 */
        "P9.21",    /* spi0_d0 */
        "P9.22",    /* spi0_sclk */
        /* the hardware ip uses */
        "spi0";

    fragment@0 {
        target = <&am33xx_pinmux>;
        __overlay__ {
            /* default state has all gpios released and mode set to uart1 */
            bb_spi0_pins: pinmux_bb_spi0_pins {
                pinctrl-single,pins = <
                    0x150 0x30  /* spi0_sclk.spi0_sclk, INPUT_PULLUP | MODE0 */
                    0x154 0x10  /* spi0_d0.spi0_d0, OUTPUT_PULLUP | MODE0 */
                    0x158 0x30  /* spi0_d1.spi0_d1, INPUT_PULLUP | MODE0 */
                    0x15c 0x10  /* spi0_cs0.spi0_cs0, OUTPUT_PULLUP | MODE0 */
                >;
            };
        };
    };

    fragment@1 {
        target = <&spi0>;   /* spi0 is numbered correctly */
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;

            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <&bb_spi0_pins>;
            ti,pindir-d0-out-d1-in = <1>;


            channel@0 {
                #address-cells = <1>;
                #size-cells = <0>;

                compatible = "spidev";

                reg = <0>;
                spi-max-frequency = <16000000>;
                spi-cpha;
            };


            channel@1 {
                #address-cells = <1>;
                #size-cells = <0>;

                compatible = "spidev";

                reg = <1>;
                spi-max-frequency = <16000000>;
            };
        };
    };
};
于 2014-08-20T15:47:24.420 回答
-2

您所指的文档仅讨论 SPI1 D0 和 D1 引脚交换。

据我所知,引脚交换在 SPI0 上不可用,仅在 SPI1 上可用。

于 2014-10-04T07:19:30.643 回答