How to set ADIS16228 in manual FFT, please...

Hello all

My name is Cristian Dumitrescu and I am from Romania, working at S.C. AEROFINA S.A..

We've recently puchased a ADIS16228 for evaluation/testing purposes. The sensor is controlled by a ATXmega128A4 microcontroller and the software is developed using CodeVision (C language).

I've managed to control some of the functions for the ADIS16228 sensor (e.g. id retrieval, self test, status reading a.s.o), but it seems I can't make it acquire data for a (manual) FFT.

The only documentation I have is the sensor data sheet.

Here is the code used to (try to) launch a manual FFT

#define WkWait 1000

// FF configuration

// Initiate FF (manual FFT)

SPI(0x9A01); // manual FFT, no rectangle, SR0

SPI(0x9B01);

// Initiate FF resolution

SPI(0x9C00); // all 1 g

SPI(0x9D00);

// Select sample frequency

SPI(0xBA05);  // 5: Sample rate = 640 SPS

SPI(0xBB00);

// Set FFT average (1 average)

SPI(0x8C01);

SPI(0x8D01);

SPI(0x8E01);

SPI(0x8F01);

// Clear DIAG_STAT (clear flags = no error)

SPI(0xBE10);

SPI(0xBF00)

// Start manual FFT via command

SPI(0xBE00);               

SPI(0xBF08);

             

// Timeout cycle

Waits = 0; AValue = 0; SPI(0x3C00); Wait(1);

do

  {

   SPI(0xE8E8); // Escape code (from manual)

   Waitus(50);

   AValue = SPI(0x3C00); Waits++; Wait(1);

  }

while ((Waits < WkWait) && ((AValue & 0x80) == 0));

if (Waits >= WkWait) XValue = 1; else XValue = 0;

and the function SPI is

unsigned int SPI(unsigned int Data)

  {

   unsigned char L, H;

   SET_SPIC_SS_LOW;                    // Enable CS

   Waitus(100);                        // Wait 100 microseconds to settle

   H = spic_master_tx_rx(Data >> 8);   // Send high byte

   L = spic_master_tx_rx(Data);        // Send low byte

   SET_SPIC_SS_HIGH;                   // Disable CS

   Waitus(100);                        // Wait 100 microseconds to settle

   Waitus(32);                         // Wait another 32 microseconds between requests

   return ((unsigned int)H << 8) + L;

  }

The delays in this function were obtained according to our particular schematic.

SPI sends a word (16 bit data) in two SPI byte-operations (spic_master_tx_rx is a standard function).

The problem is that nothing happens; the program always signals "timeout" (XValue == 1), i.e. a 1 second timeout.

Can anyone tell me where does this program fail ? Or if the register values should be updated otherwise ? (order/value)

Or better: would someone provide a piece of code that works for this particular case (manual FFT); language is not important.

Thank you

  • 0
    •  Analog Employees 
    on Sep 1, 2014 11:44 PM

    Thank you for posting this.  Once you start the manual FFT, you need to leave the SPI alone for it to complete; otherwise, it can stop the processing, which would result in no update in the buffer.  Based on a quick read of your code, that assurance is not clear to me.  There are two options for doing this. 

    1. Monitor the status of the busy signal (DIO1 or DIO2), using the "not busy" state to trigger data reads
    2. Estimate the time associated with the processing, using the information on page 17 of the datasheet.
      www.analog.com/static/imported-files/data_sheets/ADIS16228.pdf#Page=17

    Let me know if that helps and we can go from there.

    Good luck!

  • NevadaMark, thank you for the fast answer. I'm working alone with this sensor and any help is much appreciated.

    Yes, I'm using the DIO1 line to monitor the status of the sensor. See function below:

    unsigned char Timeouted(unsigned int Ticks)

      {

       Waits = 0; AValue = 0; // global variables

       while ((Waits < Ticks) && (IsBusy))

         {

          Waits++; Wait(1);

         }

       if (Waits >= Ticks) return 1; else return 0;

      }

    where IsBusy is

    (PORTD.IN & 2) == 2

    i.e. test of the D.2 line of the microcontroller (wired to DIO1).

    This function works flawlessly when I invoke the self-test of ADIS16228. See image SelfTest.JPG for an ocilloscope view of the line (I've encicled the time scale, 10ms).

    Self-test takes 32ms according to Timeouted function (32,9ms stated in the manual).

    So everything seems ok (with this function).

    But for the FFT manual I've tried to monitor the DIO1 line, but things were not quite clear to me (line operated strangely).

    Now I've changed the final part of the code and after some tests the program is:

    // Start manual FFT via command

    //SPI(0xBE00);                <= eliminated (seems to lock the FFT generation)

    SPI(0xBF08);

                  

    // Timeout cycle

    Waits = 0; AValue = 0;               

    do              

      {

       Waits++; Wait(1);

      }

    while ((Waits < WkWait) && (IsBusy));

    and the DIO1 line is shown in FFT manual.JPG (I've encicled the time scale, 100ms).

    FFT seems to last 800+ ms (as in my calculations 800ms + 30-50 ms FFT generation).

    I'll continue testing and will update the results.

    However, would you be so kind to help me with some uncertainties:

    1. Is the 830-850ms interval correct ? (I'm using the SRx option 5, i.e. 640 SPS, page 13 of the data sheet).

    2. Zooming into the oscilloscope (see FFT manual (zoom).JPG, time scale 1ms) I see some "blips" before the 800+ms step. I suspect there are DIO1 tranzitions that should be also monitored.

    Is my assumption correct ? In general, what functions/registries should be monitored with DIO1 ?

    3. In another discussion, you've provided a sample code for a real time mode sampling (see ADIS16228-real_time_code.txt).

    The code used for retrieving the data ( the "for" cycles) can be used to retrieve the FFT samples ? (of course, after bringing the FFT data into the buffers, using GLOB_CMD register)

    Thank you again and best regards

  • 0
    •  Analog Employees 
    on Sep 3, 2014 3:49 AM

    Great catch on the BE00 command.  The GLOB_CMD bits act independently, so you only want to write to this register, one byte at a time.

  • 0
    •  Analog Employees 
    on Sep 3, 2014 3:50 AM

    With respect to your questions:

    1. Is the 830-850ms interval correct ? (I'm using the SRx option 5, i.e. 640 SPS, page 13 of the data sheet).

    ANSWER: I calculate the same value as you, for these settings. In fact, I have attached an Excel file that I use to make these estimates, in case you find it useful.  It is nothing special but has helped me.

  • 0
    •  Analog Employees 
    on Sep 3, 2014 3:53 AM

    2. Zooming into the oscilloscope (see FFT manual (zoom).JPG, time scale 1ms) I see some "blips" before the 800+ms step. I suspect there are DIO1 tranzitions that should be also monitored.

    Is my assumption correct ? In general, what functions/registries should be monitored with DIO1 ?

    ANSWER: I am not 100% sure but this might indicate SPI activity.