02-13-2020 06:39 PM
Hello, we are using the BMA253. I am trying to get the orientation bits to show up, but they act as if they are blocked.
In register ox2c I write 0x00, to set no blocking, but still get no data, is there a blocking flag to check? The data sheets states that the data will not upate if blocking is on, but I set for no blocking?
Reading from 0x0c I get the flat bit toggling on to 1 both +Z and -Z, but OREINT<2:0> always returns zero, 0x80 is all I ever see regardless of orientation.
What else could be stopping OREINT<2:0> from updating?
Solved! Go to Solution.
02-14-2020 09:33 PM
02-14-2020 10:09 PM
Hello and thank you for your reply, I had already seen that document, it is well written and very clear, that is why I am so confused on why this is not working. I am doing polling the ORIENT<2:0> bits and the flat bit to determine orientation on start up, we do not need an interrupt. I am polling register 0x0C during this test mode at every data ready interrupt, and displaying on a UART debug with the accel data. The accel data was clear and cogent, the flat bit tracked perfectly, but orient<2:0> never changed from 000b. Here is my config code, I added the defines in with comments to show you the values. Based on what I am reading it looks like it is blocking, but I am writing to, and verified the write, to set NO BLOCK. Is there a flag that tells if blocking is active?
void AccelConfig(void){
// issue a reset
// #define BMA253_RESET 0xB6
AccelWriteByte(BMA253_RST_ADDR, BMA253_RESET); CyDelay(5);
// remove blocking and set orient mode to symetrical
// #define No_block_Symmetrical 0x00
AccelWriteByte(BMA253_ORIENT_PARAM_ADDR,No_block_Symmetrical);
// remove blocking and set orient mode to symetrical
AccelWriteByte(BMA253_THETA_BLOCK_ADDR,No_block_Symmetrical);
//start the sampling engine
// #define Data_rate_7_81hz 0x08
AccelWriteByte(BMA253_BW_SELECT_ADDR, Data_rate_7_81hz); // configure the bandwidth
// #define Data_Rdy_enable 0x01
AccelWriteByte(BMA253_INTR1_MAP_1, Data_Rdy_enable); // Map data ready to INT1
//AccelWriteByte(BMA253_DATA_CTRL_ADDR, Disable_Shadow); // use filtered data, set Shadow so that MSB/LSB data is locked and
// Setup Slope interrupt
AccelWriteByte(BMA253_INTR1_MAP_0, SLOPE_INT1); // Map slope int to INT1
AccelWriteByte(BMA253_SLOPE_THRES_ADDR, local_settings[LC_THR]); // set the threshold
AccelWriteByte(BMA253_SLOPE_DUR_ADDR, MOTION_DURATION); // set the duration
AccelWriteByte(BMA253_INTR_CTRL_ADDR, BMA253_LATCH_DURN_NON_LATCH); // no latching
AccelWriteByte(BMA253_INTR_SET_ADDR, Ints_Drive_Config); // configure INTs push pull, active low;
// enable the interrupts
AccelWriteByte(BMA253_INTR_ENABLE0_ADDR,XYZ_MOTION_IN_ENA|Flat_detection_enable); // Enable the slope interrupt // enable flat detection
AccelWriteByte(BMA253_INTR_ENABLE1_ADDR, New_data_enable); // Start new data interrupt
// Start Accel Slope interrupt
isr_Accel_StartEx(isr_ACCEL);
isr_Accel_ClearPending();
Accel_ClearInterrupt();
DBG_PRINT_TEXT("\n\r Initialized Accelerometer for High G Motion detection");
return;
} //Accelconfig
polling code:
DBG_PRINTF("\r XYZTB:%d,%d,%d ", xyztb[0], xyztb[1], xyztb[2]);
AccelReadByte(BMA253_THETA_BLOCK_ADDR);
temp = Accel_Byte;
DBG_PRINTF("Max value is: %d ",valuemax);
AccelReadByte(BMA253_STAT_ORIENT_HIGH_ADDR);
temp = Accel_Byte;
DBG_PRINTF("Orientation: %x ",temp);
02-14-2020 11:28 PM
Hi,
Your code looks OK. In order to see the change of orient<2:0> from 000b, you need to enable BMA253 orientation interrupt by writing the value of 0x40 to register 0x16. So you can add one line in your function "AccelConfig(void)" that enables the orientation interrupt.