Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    BMA423 tap wakeup interrupt not firing

    BMA423 tap wakeup interrupt not firing

    kmaier
    New Poster

    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

    shellywang
    Occasional Contributor

    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?

     

    Wow.  A cut and paste error.

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

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist