Important Cookie Information

This website uses absolutely necessary cookies. If you consent to the use of convenience cookies, please click “Yes, I agree.” By clicking on “Privacy Settings.” you can change this setting at any time and withdraw your given consent. Icon down see more You can find detailled information in our Privacy Policy Icon forward-right
Icon up see less

Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BMA423 tap wakeup interrupt not firing

    New Poster

    BMA423 tap wakeup interrupt not firing

    Hi.  I'm trying to get the BMA423 wakeup tap interrupt to work and am not getting any interrupt status  line change.

    I have confirmed that my I2C reads/writes work properly by instrumenting the lines (and checking with a Salae), can read the chip ID, can successfully pass the config file write, and can read X,Y,Z data from the accelerometer itself.  Here is my code if anyone can see what I'm missing...  (note that I have removed sections of code not relevant to the bma423 calls).  I have also tried to get several other features working, but never get an interrupt change - I'm only really interested in tap though.

    Thanks in advance for any help, insight or experiments to try

    // BMA423 interface bringup

    uint16_t status = BMA4_OK;
    struct bma4_int_pin_config int_pin_config;

    /* Modify the parameters */
    f_dev.dev_addr = BMA4_I2C_ADDR_PRIMARY;
    f_dev.interface = BMA4_I2C_INTERFACE;
    f_dev.bus_read = USER_i2c_read;
    f_dev.bus_write = USER_i2c_write;
    f_dev.delay = USER_delay_ms;
    f_dev.read_write_len = 8;

    status = bma423_init(&f_dev);

    // ** Removed code verifying success

    /* Enable the accelerometer */
    bma4_set_accel_enable(BMA_ACCEL_ENABLE, &f_dev);

    /* Declare an accelerometer configuration structure */
    struct bma4_accel_config accel_conf;

    /* Assign the desired settings */
    accel_conf.odr = BMA4_OUTPUT_DATA_RATE_1600HZ;
    accel_conf.range = BMA4_ACCEL_RANGE_4G;
    accel_conf.bandwidth = BMA4_ACCEL_NORMAL_AVG4;
    accel_conf.perf_mode = BMA4_CONTINUOUS_MODE;

    /* Set the configuration */
    status |= bma4_set_accel_config(&accel_conf, &f_dev);

    // ** Removed code verifying success

    /* Declare an instance of the sensor data structure */
    struct bma4_accel sens_data;

    /* Read the sensor data into the sensor data instance */
    status |= bma4_read_accel_xyz(&sens_data, &f_dev);

    // ** Removed code verifying success

    // Set the platform
    status |= bma423_select_platform(BMA423_PHONE_CONFIG, &f_dev);

    // Set up the wakeup feature
    status |= bma423_tap_selection(0, &f_dev); // 0 = double tap, 1 = single tap

    status |= bma423_wakeup_set_sensitivity(0x0, &f_dev); // 0 = most sensitive, 7 = least sensitive

    // ** Removed code verifying success

    // Turn on the wakeup feature
    status |= bma423_feature_enable(BMA423_WAKEUP, 1, &f_dev); // measures in z direction only

    // Variable to define two interrupt lines
    uint8_t int_line[2] = { BMA4_INTR1_MAP, BMA4_INTR2_MAP };

    // Variable to define feature interrupts to be mapped
    uint16_t int_map[2] = { BMA423_STEP_CNTR_INT | BMA423_NO_MOTION, BMA423_WAKEUP_INT | BMA423_ANY_MOTION};

    // Mapping line interrupt 1 with that of two sensor feature interrupts -
    // Step counter and wake up interrupt
    status |= bma423_map_interrupt(int_line[0], int_map[0], BMA4_ENABLE, &f_dev);
    status |= bma423_map_interrupt(int_line[1], int_map[1], BMA4_ENABLE, &f_dev);

    // ** Removed code verifying success

    int_pin_config.edge_ctrl = 0x01; // 0 = level, 1 = edge
    int_pin_config.lvl = 0x01; // 0 = active low, 1 = active high
    int_pin_config.od = 0x0; // 0 = push-pull, 1 = open drain
    int_pin_config.output_en = 0x01; // 0 = output disabled, 1 = output enabled
    int_pin_config.input_en = 0x0; // 0 = input disabled, 1 = input enabled. input used for fifo things
    status = bma4_set_int_pin_config(&int_pin_config, 0, &f_dev);
    status = bma4_set_int_pin_config(&int_pin_config, 1, &f_dev);

    //reset before reading
    int_pin_config.edge_ctrl = 0;
    int_pin_config.lvl = 0;
    status |= bma4_get_int_pin_config(&int_pin_config, 0, &f_dev);

    int_pin_config.edge_ctrl = 0;
    int_pin_config.lvl = 0;
    status |= bma4_get_int_pin_config(&int_pin_config, 1, &f_dev);

    // ** Removed code verifying success

    // ** Tap the device multiple times in all orientations

    uint16_t int_status = 0;

    /* Read the interrupt status register */
    status |= bma423_read_int_status(&int_status, &f_dev);

    // *** No matter what I do, int_status always reads 0, although the read is successful

    2 REPLIES 2
    Community Moderator

    Re: BMA423 tap wakeup interrupt not firing

    From the code, can not see any instruction indicating that the configuration file has been downloaded.

    Without the configuration file, the tap and step counter cannot work.

    Could you please tell us whether you have downloaded the configuration file successfully and share the API version you are using?


    New Poster

    Re: BMA423 tap wakeup interrupt not firing

    Wow.  A cut and paste error.

    Thanks so much - I can't believe I didn't spot that.