Wednesday, 12 October 2016

MPU9250, continued

This is a note on building support for the MPU9250 9-axis chip in the AdaPilot project (the AdaRacer hardware). It continues this report.

Concerns were self-test and performance, particularly the removal of busy-waiting.


When testing the AK8963, it's important if you're testing against the 16-bit resolution values to actually put the device into 16-bit mode when requesting the self-test. Doing this (and allowing up to 5 retries, as in this Samsung code) works, both on the AdaRacer board and on a breakout board connected to an STM32F407-Disco.


The main problem is the lengthy time (more than a milliseond of CPU) to read the AK8963 data. Possible approaches include

  1. decreasing the Ada tick rate to 100 μs
  2. using one of the MCU's timers to manage short intervals
  3. using the MPU9250 FIFO

Of these, the least intrusive would probably be using the FIFO, but it seems that (in spite of the extensive if opaque description in the Register Map) it's not possible to get magnetometer data into the FIFO unless you're using the (proprietary) Digital Motion Processor firmware.

It's quite straightforward to use one of the MCU's timers (spec, body). However, there are some issues:

  • The MCU has 14 timers, but they aren't as independent as you'd like; TIM14 shares an interrupt with (some aspects of) TIM8.
  • This code isn't task-safe; some way would need to be found to ensure that only one task at a time tries to use it.

No comments:

Post a Comment