# Which Bit Transfer and Receive First

Joined Feb 4, 2022
155
A standard SPI device will have a MISO pin, a MOSI pin, an SCLK pin, and a SS pin. It has a data register that functions as a shift register.
Initially, suppose that Master has bits 1010 0011 in its shift register, and the slave has bits 0101 1100 in its shift register:

I want to know which bit (first MSB or first LSB) the master transfers to the slave first.

What will be the voltage on MOSI and MISO pin if the master transfer the first LSB ?

#### Ya’akov

Joined Jan 27, 2019
9,117
SPI is full duplex. This means that data is sent and received simultaneously on both MISO and MOSI. If both master and slave have data to send, when the clock is sent, both begin to send data. There isn’t one before the other in the protocol. If one starts first it is because of latency on the part of that side of the conversation, not the SPI method.

This figure shows how the bits are at exactly the same time, synchronized by the clock.

Joined Feb 4, 2022
155
SPI is full duplex. This means that data is sent and received simultaneously on both MISO and MOSI.

This figure shows how the bits are at exactly the same time, synchronized by the clock.
What happens in the following case

Master has bits = 1010 0011
Slave has bits = 0101 1100

What will be the value of MOSI and MISO when the master sends one clock signal over SPI.

#### BobTPH

Joined Jun 5, 2013
8,935
That is not what he us asking, he asks whether the LSB or MSB is transferred first.

Bob

#### ericgibbs

Joined Jan 29, 2010
18,835
hi,
The image shows which is first.
E

#### Ya’akov

Joined Jan 27, 2019
9,117
What happens in the following case

Master has bits = 1010 0011
Slave has bits = 0101 1100

What will be the value of MOSI and MISO when the master sends one clock signal over SPI.

The answer to that is it is implementation specific and is not part of the SPI protocol, which, in any case is somewhat fast and loose.

So, without a specific application there is no answer to your question it could be either one.

Joined Feb 4, 2022
155
That is not what he us asking, he asks whether the LSB or MSB is transferred first.

Bob
Yes that's exactly my question.
hi,
The image shows which is first.
E
View attachment 262293
Sorry, From the image i don't understand what is happening here.

So, without a specific application there is no answer to your question it could be either one.
For example you can take AVR/PIC microcontroller and SPI ADS7038 ( Take any spi device of your choice )

#### ericgibbs

Joined Jan 29, 2010
18,835
Does help.?
Leftside is time=0
E
Transmissions normally involve two shift registers of some given word-size, such as eight bits, one in the master and one in the slave; they are connected in a virtual ring topology. Data is usually shifted out with the most significant bit first. On the clock edge, both master and slave shift out a bit and output it on the transmission line to the counterpart.

Last edited:

#### Ya’akov

Joined Jan 27, 2019
9,117
For example you can take AVR/PIC microcontroller and SPI ADS7038 ( Take any spi device of your choice )
But you can’t take ”any device”. You have to read the specs of the device(s) involved and they will tell you the answer. There is no general answer, it is implementation specific so your question has to be about something specific. And there is no point in me just randomly choosing something and saying “this one is MSB first”.

In practice, it is a configurable parameter in most SPI devices.

If you have a question about something in particular, you can read the description of that device’s implementation and find out.

Joined Feb 4, 2022
155
If you have a question about something in particular, you can read the description of that device’s implementation and find out.
Thanks.
Datasheet show whether the LSB or MSB is transferred first.

#### BobaMosfet

Joined Jul 1, 2009
2,112
A standard SPI device will have a MISO pin, a MOSI pin, an SCLK pin, and a SS pin. It has a data register that functions as a shift register.
Initially, suppose that Master has bits 1010 0011 in its shift register, and the slave has bits 0101 1100 in its shift register:

I want to know which bit (first MSB or first LSB) the master transfers to the slave first.

What will be the voltage on MOSI and MISO pin if the master transfer the first LSB ?
Try little-endian first.

#### Ian0

Joined Aug 7, 2020
9,794
SPI goes MSB first. Usually there is an option for LSB first in some microcontrollers, but every peripheral i have seen is MSB first. Then there are four options for the clock phase and polarity, and they are not consistent at all.
UARTs go LSB first.