A more careful glance at the MPU-9250 suggests actually most of the MPU-6050 code works fine; most of the new function is in new registers or unused bits in existing registers.
However, there are some changes for which I need to work out how to update the code:
- my main processing loop frequency has dropped to 300Hz from the 800Hz I’ve achieved with the MPU-6050. The spec does describe changes in this area, but it’s not at all clear. UPDATE: The problem actually lies with the new device tree mechanism added to the Raspberry Pi distribution in 2015/1/31. To get the bus speed up to 400kbps, you need to add into /boot/config.txt:
- the offset / gains provided for the MPU-6050 to map between the 16 bit temperature sensor reading have changed, and the spec does not provide a revised version; as an example it thinks it’s 40ºC in my house instead of the 22ºC my thermometer says. An initial analysis (offset, gain) of ~(55,200) whereas the MPU-6050 values are (36.53, 340):
ºC = sensor * gain + offset
I can find the offset and gain values for the temperature mapping through experimentation;
I’m a lot more worried about the processing speed – I think I’m going to have to read that section a lot more carefully. Luckily, the local shop had printer paper in stock!