AnsweredAssumed Answered

SPI input value being interpreted incorrectly

Question asked by p.ben on Jan 4, 2015
Latest reply on Jan 5, 2015 by Tamas Novak
My project involves using a STM32L152 part as a SPI master that receives data from a slave (digital accelerometer). When I look at the SPI signals through a scope, I notice that the incoming SPI data is being interpreted incorrectly by the L1 device.

I have attached images showing the oscilloscope outputs for two cases where I am finding the error. In each case, the blue signal represents SPI clock and yellow is SPI Data In.

In the first case, there are two bytes read from the SPI port (corresponding to 2 sets of 8 clock cycles in the SPI clock). The second byte clearly has "data in" line being zero throughout. Yet the data is being read as a 1.

Similarly, the second case involves two bytes being read from the SPI port. The second byte is being reported as 0xa, whereas it is should be 0xb (last bit is 1).

What I am consistently seeing for these error cases is the LSB being wrongly interpreted as a '1' sometimes when it should be a 0.

As part of my SPI settings, the clock polarity is high and clock phase is set to second edge (rising egde).

Any inputs are appreciated!

-Ben

Attachments

Outcomes