I've got a VTI CMA3000-D01 digital accelerometer and I'm controlling it via SPI from a Texas Instruments CC2540 chip using the embedded 8051 MCU.

In the datasheet for the CMA3000, it mentions that in 2g mode, the output sample rate is 400 Hz or 100 Hz (depending on how the accelerometer is configured). There's also a "Motion Detection Mode" which works at 10 Hz sample rate.

What I'd like to do is change the configuration of the accelerometer to either 400 Hz mode or 100 Hz mode and measure the frequency on an oscilloscope to verify that I've actually made such a change. This is mostly for me to better understand how to make useful measurements with an oscilloscope, and to get a better grasp on SPI.

I've recently purchased a Rigol DS1052E oscilloscope, so I'd like to know how to hook this up to my accelerometer to measure the output frequency, and what settings I need to use on the oscilloscope to make such a reading, and if it's even possible.

I've tried connecting the probe (at 10x attenuation) on the scope to the SCK lead on the accelerometer and the ground lead from the probe to the ground on the circuitboard, then hitting the "Auto" button on the oscilloscope, but it gives me a waveform with a frequency and voltage that jumps around:

enter image description here enter image description here

I was expecting to see a square wave with a frequency of 100 Hz (this is what the accelerometer is currently set to in my software), but I got a sine-looking wave. Now the above images may actually be correct, but I don't know enough to determine if they are, which is why I was hoping someone more knowledgeable in regards to SPI and oscilloscopes might be able to give me some direction, or tell me what I need to read to better understand this stuff.

It would also be great to know how to read output from the MISO port on the accelerometer to see what data is being sent back to the MCU. I'm not sure if this is possible to do with only a scope, or if I'd need a logic analyzer to see this data. Thanks in advance.

  • 5
    \$\begingroup\$ The "AUTO" button strikes again! \$\endgroup\$
    – W5VO
    Feb 14, 2012 at 15:27
  • \$\begingroup\$ You are at 10ns/div and 100ns/div, and you are hoping to see 100 Hz? For starters scratch the auto button and setup your scope to what you want it to be. 5mV at 10ns/div is pretty much just noise. \$\endgroup\$
    – Kellenjb
    Feb 14, 2012 at 16:29

2 Answers 2


The problem is that you are using a MEMS digital accelerometer, and what you are reading is the SCK (serial clock) pin of the serial interface. In order to function, that sensor needs to be interfaced with a microcontroller, that sets it for the sampling frequency, the range and so forth.

So you don't have to expect a square wave with 100Hz frequency, but a fast (depending on the bus bitrate) spike, corresponding to a transmission. Expanding the spike, if the scope is fast enough, you should then see the clock square wave inside the spike.

Moreover, if you don't set the SPI interface correctly, the uC will not generate the clock (the sensor operates in slave mode), and you won't read any value.

If you want to see a 100Hz signal, you could probe the Int pin, which sends an interrupt to the microcontroller every time a measure is available. Then, if you handle the interrupt from the microcontroller properly, you wil see the pulse corresponding to the transmission every 10 ms (100Hz).

But make sure that you're not using motion detection; in that case, only when an acceleration is measured, it will generate the interrupt.

To read the data at the SPI port, the simplest thing is to configure the communication with the sensor; otherwise, it won't send data at all. Then, check if the microcontroller is getting the interrupts and if it's reading the data the sensor gives; you can use a timer to add a timestamp to values and check the frequency they come.

(still WIP)

  • 1
    \$\begingroup\$ You could possibly put a resistor of 1 Ohm or so into the GND wire of your power supply and measure the voltage over it with the scope. As that voltage is proportional to the current the accelerometer needs, you will probably find the frequency in its power usage. \$\endgroup\$
    – AndreKR
    Feb 14, 2012 at 17:21
  • \$\begingroup\$ Clever! But probing pins is simpler, and measuring consumption requires a resistor in series to the supply, and in a PCB is hard to do that... \$\endgroup\$
    – clabacchio
    Feb 14, 2012 at 17:44

Thanks for the response clabacchio, I tried some of your suggestions and managed to get some more meaningful measurements today. It turns out that the sample application I was using to test the SCK pin, will only output a signal when it's "connected" to another device (this is a Bluetooth Low Energy application). Once I paired with another device, the SCK pin on the accelerometer started giving me the measurements I expected.

Like you explained, it wasn't 100 Hz, but rather the Baud rate that the SPI interface on the microcontroller had been set to. To verify this, I changed the baud rate to 230,400 bps, then took a measurement with my oscilloscope. Here's a screenshot of the result:

enter image description here

As you can see, the frequency is 230.4kHz, exactly what I was expecting.

I also tried probing the INT pin, and received the following wave:

enter image description here

This wave kept jumping around, but it mostly stayed between 19 and 20 Hz. I'm not really sure what to make of this, since the accelerometer has been configured to operate in 100 Hz mode from my code, so I don't know why I'm getting 20 Hz.

Also, here's 2 captures from the MISO port, which showed a 20 Hz frequency at 100ms, and 480.8 kHz at 1.0 us:

enter image description here enter image description here

I'm curious why the frequency jumped from 20 Hz to 480.8 kHz just by changing the timescale. I thought the frequency might become a bit more accurate as I increased the granularity of the time scale, but I didn't expect a drastic change from 20 Hz to 480 kHz. I'm thinking one of these measurements must be incorrect, but I'm not sure why. It's probably the 20 Hz value, since the 480 kHz is similar to the bps rate I was using for that particular measurement (it was set to 480,500 bps in the microcontroller).

Anyway, like I said, I managed to make one very accurate measurement, so I'm happy with the results, but I'd be very interested to hear any advice you might have regarding my INT or MISO readings.

Thanks again for your help, it's very much appreciated!

  • \$\begingroup\$ It's not wrong: when you use a larger timescale, the scope measures only the peaks corresponding to one transmission, because it's set to sample every N milliseconds (depending on the oversampling rate used); when you use the 1us/div scale, it samples faster and it's able to detect all the edges. Remember that the frequency that it displays is only measured by what you see in the screen, it's not an absolute truth. \$\endgroup\$
    – clabacchio
    Mar 1, 2012 at 10:20
  • \$\begingroup\$ Thanks for the response, it verifies what I began to assume after I posted my last message. I was mistaken by originally thinking that the frequency measurement is the "absolute truth" as you put it, but now I realize that it changes depending upon what's being displayed on the screen. \$\endgroup\$
    – adamc
    Mar 5, 2012 at 12:53
  • \$\begingroup\$ Yep :) I had a laboratory course at university which focused on scopes, and the professor was really strong on two points: 1- NEVER use autoscale, and 2- Read the signal, more than the numbers \$\endgroup\$
    – clabacchio
    Mar 5, 2012 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.