Bosch Sensortec Community

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

    BMA456 no anymotion interrupt

    BMA456 no anymotion interrupt

    olafmeyer
    New Poster

    I want to use the BMA456 for anymotion detection. I'm using the config file from the bma456_an.c of the SensorApi on GitHub.

    But I don't get any interrupts (neither at the INT1-pin nor in the INT_STATUS Reg). Here is what I do:

    bma456WriteReg(0x7C, 0x02);
    busy_wait(TBW_1us(450));//wait for 450us

    bma456WriteReg(0x59, 0x00); //Adr. 0x59: INIT_CTRL

    //write Configfile
    (void)i2cWrite(BMA456_SLAVEADR_WRITE, (uint8*)bma456an_config_file, sizeof(bma456an_config_file));

    bma456WriteReg(0x59, 0x01); //Adr. 0x59: INIT_CTRL

    busy_wait(TBW_1ms(140));//wait for 140ms

    bma456WriteReg(0x41, 0x00);//Adr. 0x41: range

    bma456WriteReg(0x53, 0x0a);//Adr. 0x53: INT1_IO_CTRL
    bma456WriteReg(0x55, 0x01);//Adr. 0x55: INT_LATCH
    bma456WriteReg(0x56, 0x10);//Adr. 0x56: INT1_MAP

    bma456WriteReg(0x28, 0x38);//Adr. 0x28: FEAT_EN_1

    bma456WriteReg(0x7D, 0x04);//Adr. 0x7D: acc_en

    //read reg 0x2A, bit4 == 1? init_ok
    adr = 0x2A;
    (void)i2cWriteRead(BMA456_SLAVEADR, &adr, 1, buf, 1);
    printf("bma456 init: 0x%x", buf[0] & 0x1F);

    //read anymotion config

    adr = 0x5E;
    (void)i2cWriteRead(BMA456_SLAVEADR, &adr, 1, buf, 4);
    printf("bma456 config: 0x%x, 0x%x, 0x%x, 0x%x", buf[0], buf[1], buf[2], buf[3]);

    //write anymotion config

    buf[0] = 0x5E;
    buf[1] = 0x0A;
    buf[2] = 0x00;
    buf[3] = 0x05;
    buf[4] = 0xE0;//axes enable
    (void)i2cWrite(BMA456_SLAVEADR, buf, 5);

     

    reading Register INTERNAT_STATUS returns 0x01 (ASIC initialized)

    Reading the anymotion config returns 0xc8, 0x2e, 0x00, 0x2e. This should be default values 0xcc, 0x00, 0x05, 0x00 according to Application note "Hearables feature set"

     

    any ideas?

    7 REPLIES 7

    Both work for me. As described in Application note AN feature set I do:

    - for any motion: in reg 0x56, enable 0x20; set reg 0x5b to 0x00; set parameters (4 bytes) in reg 0x5e; monitor reg 0x1c for 0x20

    - for no motion: in reg 0x56, enable 0x40; set reg 0x5b to 0x02; set parameters (4 bytes) in reg 0x5e; monitor reg 0x1c for 0x40

     

    Ah, now I got it:

    I took reg 0x56 from the Application Note "Hearables feature set": Bit4 = any_motion_out, Bit5 = no_motion_out
    I should have taken it from the Application Note "AN feature set" (which I didn't know until now): Bit5 = any_motion_out, Bit6 = no_motion_out

     

    But what is that with reg 0x5B? Is that undocumented?

    Yes, as far as I know the two registers 0x5c and 0x5b are undocumented, but they're used in the stream_transfer_write function to write chunk by chunk and in a bunch of other functions to read and write feature settings. I find it more convenient to use these rather than read the entire content of 0x5e to modify only a few bits. I came to wonder why they decided to privilege the latter option.

     

    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