This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3358: BBone Can't Receive Data from SPI0/D0

Part Number: AM3358

Ubuntu 18.04

SDK 7.03

Test Platform  : BBone Black SPI0 <---> Aardvark(SPI Tool)

App : spidev_test.c

I run spidev_test.(REF : 3.2.4.12. SPI — Processor SDK Linux for AM335X Documentation/

Aardvark(SPI Tool) can receive from SPI D1 correctly, but BBone can't receive Data from SPI0/D0

I add device tree data to am335x-boneblack.dts as below

-----------------------------------------------------------------------------------------------------------------------------------------

&spi0 {

status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins_s0>;
spidev@0 {
spi-max-frequency = <24000000>;
reg = <0>;
compatible = "rohm,dh2228fv";
};
};

-----------------------------------------------------------------------------------------------------------------------------------------

I add device tree data to am335x-boneblack-common.dtsi as below

-----------------------------------------------------------------------------------------------------------------------------------------

spi0_pins_s0: pinmux_spi0_pins {
pinctrl-single,pins = <
AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_OUTPUT_PULLUP, MUX_MODE0)
AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_INPUT_PULLUP, MUX_MODE0)
AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_OUTPUT, MUX_MODE0)
AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_OUTPUT, MUX_MODE0)
>;
};

-----------------------------------------------------------------------------------------------------------------------------------------

I modify am33xx-ls.dtsi as below

---------------------------------------------

spi0: spi@0 {
compatible = "ti,omap4-mcspi";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x0 0x400>;
interrupts = <65>;
ti,spi-num-cs = <2>;
ti,pindir-d0-in-d1-out = <1>;
dmas = <&edma 16 0
&edma 17 0
&edma 18 0
&edma 19 0>;
dma-names = "tx0", "rx0", "tx1", "rx1";
status = "disabled";
};

  • You keep posting about the same topic, but parts of your post are always missing. Can you please append the actual question to THIS post here?

    I'm going to close the other related posts now:

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1356861/am3358-am3358-add-spi-device-tree/

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1359542/am3358-am3358-am3358-add-spi-device-tree-run-spidev_test

    Regards, Andreas

  • Can you please append the actual question to THIS post here?

    Yes, I append question to this post.

    I update dts as above and  run spidev_test.(REF : 3.2.4.12. SPI — Processor SDK Linux for AM335X Documentation/

    Aardvark(SPI Tool) receive  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, ... 0xF0, 0x0D. It look like correct. 

    Aardvark test-data(feedback) set 85/170/85/170...

    Beagle bone receive : 00 00 ... 00( all wrong)

    if i modify dts as below

    spi0_pins_s0: pinmux_spi0_pins {
    pinctrl-single,pins = <
    AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT_PULLUP, MUX_MODE0)
    AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_INPUT_PULLUP, MUX_MODE0)
    AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_OUTPUT, MUX_MODE0)
    AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_OUTPUT, MUX_MODE0)
    >;
    };

    beagle bone receive : 85  255  255  255  255  255  255  64  0  0  0  0  149  255  255  255  255  255  255  255  255  255  255  255  255  255  255  255  255  255  255  240.

    first byte is correct, others is wrong.

    Is there anything wrong with my dts?

  • First, if you want to switch the direction/usage of the D0 / D1 pin (you don't have to!), the correct name of the device tree property is ti,pindir-d0-out-d1-in, see the associated device tree bindings document in the Kernel source at Documentation/devicetree/bindings/spi/omap-spi.txt (older Kernels) or Documentation/devicetree/bindings/spi/omap-spi.yaml (newer Kernels).

    Then, if you look at other SPI0 pinmux definition in the Kernel source, you see that all pins are configured to PIN_INPUT_PULLUP (or just PIN_INPUT), so you should follow that:

    arch/arm/boot/dts/am335x-pocketbeagle.dts-      spi0_pins: pinmux-spi0-pins {
    arch/arm/boot/dts/am335x-pocketbeagle.dts-              pinctrl-single,pins = <
    arch/arm/boot/dts/am335x-pocketbeagle.dts:                      AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT_PULLUP, MUX_MODE0)
    arch/arm/boot/dts/am335x-pocketbeagle.dts-                      AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_INPUT_PULLUP, MUX_MODE0)
    arch/arm/boot/dts/am335x-pocketbeagle.dts-                      AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT_PULLUP, MUX_MODE0)
    arch/arm/boot/dts/am335x-pocketbeagle.dts-                      AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT_PULLUP, MUX_MODE0)
    arch/arm/boot/dts/am335x-pocketbeagle.dts-              >;
    arch/arm/boot/dts/am335x-pocketbeagle.dts-      };

    Lastly, try a loopback by connecting D0 to D1 with a jumper wire to see if you can receive the correct data back this way.

    Regards, Andreas

  • Tks,

    Loopback test is correct.
    Receive : ff ff ff ff ff ff 40 0 0 0 0 95 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f0 0d

  • Loopback test is correct.

    Great. That means something is not correct with your external Aardvark setup, perhaps its configured incorrectly. But that's not something we can support here. You should go back and study how this is setup. Or also try attaching some other SPI device/equipment externally.

    Regards, Andreas