Dear moderators and engineers！
I have encountered problems when using BSXLite to generate quaternions on BMX160, as described below. Previously considering BMI160+BMM150, the problem was the same. Later, because BOSCH sales staff suggested using BMX160, the problem also exists. I think it is a simple link that has a problem. Please help me check it out:
MCU: Cortex M3,
Language: C programming,
Compiler Environment： MDK5
System situation: BLE-Stack
1. The main functions initialization
2. void my_bsx_init() Functions achieve as follows：
3. Operate Algorithm library， updataing value of sensors. Program will run to this function per 30mS
My Bsx step process Functions achieve as below:
4. Get quaternion, Program will call follows functions to take quaternion
Finally no changes with quaternion
Solved! Go to Solution.
I use BMX160 in one of my projects and I've had no problem retrieving quaternion data from the library. Have you considered using BMI160 and BMM150 drivers for communicating with the IMU (BMI160, BMM150)? I understand that this may not be your ultimate goal, but maybe it would be useful to pinpoint where the problem is. Additionally, here's the topic that cleared a thing or two for me.
Disclamer: I am far from an expert and I'm also not a Bosch employee. Bosch engineers will certainly have better advice.
Dear Marko Njirjak
Yes, I have read the post you posted and checked the related program and found no similar problems. Are you using the Cortex MCU as well? I think the search for quaternions is not too complicated. If there is a comparison block, maybe I can find the reason. Can you show me the code you used to retrieve the quaternion?
thank you very much!
yes, I use Cortex M4F.
Here are some sample codes:
a) BSX Lib initialization
initParam_t s_input; s_input.accelspec = (BSX_U8 *)&bsxLibConfAcc; s_input.magspec = (BSX_U8 *)&bsxLibConfMag; s_input.gyrospec = (BSX_U8 *)&bsxLibConfGyro; s_input.usecase = (BSX_U8 *)&bsxLibConf; bsx_init(&s_input);
b) Feeding data to BSX lib (this is done every 10ms)
libraryInput_ts.acc.data.x = accel_data.x; libraryInput_ts.acc.data.y = accel_data.y; libraryInput_ts.acc.data.z = accel_data.z; libraryInput_ts.acc.time_stamp = accel_data.sensortime*39; // BMX160 timestamp resolution is 39us, hence multiplying by 39 libraryInput_ts.gyro.data.x = gyro_data.x; libraryInput_ts.gyro.data.y = gyro_data.y; libraryInput_ts.gyro.data.z = gyro_data.z; libraryInput_ts.gyro.time_stamp = gyro_data.sensortime*39; libraryInput_ts.mag.data.x = bmm.data.x; libraryInput_ts.mag.data.y = bmm.data.y; libraryInput_ts.mag.data.z = bmm.data.z; libraryInput_ts.mag.time_stamp = accel_data.sensortime*39; bsx_dostep(&libraryInput_ts);
c) Quaternion acquisition
ts_dataquatf32 quaternion; bsx_get_orientdata_quat(&quaternion);
I do use BMI160+BMM150 sensor APIs, i.e. I'm not fetching registers directly.