I am already done with the main part of the roadtest, at least what I was able to do, this is a series of blog posts to complement the RoadTest and to work the features of the Feather, the MAX32630FTHR.
This blog post is to test the BMI160 onboard the device.
TRIAL: BMI160.
I don't know who wrote the Mbed library. The printf function cannot print out integers and floats. Have yet to try with longs and doubles, but I'm assuming not.
Initially, the sample code provided "%f" for all values of the gyro/accelerometer.
Revising the code to this:
oss << "ACC xAxis = " << std::to_string(accData.xAxis.raw) << " : " << my_to_string(accData.xAxis.scaled) << static_cast<double>(accData.xAxis.scaled) << "\n\r" << "ACC yAxis = " << std::to_string(accData.yAxis.raw) << " : " << my_to_string(accData.yAxis.scaled) << "\n\r" << "ACC zAxis = " << std::to_string(accData.zAxis.raw) << " : " << my_to_string(accData.zAxis.scaled) << "\n\r" << "GYRO xAxis = " << std::to_string(gyroData.zAxis.raw) << " : " << my_to_string(gyroData.xAxis.scaled) << "\n\r" << "GYRO yAxis = " << std::to_string(gyroData.zAxis.raw) << " : " << my_to_string(gyroData.yAxis.scaled) << "\n\r" << "GYRO zAxis = " << std::to_string(gyroData.zAxis.raw) << " : " << my_to_string(gyroData.zAxis.scaled) << "\n\r" << "Sensor Time = " << std::to_string(sensorTime.seconds) << "\n\r" << "Sensor Temp = " << std::to_string(imuTemperature) << "\n\r"; pc.write((void*)oss.str().c_str(), oss.str().size() + 1); wait_us(100000);
(of course, with the proper libraries and declarations...)
This yielded,
GYRO zAxis = 48 : 292
Sensor Time = %f
Sensor Temp = %f
ACC xAxis = -2127 : -25
ACC yAxis = 1961 : 23
ACC zAxis = 8714 : 106
GYRO xAxis = -13 : 134
GYRO yAxis = -13 : -103
GYRO zAxis = -13 : -79
Sensor Time = %f
Sensor Temp = %f
ACC xAxis = -1632 : -19
ACC yAxis = 480 : 5
ACC zAxis = 8369 : 102
GYRO xAxis = -22 : -103
GYRO yAxis = -22 : 329
GYRO zAxis = -22 : -134
Sensor Time = %f
Sensor Temp = %f
ACC xAxis = -1008 : -12
ACC yAxis = -576 : -7
ACC zAxis = 8895 : 108
GYRO xAxis = -102 : -987
GYRO yAxis = -102 : 1780
GYRO zAxis = -102 : -621
Sensor Time = %f
Sensor Temp = %f
ACC xAxis = -2777 : -33
ACC yAxis = 1201 : 14
ACC zAxis = 9648 : 117
GYRO xAxis = 758 : -3158
GYRO yAxis = 758 : -725
GYRO zAxis = 758 : 4621
Sensor Time = %f
Sensor Temp
(sorry, can't figure out how to add the code things)
At least we have numbers. This was a sample after shaking the board a bit.
As you can see, time and temp are not printed correctly.
Does the gyro work? Yes. Does the accelerometer work? Yes. Does it work out of the box with the code actually working? No.
At least... it works... that's a plus... right?
Will be experimenting with BLE soon... need to figure out swift.
The wait_ms doesn't work. Needed to use wait_us instead after including the correct library.
The libraries weren't written the best, and some changes were needed. Perhaps at the time of writing, 3 years ago, it was still correct, but it's Mbed OS 6 now, which is far different than the Mbed OS 2 it was written for.
Top Comments