connecting LIS302DL motion sensor over SPI

Hello,
Sorry for offtopic, I saw motion sensor LIS302DL was being discussed here.

I am trying to connect motion sensor LIS302DL to STM32F103 MCU over SPI.
I am actually programmer so my knowledge in electronics is very limited. I didn't use additional schematics and directly connected CS, SCL, SDx, SDO of LIS302DL to the NSS, SCK, MOSI, MISO respectively.

With osciloscope I can see perfectly shaped square signal on SCL and SDx. But SDO pin (that has to be sensor's output signal) produces saw-like signal where each period looks like triangle.
Does this something to do with absense of necessary circuitry?
Or it is programmatic problem?

A tiny hint will be hugely appreciated.
Andrew

P.S. I will include all information about my SPI configuration if anyone responds to my desperate message .

I'm a noob myself, but here's what I understand about interfacing a SPI device directly to a MCU.

  • its easiest if the logic voltage is the same level, if the sensor is 3.3 and the MCU is 5 you should add resistors, there's an example of this somewhere on the sparkFun tutorials site I think.
  • you probably want to pull CS high with a resistor (10k)

I can't advice on the oscilloscope issues.

Hello Emdee,
Fortunately my MCU works at 3.3 volts. So no level shifters are needed.
Pullup on CS might be soluction. I will experiment with it.
Thanks!

Great to meet you people here, i am using LIS302DL in one of my projects. I am clueless as to how exactly it works, can you please help me. I wanted to know how the sensor works when you place it on your fingers and move it up and down and then will it give a separate digital output for each co ordinate axis, like one byte of data for x axis, one byte for y axis,etc or collectively it give one single byte for a particular condition. And is it required to buy a Eval kit to calibrate the sensor and use it for applications or can we connect it to a ATMEL board and continue with the experimenting.
Guys please help me...

I wanted to know how the sensor works when you place it on your fingers and move it up and down and then will it give a separate digital output for each co ordinate axis

No it doesn't respond to fingers being placed on it. It gives values on the acceleration experienced on each of the three axis. The simplest way to do this is to rotate the sensor then it feels the acceleration due to gravity. Basically it tells you what way up. Read the data sheet for full information:_
http://www.st.com/stonline/products/literature/ds/12726.pdf

You can go without an eval board but you might find it difficult to solder.

He didn't ask if it would sense fingers being placed on it.*

He asked it it would sense the movement of a finger if it (the accelerometer) were placed on said finger.
To which the answer is of course yes it will, providing the acceleration is not below the minimum sensitivity threshold of the accelerometer (unlikely).
What it won't measure is the constant velocity between the initial acceleration from rest and starting to bring the finger back to rest.

  • Unless, perhaps the finger is carrying a large electrostatic charge, in which case it might - that's how MEMS accelerometer self-test usually works. :wink:

Thanks very much this is really helpful for me now. Are there companies offering free samples of this IC so that i can get it for free and first work some basics on it and later do entire project by buying the components. :wink:

Hello Embdee,

pulldown resistor between CS and the ground solved my problem!
Thank you very much for the advice.

nordic

Could you tell me how to connect the pull-down resistor? Thank you

A pull down resistor is one placed between the input and ground.