Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Setting 16 Bit SPI Mode Fails for Raspberry Pi

Status
Not open for further replies.

emaq

Member level 4
Member level 4
Joined
Sep 17, 2015
Messages
78
Helped
0
Reputation
0
Reaction score
1
Trophy points
1,288
Activity points
2,001
Setting 16 bit SPI mode fails for the Raspberry Pi 3 board when using Analog Devices ADIS16xxx IMUs. I know this is because the SPI controller of Raspberry Pi only supports 8 bit mode.
spi16bit.jpg


How to modify the transferhword in https://github.com/PX4/PX4-Autopilo...42699f4f/src/lib/drivers/device/posix/SPI.cpp to mask the 16 bit SPI mode so that it works for 8 bit SPI as well?
 

Hi,

In all my decades of professionally using SPI I never used (non standard) 16 bit mode.

I always used the standard 8 bits mode. Instead sending 16 bits it's just sending two 8 bits.
Doesn't this work for you? If not, why?

Currently I'm working on a project with 7 (different) devices on the same SPI. Different speeds, different phase and clock modes, .. accessed blocking, via ISR, via DMA...

Klaus
 

I always used the standard 8 bits mode. Instead sending 16 bits it's just sending two 8 bits.

Do you think the following WRITE sequence works?

1st byte sent: the first bit of the DIN sequence is a 1, followed by a 0 and finally the 6-bit address of the target register.
2nd byte sent: the 8-bit data command containing [15:8] bits of the 16-bit data.
3rd byte sent: the 8-bit data command containing [7:0] bits of the 16-bit data.

To read and verify the same 16-bit target register, the following READ sequence is used.

1st byte sent: the first two bits in the DIN sequence are 0, followed by the upper byte address of the 16-bit register.
1st byte received: the DOUT sequence contains the register’s upper 8-bit data.
2nd byte sent: the first two bits in the DIN sequence are 0, followed by the lower byte address of the 16-bit register.
2nd byte received: the DOUT sequence contains the register’s lower 8-bit data.

I tried this but no luck so far!
 
Last edited:

Hi,

Show your code.
.. and give a link to the manufacturer's web site of the device. ... where we can find all related cocuments.
.. and the exact part name

Klaus
 
Last edited:

The code is located here...
**broken link removed**
Look at the functions, RegisterWrite and RegisterRead which are explained below.

The SPI::transfer function is defined in...

Following is the WRITE sequence which is a bit different from what I mentioned in my last reply.

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 READ sequence is used which is again a bit different from what I explained in my last reply.

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.

The ADIS16354 IMU datasheet is located at...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top