ADXL372 FIFO data error with long time reading

Hello,

I am using the adxl372 to measure the x,y,z acc data, the initialization is normal.

and i get the data through the FIFO, here comes the problem.

I set FIFO samples num as 480 (0xE0,160 samples for each axis),set the watermark interrupt, in the interrupt callback function,

I read the FIFO data through SPI.(read 157 samples each time)

Everything is fine in the begining, but a little moment later, the data goes wrong, and then three axes data begin to swap. 

As the picture shows below,

I don't know why this comes like this, the data swaps every time i read the fifo(157 samples).

Best regards.

  • 0
    •  Analog Employees 
    on Sep 27, 2018 12:25 PM

    Thanks for the question. It looks like some digital communication issue. Can you verify if your SPI communication is reliable? By the way, have you tried multibyte read for the three axes of data? Let me know if it helps.

  • Thanks for your reply.

    1) I think my spi communication is reliable.

    Because when i communicate with ADXL345, it works properly.

    2) I use multibyte read now, but the problem still happens occasionally.

    this problem just happens occasionally. what's more, it doesn't last long time and the data become normal. like the picture shows below.

  • 0
    •  Analog Employees 
    on Oct 29, 2018 5:25 PM in reply to howto

    Thanks for your feedback. It's not quite clear what is shown on the graph you sent. So what is the signal in the blue line and what is the unit on the vertical coordinates? The noise seems pretty high on that axis. It seems the data is not swapped any more with multibyte read, did you do a multiple of 3 axes of data? Have you also checked if the series start indicator is correct in the part of data you circled out?

  • jwang, Thanks a lot.

    1)Yes, I do a multiple read of FIFO for 3 axes of data with a multiple byte length of 960.

    Code like this:

    ADXL372_Read_Buf(XL372_FIFO_DATA,&SdWriteBuf[10],960);

    But I didn't check the series start indicator is correct or not.

    (I think if I read the FIFO correctly each time, there should not be errors.)

    2) Sorry for the indistinct picture. The blue line data is correct. I zoom in the picture shows last time. As below:

    As you can see, data swap still exist. 

    3)here is my code for reading data.

    // the watermark interrupt function
    void intCallbackFxn(PIN_Handle handle, PIN_Id pinId)
    {
       uint8_t  buf[2];
       uint16_t fifonum;
       switch (pinId) {
            case Board_DIO14:
                ADXL372_Read_Buf(XL372_FIFO_ENTRIES2,buf,2);
                fifonum=((uint16_t)(buf[0]&0x03)<<8)|buf[1];//FIFO entry大于480才读取数据,否则是误碰
                if(fifonum>480){
                    AccOver=1;
                }
                break;
            default:
                /* Do nothing */
                break;
        }
    }
    
    //in the main function
    if(AccOver){
        AccOver=0;
        ADXL372_Read_Buf(XL372_FIFO_DATA,&SdWriteBuf[10],960);
    
        SdWriteBuf[1]=(uint8_t)(RfSeqNumber>>8);   //记录帧标记
        SdWriteBuf[2]=(uint8_t)(RfSeqNumber);
    
        result = SD_write(sdHandle, SdWriteBuf, ACCSTARTSECTOR+accSectorLocation, 2);    //2sector 160samples/3200Hz/0.05s数据
        if (result != SD_STATUS_SUCCESS) {
            Display_printf(display, 0, 0, "Error writing to the SD card\n");
            while (1);
        }
        //RfReportTimeCount++;
        accSectorLocation += 2;
        if(accSectorLocation > ACCFULLSECTOR){   //25s数据
            ADXL_Stop();
            Display_printf(display, 0, 0, "ACC %d SECTOR FULL\n",ACCFULLSECTOR);
        }
    }

    Waiting for your help.

  • 0
    •  Analog Employees 
    on Oct 30, 2018 3:04 PM in reply to howto

    Thanks for the feedback. So what FIFO mode are you in? You should be streaming data out continuously in FIFO Stream Mode. While in the Oldest Saved mode, after reading the data, the FIFO must be disabled
    and re-enabled to save a new set of data. Meanwhile, you can check on the serial start indicator to double confirm if the data is actually swapped.

    By the way, is this released version of the sensor material, you can check the number printed on the package.