BMA456 - ASIC not initialized

Hi,

I'm using BMA456 accelerometer with I2C interface, with the following initialization code:

uint16_t bma456_device_init()
{
uint16_t rslt = BMA4_OK;

/* Modify the parameters */
s_dev.dev_addr = BMA4_I2C_ADDR_PRIMARY << 1;
s_dev.interface = BMA4_I2C_INTERFACE;
s_dev.bus_read = bma456_access_read;
s_dev.bus_write = bma456_access_write;
s_dev.delay = OS_PL_Delay;
s_dev.read_write_len = READ_WRITE_LEN_16;
s_dev.resolution = RESOLUTION_12_BIT;
s_dev.feature_len = BMA456_FEATURE_SIZE;

/* a. Reading the chip id. */
rslt |= bma456_init(&s_dev);

if(rslt != BMA4_OK)
{
   //ASSERT
}

/* b. Performing initialization sequence.
c. Checking the correct status of the initialization sequence.
*/

rslt |= bma456_write_config_file(&s_dev);

if(rslt != BMA4_OK)
{
   //ASSERT
}

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

/* Assign the desired settings */
accel_conf.odr = BMA4_OUTPUT_DATA_RATE_100HZ;
accel_conf.range = BMA4_ACCEL_RANGE_16G;
accel_conf.bandwidth = BMA4_ACCEL_NORMAL_AVG4;

/* Set the configuration */
rslt |= bma4_set_accel_config(&accel_conf, &s_dev);

if(rslt != BMA4_OK)
{
   //ASSERT
}

/* Enable the accelerometer */
rslt |= bma4_set_accel_enable(1, &s_dev);

return rslt;

The code get into assert after "rslt |= bma456_write_config_file(&s_dev);". When I debug it I saw that the problem occure after reading the config_stream_status i.e the ASIC not initialized. When I'm running the code in Debug-Mode I don't see this problem.

1. Can you help me understand why the ASIC not initialized?

2. Do I have to run bma456_write_config_file? when I removing this line the code work without problems...

Thanks

Nitzan

1 reply