Hi,
I am using BB Black to work with a motion sensor through SPI.
By doing
echo BB-SPIDEV0 > /sys/devices/bone_capemgr.9/slots
I am able to get /dev/spidev1.0 and /dev/spidev1.1, which are supposed to be output and input PIN of SPI0 in mode0. I wire P9 pin 18 and 21, and tested spidev_test.c, and I got the expected results.
However,after I wire my sensor PINS of MISO, MOSI, CS, VDD, and GND to BB Black’s corresponding PINS, and use functions ioctl(fd, SPI_IOC_MESSAGE(1), &tr); to read one byte (a known value) from a register in the motion sensor, I cannot get what I want. I guess there are some settings I may not get them right.
Can any expert show me what are the proper ways/procedure to
1, read n bytes from the sensor starting from a register
2, write n bytes to the sensor
In the spidev_test example, I use either /dev/spidev1.0 or /dev/spidev1.1, I can get the expected result. In my sensor case, which device handle shall I use? From the DTS description, spidev1.1 is the output PIN. So shall I use spidev1.1 to do writing and then read from spidev1.0?