Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

SPI Communication with a LIS2DE12 Accelerometer

Status
Not open for further replies.
Hi! I am trying to establish a SPI communication with an LIS2DE12 accelerometer. First, I would like to say that I have checked phase, polarity, msbFirst and CS. I am using an EM9304 as the master of the communication, and the spi clock frequency is aproppriated.

Writing or reading from the sensor, makes it sends an weird symmetrical waveform in to MISO pin.

(This symmetrical waveform is equal to the LIS2DE12 ID (0X33 = 00110011), but I don't know if its a coincidence.)

I had tried many different registers (writing and reading) and the sensor only send this signal. I read both datasheets and couldnt figure how to make it work or get to the conclusion that I have a hardware problem.

These are the prints from the oscilloscope with the MOSI and MISO signals. In the MOSI print, I am sending a write commando to CTRL_REG4 (0x23) and an 8bit data (0x34). In the following pack of bytes, I am trying to read te content of this same register (CTRL_REG4). As you can see, the module keeps sending 0x33 through MISO.

MOSI Signal
120977



MISO Signal
120978


Thanks in advance for any kind of help! Bye.
 
Are you actively controlling /CS ?

That's needed to synchronise the transfer, otherwise the internal bit count may be undefined.
 
No! The CS pin of the lis2de12 is grounded. Do you think its the cause of the problem?

Yes, most likely; /CS should be activated before each SPI transfer sequence and deactivated afterwards.

There has to be a signal to reset the internal SPI sequence & counts ready for a new command and presumably that's it.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top