Post Go back to editing

ADXL357 Activity Interrupt Issue

Thread Summary

The user is troubleshooting why the ADXL357 device does not trigger activity interrupts on the INT1 pin despite setting the activity threshold to 0.0975 g. The final answer suggests correcting the ODR value from 0x0A to 0x03 for 500 Hz and setting the activity enable register to 0x04 to track only the Z-axis. The user confirms these changes but still does not observe interrupts, even when the Z-axis acceleration drops below the threshold. The final answer indicates that reading the STATUS register is necessary to clear the interrupt.
AI Generated Content
Category: Software
Product Number: ADXL357

Hello,

We are using the ADXL357 device as a vibration sensor in our custom board. The device has been configured as per the attached configuration register settings. However, we are not observing any activity interrupts on the INT1 pin.We have set the activity threshold to 5000 (≈ 0.0975 g, calculated as 5000 × 19.5 µg/LSB).

static int adxl357_simple(char* args, char* response){
    UNUSED(args); UNUSED(response);
    char str[64];

    UART_PutString("Configuring ADXL357...\r\n");

    // === Step 1: Basic Configuration ===
    
    uint8_t i2c_speed = 0x01;    // Setting I2C Speed to 400KHz
    I2CWriteBytes(0x1D, 0x2C, 1, &i2c_speed);

    uint8_t odr_value = 0x0A;    // Output Data Rate set to 500Hz
    I2CWriteBytes(0x1D, 0x28, 1, &odr_value);
    
    uint8_t act_en = 0x01;    // Activity enable register
    I2CWriteBytes(0x1D, 0x24, 1, &act_en);

    uint8_t act_count = 0x01;    // Activity count
    I2CWriteBytes(0x1D, 0x27, 1, &act_count);

    uint8_t intr_ftn = 0x18;    // Interrupt function setting
    I2CWriteBytes(0x1D, 0x2A, 1, &intr_ftn);
    
     uint8_t act_th_h = 0x13;    // Threshold Register High
    I2CWriteBytes(0x1D, 0x25, 1, &act_th_h);

    uint8_t act_th_l = 0x88;    // Threshold Register Low
    I2CWriteBytes(0x1D, 0x26, 1, &act_th_l);
    
    uint8_t x_offset_h = 0xFF;    // X-axis offset High (-85 value in 2's compliment)
    I2CWriteBytes(0x1D, 0x1E, 1, &x_offset_h);
    
    uint8_t x_offset_l = 0xAB;    // X-axis offset Low (-85 value in 2's compliment)
    I2CWriteBytes(0x1D, 0x1F, 1, &x_offset_l);
    
    uint8_t y_offset_h = 0xFF;    // Y-axis offset High (-125 value in 2's compliment)
    I2CWriteBytes(0x1D, 0x20, 1, &y_offset_h);
    
    uint8_t y_offset_l = 0x83;    // Y-axis offset Low (-125 value in 2's compliment)
    I2CWriteBytes(0x1D, 0x21, 1, &y_offset_l);
    
    uint8_t z_offset_h = 0x00;    // Z-axis offset High (185 value in 2's compliment)
    I2CWriteBytes(0x1D, 0x22, 1, &z_offset_h);
    
    uint8_t z_offset_l = 0xB9;    // Z-axis offset Low (185 value in 2's compliment)
    I2CWriteBytes(0x1D, 0x23, 1, &z_offset_l);
    
    uint8_t measurement_value = 0x00;    // Measurement
    I2CWriteBytes(0x1D, 0x2D, 1, &measurement_value);

    UART_PutString("Registers configured.\r\n");

    // === Step 2: Loop and read X/Y/Z every 2s ===
    while (1)
    {
        uint8_t buf[9];
        uint8_t intr_stat;
        int32_t x, y, z;
        float x_g, y_g, z_g;
       

        // Burst read 9 bytes: XDATA3..ZDATA1
        I2CReadBytes(0x1D, 0x08, 9, buf);

        // X-axis
        x = ((int32_t)buf[0] << 16) | ((int32_t)buf[1] << 8) | buf[2];
        x >>= 4;
        if (x & 0x80000) x |= 0xFFF00000;

        // Y-axis
        y = ((int32_t)buf[3] << 16) | ((int32_t)buf[4] << 8) | buf[5];
        y >>= 4;
        if (y & 0x80000) y |= 0xFFF00000;

        // Z-axis
        z = ((int32_t)buf[6] << 16) | ((int32_t)buf[7] << 8) | buf[8];
        z >>= 4;
        if (z & 0x80000) z |= 0xFFF00000;
        
        x_g = convert_to_g(x, sensitivity);
        y_g = convert_to_g(y, sensitivity);
        z_g = convert_to_g(z, sensitivity);
        
        char str[64];
        sprintf(str, "X=%.3f g  Y=%.3f g  Z=%.3f g\r\n", x_g, y_g, z_g);
        UART_PutString(str);
        
        //sprintf(str, "X=%ld  Y=%ld  Z=%ld\r\n", x, y, z);
        //UART_PutString(str);
        
        //char str[64];
        //sprintf(str, "Sensitivity =%.3f \r\n", sensitivity);
        //UART_PutString(str);
        
        UART_PutString("*****************************\r\n");
        
        I2CReadBytes(0x1D, 0x04, 1, &intr_stat);
        sprintf(str, "ADXL357 Interrupt Status = 0x%02X\r\n", intr_stat);
       UART_PutString(str);
        
        UART_PutString("-----------------------------\r\n"); // separator line

        //CyDelay(1000); // wait 1 seconds
    }

    return 1;
}

As per the attached serial port log, the X-axis data crosses 0.1 g multiple times, but the INT1 pin does not show any interrupt.

Serial_port_log.txt

For reference, we have also attached oscilloscope waveforms showing:

Yellow waveform – INT1 pin (configured for activity interrupt)

Green waveform – INT2 pin (configured for data-ready interrupt)

Request your guidance in resolving this issue.

Regards,
Prashant 

  • Hello  thanks for the comprehensive post!

    After reading your code:

      uint8_t i2c_speed = 0x01;    // Setting I2C Speed to 400KHz
        I2CWriteBytes(0x1D, 0x2C, 1, &i2c_speed);


    you are also configuring the FSR, nothing wrong here just wanted to point that detail about the comment.


        uint8_t odr_value = 0x0A;    // Output Data Rate set to 500Hz
        I2CWriteBytes(0x1D, 0x28, 1, &odr_value);


    This is not correct, if I am not wrong 0xA would give you and ODR of 4Hz, and a LPF corner of 1Hz.

    Should be enough to detect gravity as you are trying now, but you should change this for tracking inclination, vibrations, etc

    You can check table 45 from the DS: ADXL356/ADXL357/ADXL357B (Rev.D)



     uint8_t act_en = 0x01;    // Activity enable register
        I2CWriteBytes(0x1D, 0x24, 1, &act_en);


    Here I would write a 0x04 in case you want to track activity only in the Z-axis as you are doing in your test, right now unless you face gravity against X-axis there will be no interruption.

    you can check table 41 of the DS as reference:



    I am also curious about your offset configurations, but this should not be the source of the issue on a first glance either.

    hope this helps, best regards.

    Mario SM

  • Hello  ,

    Thank you for your response.

    You are correct regarding the value 0x0A at address 0x28, which corresponds to an ODR of 4 Hz and an LPF corner of 1 Hz. I had missed this in my earlier code. I have now updated it to 0x03 (ODR = 500 Hz, LPF corner = 125 Hz).

    As suggested, I also updated register 0x24 to 0x04 so that only the Z-axis is tracked for activity, and I removed the Z-axis offset value.

    On my custom board with the ADXL357 device, when the board is at rest on the table, the Z-axis acceleration reads approximately +1.060 g. I have set the activity threshold to 0xC4 (0x25) and 0x50 (0x26), which corresponds to 50256 decimal ≈ 0.98 g.

    However, when I safely drop the board and the Z-axis value goes below 0.98 g, the interrupt pin (INT1) still remains high, and no interrupt is detected.

    ( I am not reading the Interrupt status register at address 0x04 as it will clear the bits. I am checking the interrupt level on interrupt pin using oscilloscope in run time.)

    Could you please guide me on whether I am missing any other configuration parameter?

    Best regards,
    Prashant

  • Hello   glad to hear it works now.

    As stated in the DS you need to read the STATUS reg in order to clear the interruption.

    Do you have any limitation that prevents you from reading that register?

    regards,

  • Hello  ,

    The interrupt pin INT1 still remains high, indicating no activity-based interrupt is being triggered even during vibrations.

    Currently, there are no limitations in reading the registers. However, since the interrupt on INT1 pin never asserted, there will be no use in reading or clearing this register.

    I suspect there may be some issue with the threshold configuration. Under normal conditions (no vibrations), I observed approximately 1.06 g on the Z-axis data, and the offset is 0. Could you please provide an example calculation for setting the threshold of 1.2 g and its corresponding values to be written in the threshold registers 0x25 and 0x26 for better understanding ?

    Regards,
    Prashant

  • Hello  ,

    We are awaiting your response. Kindly revert.

    Regards,

    Prashant

  • Hello  excuse the delay I am working on several commitments on the summer come back.

    Could you set the act threshold to a value under around 35000 LSB (for 10g FSR should be well under 0.9g) and see if gravity triggers the interruption?

    (the way of configuring the threshold value showed in your previous snippet of code is correct under my understanding)

    thanks again for the patience,

    Mario SM