Hello,
I have created a proprietary board which utilizes an ADXL380 as the accelerometer.
THE SETUP:
My ADXL380 is being configured with the following settings:
| Register # | Value | Purpose |
| 0x26 |
0b10000000
|
Enter standby mode to update registers |
| 0x27 | 0b01111000 | Enable X,Y,Z and FIFO |
| 0x30 | 0b01100000 | Enable Channel ID and FIFO Stream |
| 0x31 | 0b00001100 | Number of samples per watermark (we aren't using watermark so this shouldn't matter (?) |
| 0x2B | 0b00001100 | Enable FIFO watermark and Overrun interrupt (again, neither being used) |
| 0x50 |
0b01110000
|
DCF enabled + EQ_Bypass_enabled (req for LPf) + 1/16 ODR LPF + no HPF
|
| 0x26 |
0b10000100
|
running on LP mode, +-16g range
|
THE ISSUE:
This project started with the best of intentions. I wanted to write code which checked the FIFO fill levels and interrupted on the watermark bit to smoothly take samples at regular intervals. The real world is unfortunately a messy place where idealistic code rarely survives. Over the course of this project, the code has evolved greatly and now I am taking data simply whenever possible.
My board receives external interrupts at 100Hz and I put out accelerometer data into the output buffer in between these moments. It works well and consistently for the most part, although I am seeing a very strange issue where the axes will simply switch. X will become Y, Y will become Z and Z will become X. I have done absolutely all I can to try to replicate this error through software to no avail.
In the documentation, I saw this warning: "Note that when retrieving data from the FIFO, each full sample, that is one set of all enabled axes, must be read in a burst (or multibyte) read operation to avoid data loss or misalignment". I always aim to do that, and am reading 19*9 samples from the FIFO register as a multibyte read operation, but I believe that this function commonly gets interrupted by UART transmissions or timing signals which are a priority to catch.
Over ~6 months of deployment I have seen the error maybe 10 times or so making me very bearish on my chances of seeing it happen live and being able to halt everything to examine under a breakpoint.
MY QUESTION:
Is this behaviour something which is known to occur rarely when I fail to do a full multibyte read? I cannot see anywhere in my code where this behaviour could be exhibited and I have narrowed it down (I believe) the data which is coming out of the ADXL380. The behaviour seems to persist across multiple samples and immediately after reading the ADXL I ensure the samples I am reading have the corresponding channel IDs - The only way I can see this happening is if the data gets misaligned to the channel ID. I do not believe it is the work of random noise on the HI byte of the data, since although it is somewhat likely for two of the channels to show channel ID-esque values [00 and 01] I would expect the channel under gravity to have a HI byte nowhere NEAR [02]. If this value appeared during a measurement, the behaviour would not persist. I am also seeing this behaviour on static machinery where I would not expect to see values in this range 0x02XX for any channel.
The bedrock of my question is:
Is this a known issue which stems from my abuse of the FIFO buffer? Or is there something I haven't thought of / discovered in my own code which could be leading to this event. If it is the former, I will cut my losses and use post-processing to address it and for the latter I will allocate more development time.
Thanks!
