AnsweredAssumed Answered

ADIS16228 Read buffer time with Raspberry Pi 3

Question asked by PiSens on Jul 18, 2018
Latest reply on Jul 18, 2018 by NevadaMark

Hey everyone,

 

I am working on a project to collect vibration data (time domain) in a process with the ADIS16228 and the Raspberry Pi 3.

Therefore I need to capture all values in time domain in x, y and z axis.

So I am using the manual time mode of the sensor.

When the sensor is ready with capturing 512 samples, I start reading the buffer. For the SPI-communication I am using the bcm2835-library on the RaspberryPi.

 

t = clock();
            for (int i = 0; i < 512; i++) {

 

                spi_out[0] = (Z_BUF);
                spi_out[1] = 0b00000000;
                //transfer the address first
                if (i == 0) {
                    bcm2835_spi_transfern(spi_out, sizeof(spi_out));
                    bcm2835_delayMicroseconds(15);
                }

 

                bcm2835_spi_transfernb(spi_out, spi_in, sizeof(spi_out));
                bcm2835_delayMicroseconds(5);

 


                Z[i] = (spi_in[0] << 8) | (spi_in[1] & 0xFF);;

 

                cout << Z[i] << "\t" << i << "\t"  <<  endl;
            }
            t = clock() - t;

 

with this code I am reading the Z axis.  By measuring the time I get the result that reading 512 samples from 1 axis last 0,014s. 

So for reading all buffers from all 3 axis it will last 0,042s.

 

So far I got 2 questions.

1) Is it possible to read this buffer faster?

2) Why do I need bcm2835_delayMicroseconds(5) when reading? (If I don't use a delay from at least 4 Microseconds, the data in Z[i] is not correct - thats why the Output on the Console, to validate the data)

 

I'd be thankful for any ideas and any help.

Outcomes