How to use bmx160 correctly

Hi, I am a student from China and I am currently using the bmx160 to get a three-axis Angle for my personal diy robot.I'm using stm32 control.Since I could not find the official API and had no password, I wrote the driver code by referring to the data manual.During this period, I have met some questions, which I hope can be answered by the Bosch.First, I do a self-test of the accelerometer.The following two graphs are the data I obtained.

What confused me was that the Y-axis data didn't seem to be quite right and had reached saturation (the acceleration self-test was written strictly according to the Datasheet, 8G range), and the minimum differential signal on the X-axis didn't seem to reach 2G.I suspect it's a chip problem, and I'd like some answers.Thanks.😀

The amplitude of the deflection sets low:


Z-axis facing up

X-axis facing up

Y-axis facing up


X

Y

Z

X

Y

Z

X

Y

Z


0.6145

1.6519

1.6687

1.6787

1.7437

0.6052

0.6147

2.6621

0.6050

-0.3433

-1.4688

0.7229

0.6147

-1.4697

-0.3401

-0.3435

-0.4592

-0.3401


0.6150

1.6523

1.5505

1.6792

1.7439

0.6045

0.6143

2.6614

0.6047

-0.3428

-1.4690

0.7236

0.6152

-1.4692

-0.3403

-0.3433

-0.4595

-0.3398


0.6147

1.6516

1.5503

1.6790

1.7437

0.6047

0.6145

2.6616

0.6057

-0.3433

-1.4692

0.7236

0.6147

-1.4692

-0.3401

-0.3425

-0.4595

-0.2217

The amplitude of the deflection sets high:


Z-axis facing up

X-axis facing up

Y-axis facing up


X

Y

Z

X

Y

Z

X

Y

Z


2.4246

7.8025

2.8501

3.3821

7.9856

1.6685

2.3184

7.9998

1.7861

-2.0469

-7.4360

-0.4580

-1.0884

-7.3447

-1.6404

-1.7861

-6.3345

-1.5222


2.4243

7.8945

2.8501

3.3828

7.8938

1.7869

2.3179

7.9998

1.7861

-2.0461

-7.5276

-0.4585

-0.9824

-7.3438

-1.5217

-2.1528

-6.3342

-1.5212


2.4243

7.8023

2.8501

3.3821

7.8943

1.7864

2.3176

7.9998

1.7866

-2.0464

-7.4360

-0.4583

-0.9819

-7.3442

-1.5220

-2.1528

-6.3340

-1.5222

Also, my magnetometer data kept coming in at 0, and I was confused.

BMX160_SPI_Write(BMX160_MAGN_IF_0_ADDR, 0x80);
HAL_Delay(50);
// Sleep mode
BMX160_SPI_Write(BMX160_MAGN_IF_3_ADDR, 0x01);
BMX160_SPI_Write(BMX160_MAGN_IF_2_ADDR, 0x4B);
// REPXY regular preset
BMX160_SPI_Write(BMX160_MAGN_IF_3_ADDR, 0x04);
BMX160_SPI_Write(BMX160_MAGN_IF_2_ADDR, 0x51);
// REPZ regular preset
BMX160_SPI_Write(BMX160_MAGN_IF_3_ADDR, 0x0E);
BMX160_SPI_Write(BMX160_MAGN_IF_2_ADDR, 0x52);
//Prepare MAG_IF[1-3] for mag_if data mode
BMX160_SPI_Write(BMX160_MAGN_IF_3_ADDR, 0x02);
BMX160_SPI_Write(BMX160_MAGN_IF_2_ADDR, 0x4C);
BMX160_SPI_Write(BMX160_MAGN_IF_1_ADDR, 0x42);

BMX160_SPI_Write(BMX160_MAGN_CONFIG_ADDR, 0x08);        //100HZ
BMX160_SPI_Write(BMX160_MAGN_IF_0_ADDR,   0x02);
HAL_Delay(50);

Hope to hear from you as soon as possible. Thanks again.

1 reply