Im trying to use the Beaglebone Black as a slave device and read from the arduino over SPI.
Im confused as to why I am just getting 255 repeated over and over on the terminal as an output.
My thought is that there is some kind of a memory leak or buffer overflow. I just can not figure out what
I’m doing wrong. Is one supposed to set cs as input? even with it set to output I have the same issue.
I have my dts file set as:
/dts-v1/;
/plugin/;
/ {
compatible = “ti,beaglebone”, “ti,beaglebone-black”;
/* identification */
part-number = “spi0pinmux”;
fragment@0 {
target = <&am33xx_pinmux>;
overlay {
spi0_pins_s0: spi0_pins_s0 {
pinctrl-single,pins = <
0x150 0x30 /* spi0_sclk, INPUT_PULLUP | MODE0 /
0x154 0x30 / spi0_d0, INPUT_PULLUP | MODE0 /
0x158 0x10 / spi0_d1, OUTPUT_PULLUP | MODE0 /
0x15c 0x30 / spi0_cs0, INPUT_PULLUP | MODE0 */
;
};
};
};
fragment@1 {
target = <&spi0>;
overlay {
#address-cells = <1>;
#size-cells = <0>;
status = “okay”;
pinctrl-names = “default”;
pinctrl-0 = <&spi0_pins_s0>;
spidev@0 {
spi-max-frequency = <24000000>;
reg = <0>;
compatible = “linux,spidev”;
};
};
};
};
My Arduino is wired up like so:
P9.22 SPI0_CLK - Orange - 0x150 0x30 → Arduino Due 110 SCLK
P9.21 SPI0_D0 - Green - 0x154 0x30 → Arduino Due 109 MOSI
P9.18 SPI0_D1 - White - 0x158 0x10 → 108 MISO
P9.17 SP0_CS0 - Black - 0x15C 0x30 —> Pin 10 Set as Slave Select
Python File:
import spidev
import time
spi = spidev.SpiDev()
spi.open(1,0)
while True:
resp = spi.readbytes(1)
print resp[0]