Post Go back to editing

ADXL382 三轴数据读出来不对

根据参考手册的配置:

1.Write 0xF0 to Register 0x27 (DIG_EN). Enables x, y, z, and temperature channels. 2. Write 0x0C to Register 0x26 (OP_MODE). Enables HP mode.

轮询 STATUS3寄存器的DATA ready的标志位来读取三轴数据并转换成g值,z轴偏差很大,x,y轴数据异常。

请问还需要哪里配置?

2、配置ODR数据输出速率的主要是下面的SINC _RATEDEC_2X_BYPASS两个参数来控制的嘛?

Parents
  • 根据参考手册中的SELF_TEST步骤进行自检发现,Z轴数据异常,不在自检正常范围内
    [2024-09-09 13:20:36.308] SELFTEST_POSITIVE 2.497040 2.331060 1.512680
    [2024-09-09 13:20:36.308] SELFTEST_NEGATIVE -1.082580 -1.425040 1.862480
    [2024-09-09 13:20:36.308] delta 3.579620 3.756100 0.349800

  • 首先你反复去读这些固定值寄存器来保证数据接口的正确性和稳定性。

    其次,自检没通过加速度计很可能坏了,多测几块板子或芯片结果是什么?

  • 1、反复读取固定寄存器值各5000次,数据无异常

    2、目前手上两个板子自检均有问题,一块xy无异常,z轴异常,一块x,y,z轴均异常

    参考手册自检过程如下:

    static uint8_t ADXL382_Self_Test(void)
    {
        uint8_t ST_POSITIVE[25 * 6] = {0};
        uint8_t ST_NEGATIVE[25 * 6] = {0};
        uint8_t dataready = 0, data_count = 0;
        float positive_x, positive_y, positive_z;
        float negative_x, negative_y, negative_z;
        float delta_x, delta_y, delta_z;

        ADXL382_write_register(ADXL382_DIG_EN, 0x70);       // enable x,y,z
        ADXL382_write_register(ADXL382_OP_MODE, 0x0C);      // enable HP mode
        ADXL382_write_register(ADXL382_SNSR_AXIS_EN, 0xC0); // POSITIVE

        timer_sleep(5);

        while (data_count != 25)
        {
            ADXL382_read_register(ADXL382_STATUS3, &dataready, 1);
            if (dataready == 1)
            {
                ADXL382_read_register(ADXL382_XDATA_H, &ST_POSITIVE[data_count * 6], 6);
                positive_x += (((int16_t)((uint16_t)ST_POSITIVE[data_count * 6] << 8 | ST_POSITIVE[data_count * 6 + 1])) / 2000.0);
                positive_y += (((int16_t)((uint16_t)ST_POSITIVE[data_count * 6 + 2] << 8 | ST_POSITIVE[data_count * 6 + 3])) / 2000.0);
                positive_z += (((int16_t)((uint16_t)ST_POSITIVE[data_count * 6 + 4] << 8 | ST_POSITIVE[data_count * 6 + 5])) / 2000.0);
                data_count++;
            }
        }
        positive_x = positive_x / 25;
        positive_y = positive_y / 25;
        positive_z = positive_z / 25;
        LOGI("SELFTEST_POSITIVE %f %f %f", positive_x * 10, positive_y * 10, positive_z * 10);

        data_count = 0;
        ADXL382_write_register(ADXL382_SNSR_AXIS_EN, 0xE0); // NEGATIVE
        while (data_count != 25)
        {
            ADXL382_read_register(ADXL382_STATUS3, &dataready, 1);
            if (dataready == 1)
            {
                ADXL382_read_register(ADXL382_XDATA_H, &ST_NEGATIVE[data_count * 6], 6);
                negative_x += (((int16_t)((uint16_t)ST_NEGATIVE[data_count * 6] << 8 | ST_NEGATIVE[data_count * 6 + 1])) / 2000.0);
                negative_y += (((int16_t)((uint16_t)ST_NEGATIVE[data_count * 6 + 2] << 8 | ST_NEGATIVE[data_count * 6 + 3])) / 2000.0);
                negative_z += (((int16_t)((uint16_t)ST_NEGATIVE[data_count * 6 + 4] << 8 | ST_NEGATIVE[data_count * 6 + 5])) / 2000.0);
                data_count++;
            }
        }
        ADXL382_write_register(ADXL382_SNSR_AXIS_EN, 0x00);
        ADXL382_write_register(ADXL382_OP_MODE, 0x00);      // diable HP mode
        negative_x = negative_x / 25;
        negative_y = negative_y / 25;
        negative_z = negative_z / 25;
        LOGI("SELFTEST_NEGATIVE %f %f %f", negative_x * 10, negative_y * 10, negative_z * 10);

        delta_x = positive_x - negative_x;
        delta_y = positive_y - negative_y;
        delta_z = positive_z - negative_z;
        LOGI("delta %f %f %f", delta_x, delta_y, delta_z);
        if (delta_x >= SELFTEST_DELTA_MIN_XY && delta_x <= SELFTEST_DELTA_MAX_XY && delta_y >= SELFTEST_DELTA_MIN_XY && delta_y <= SELFTEST_DELTA_MAX_XY && delta_z >= SELFTEST_DELTA_MIN_Z && delta_z <= SELFTEST_DELTA_MAX_Z)
        {
            LOGI("ADXL382 Self Test ok");
            return 1;
        }
        else
        {
            LOGE("ADXL382 Self Test Failed");
            return 0;
        }
    }
  • 采购渠道是哪里?之前描述的数据异常,先不去管自检没通过的通道,通过的通道数据是怎么异常?提供下波形数据定量分析下。

Reply Children