Setting 16 bit SPI mode fails for the Raspberry Pi 3 board when using Analog Devices ADIS16354, 362 and 477 IMUs. I know this is because the SPI controller of Raspberry Pi only supports 8 bit mode. But when I try to use standard 8-bit mode instead of sending 16-bits, I could not get valid data from the sensor.
The code is located here...
https://github.com/Pskoog3/PX4-Autopilo ... S16354.cpp
Look at the functions, RegisterWrite and RegisterRead which are explained below.
The SPI::transfer function is defined in...
https://github.com/Pskoog3/PX4-Autopilo ... ix/SPI.cpp
Following is the explanation of WRITE sequence used in RegisterWrite.
1st byte sent: the first bit of the DIN sequence is a 1, followed by a 0 and finally the LOWER 6-bit address of the 16-bit target register.
2nd byte sent: the 8-bit data command containing [7:0] bits of the 16-bit data.
3rd byte sent: the first bit of the DIN sequence is a 1, followed by a 0 and finally the UPPER 6-bit address of the 16-bit target register.
4th byte sent: the 8-bit data command containing [15:8] bits of the 16-bit data.
Following is the explanation of READ sequence used in RegisterRead.
1st byte sent: the first two bits in the DIN sequence are 0, followed by the LOWER byte address of the 16-bit register.
1st byte received: the DOUT sequence contains the register’s LOWER 8-bit data.
2nd byte sent: the first two bits in the DIN sequence are 0, followed by the UPPER byte address of the 16-bit register.
2nd byte received: the DOUT sequence contains the register’s UPPER 8-bit data.
Finally the UPPER and LOWER 8-bit data is combined into a 16-bit word.
I tried this but no luck so far!
The ADIS16354 IMU datasheet is located at...
https://www.analog.com/media/en/technic ... S16354.pdf