8 years, 5 months ago.

frequency output at ADXL345

Hello all, I'm working with ADXL345 with nucleo-l053r8. When i execute the code from standard libraries from Mbed . I'm seeing starnge output frequencies at the sensor. For the input spi frq of 5MHZ the freq at the MISO is 9MHZ and at MOSI 48MHZ. for input spi freq 2MHZ the output freq at MISO is 101 MHZ and at MOSI 61MHZ. For full details see the document attached. The document has output freq at different input freq.

The issue is the output data rates are always same for SPI and I2C irrespective of input freq.

Here I'm using the sparkfun board for ADXL345. {

Can you post a screenshot of your scope?

posted by Erik - 11 Nov 2015

I think 70MHz is a noise frequency . Here I'm uploading clear images /media/uploads/mgvdatalogger/f-100k-_25hz_data_rate.jpg /media/uploads/mgvdatalogger/f-100k-100hz_data_rate.jpg /media/uploads/mgvdatalogger/f-400k-800hz_data_rate.jpg /media/uploads/mgvdatalogger/f-100k-100hz_data_spi.jpg /media/uploads/mgvdatalogger/f-400k-800hz_data_spi2.jpg /media/uploads/mgvdatalogger/f-2mhz-1600_data_spi.jpg /media/uploads/mgvdatalogger/f-5mhz-3200hz_data_spi.jpg

first three images are in I2C communication. f=100K , 25HZ datarate f=100k, 100HZ datarate f=400k, 800HZ datarate ... respectively. then follows SPI. f=100k,100HZ datarate f=400k,800HZ datarate f=2MHZ,1600HZ datarate f=5MHZ,3200HZ datarate... respectively.

posted by Mohan gandhi Vinnakota 11 Nov 2015

From your pic I get the feeling your I2C has a high load capacitance: The edges are not really steep. And your SPI is pure noise. Make sure you actually have supply and ground connected, also the same for the data lines.

posted by Erik - 11 Nov 2015

Dear erik i pudated with new images above. for the sparkfun board, I connected two pull up resistors of value 10K. SDO to ground CS to VCC VCC=3V3

For above configuration device address should be 0x53. Unfortunately it is showing 0xe5 same as SPI.

first three images are in I2C and last four are in SPI.

posted by Mohan gandhi Vinnakota 12 Nov 2015

For this a logic analyzer is handy.

First of all: I would run your I2C to start with at 100kHz, you see alot of load capacitance on your I2C (pull-up resistors of around 3k will also help with that).

Which code are you using? Either use SPI or I2C, and focus on that one. If you do I2C (easiest one), what return values do the mbed functions give? Which mbed functions do you use?

posted by Erik - 12 Nov 2015

Hi Erik, I would like to concentrate on SPI since i need high datarates like 3200 and 1600HZ. I'm using code from Aron Berk. See the fallowing link. https://developer.mbed.org/components/ADXL345-Accelerometer/ And I'm using below functions. pc.printf("Device ID is: 0x%02x\n", accelerometer.getDevId());

Go into standby mode to configure the device. accelerometer.setPowerControl(0x00);

Full resolution, +/-16g, 4mg/LSB. accelerometer.setDataFormatControl(0x0B);

3.2kHz data rate. accelerometer.setDataRate(ADXL345_3200HZ);

Measurement mode. accelerometer.setPowerControl(0x08);

I export the program to keil and watched step by step debug. I see everything working fine. These functions successfully sending the correct hexcode into the correct registers. I also test the I2C code from same link and same functions. Here also it is sending corretct hexcode. Unfortunately the datarates are not changing.It is always around 350HZ.

The device is working fine. It is responding well when i move the sensor. I hope the device is not damaged.

posted by Mohan gandhi Vinnakota 13 Nov 2015

Hi Erik, I set the data rate as below accelerometer.setDataRate(0x04); i.e. output data rate of 1.25HZ and the output is 1.25 HZ but same output for multiple times as shown in image. And accelerometer.setDataRate(0x05); i.e. for the output data rate 3.5HZ again output is 3.5 HZ but with multiple times same output. Here i default baud rate of 9600.

Same thing for 50HZ Output is exacly 50 variations but multiple times. Now i changed baud rate to 115200 since 9600 baudrate is giving 42 samples. now 50 variations but multiple times (300HZ). /media/uploads/mgvdatalogger/img_4059.jpg /media/uploads/mgvdatalogger/img_4060.jpg

posted by Mohan gandhi Vinnakota 16 Nov 2015
Be the first to answer this question.