Understanding IMU\INS numbering

This is sort of a niche topic with not a lot of information out there.
I searched through the forum and through the source code but couldn’t understand it properly.

Say I am using a board with 2 IMUs, OmnibusF7V2. And I want to disable the usage of the “first one”.
“First one” is the first one described in the hwdef file of the board.

As seen here, I can disable it pretty easily by setting the INS_ENABLE_MASK = 2 (or simply setting its LSB to 0).

Now I wonder -

  1. How does EKF3 deal with it? Specifically EK3_IMU_MASK
  • If I set the mask to =2, I get an error. If I set it to 1 or 3, no error. That lead me to believe that a few ‘numbering’ of IMUs is ‘generated’, meaning first IMU of this mask is the first enabled IMU.
  • I also want to set GSF, that means I need to configure a certain EKF to use it - should I configure EKF1, since only 1 IMU is enabled?
  • Is there a way to make sure the other IMU won’t be a fallback, since it would be catastrophic if it will be used during flight.
  1. How do INS_USE and INS2_USE affect any of it?

As long as I remember, INS_ENABLE_MASK=2 makes the rest of the system pretend that your second IMU is the one and only IMU.

(Please devs correct me if I am too wrong) Basically, at startup the system enumerates all the IMU entries listed in hwdef, in order, and the following happens for the i-th entry:

  • if the i-th bit in INS_ENABLE_MASK is 0, the iteration is skipped;
  • the driver written in that entry is initialized for the pins specified in that entry;
  • if the initialization sequence succeeds, the IMU is considered existing, and it receives an index (first IMU that came alive becomes first, the second one becomes second, etc).

If you disable your first IMU through INS_ENABLE_MASK, EKF3 will see only the enabled one (which will have bit index of 0), and it will start only one EKF core, etc. So this seems to be the ideal solution to your problem.

We followed your suggestions and it seems to be OK.
Although we currently struggle with continuous GPS glitches, which I’m not sure it this is related or not.