Post Go back to editing

odd resolution Z axis for ADXL355 - missing histograms bins

Hello

I ploted some statistics from raw data of ADXL355 and I noticed that histogram for Z axis look like missing some bins that might mean it might be somehow upsampled instead of default 20bit.

Any explanation why this happen?

Parents
  • I eventually catch where the probliem lie. Described issue at code also match my observation where Z axis always was multiply of 16 where it watch missing last 4 bits ( sampleRaw[10]>>4 )

    Thanks for participate.

    void _ADXL355::downloadSampleOld(uint8_t *sampleRaw){
        uint8_t data[11] = {reg.readAddr(0x06),0,0,0,0,0,0,0,0,0,0}; // not large enough array to store data
        reg.transferBytes(data,data,11); // <--- transferr not enough bytes
        memcpy(sampleRaw,&data[1],11); // memcpy copy one byte out of data range so sampleRaw[10] was undefined
    }
    
    void _ADXL355::downloadSample(uint8_t *sampleRaw){
        uint8_t data[12] = {reg.readAddr(0x06),0,0,0,0,0,0,0,0,0,0,0};
        reg.transferBytes(data,data,12);
        memcpy(sampleRaw,&data[1],11);
    }

Reply
  • I eventually catch where the probliem lie. Described issue at code also match my observation where Z axis always was multiply of 16 where it watch missing last 4 bits ( sampleRaw[10]>>4 )

    Thanks for participate.

    void _ADXL355::downloadSampleOld(uint8_t *sampleRaw){
        uint8_t data[11] = {reg.readAddr(0x06),0,0,0,0,0,0,0,0,0,0}; // not large enough array to store data
        reg.transferBytes(data,data,11); // <--- transferr not enough bytes
        memcpy(sampleRaw,&data[1],11); // memcpy copy one byte out of data range so sampleRaw[10] was undefined
    }
    
    void _ADXL355::downloadSample(uint8_t *sampleRaw){
        uint8_t data[12] = {reg.readAddr(0x06),0,0,0,0,0,0,0,0,0,0,0};
        reg.transferBytes(data,data,12);
        memcpy(sampleRaw,&data[1],11);
    }

Children
No Data