CAN compasses selection

Just out of curiosity, why are compasses on CAN-bus only added last?
It seems to me that a compass on CAN-bus could be more reliable than the internal compasses, or is the CAN-bus still too new and not entirely thrustworthy yet?

PS: I know I can bypass the internal compasses with the COMPASS_TYPEMASK parameter, I just want to know why CAN-bus is currently last in the list of compasses to add.

Thanks in advance.

Regards, Roel

Perhaps it doesn’t matter?

Didn’t know priority could be changed now, that is great. Is it a 4.0 feature or already in 3.6.x and i missed it?

Compass priority is available in latest master.

It seems it’s only in Master.The screenshot was from the Simulator so I checked with another FC running V4.0.4-dev and the feature is there. On current stable its not.

It is a great feature i think.

The new development seems great!
I’ll be happy once it’s included in the stable branch
(or if it takes too long, I’ll take it from master)

Yes, the compass priority change should be popular and we are planning on including it in Copter-4.0.4. It’s a significant change though so it’ll need some thorough beta testing. We hope that beta testing will start in about a month.

Hey @rmackay9
Today When I was testing the same, Dual CAN compass used to shuffle at every boot. Probably due to dynamic node allocation. How can we stop that from happening?


I’ve heard of this but I’m really not sure how to resolve it (I’ll ask around). I know that the Copter-4.0.4 update will maintain the order.

It does maintain the order. Only the CAN compasses get swapped sometimes. Other SPI/I2C compass stay where they were.

@rmackay9, @Mallikarjun_SE
See my post on the subject here: Copter-4.0.0 released!
This has nothing to do with dynamic node allocation (id’s are allocated consistently based on CPU ID). However compass number is assigned based on initialization order which is not deterministic for CAN compasses.

Even the GPS1 and GPS2 get swapped during initialisation.

The only way to solve this (at list this is the way I´m doing it) is to program a fixed address for each CAN GPS. The lower number will be GPS 1 (I´m using address 124 (GPS 1) and 125 (GPS 2)) . This also solved my compass shifting problem at boot. Now always GPS 1 (124) is my compass (compass 3 when using CAN). My problem before fixing the GPS address: I made the compass calibration for one compass, but mission planner asked again for compass calibration on the next boot since the system has chosen the other GPS (Compass) witch I did not made the compass calibration (Murphys law :)).

Hy Its about two weeks I am stuck with my here+ rtk . Actually I want to use external Barometer on my pixhawk2.4.8 .My problem is when I change the hardware switch to CAN mode my external compass is unable to detect,even no sign of barometer. I also saw whenever I change the hardware switch from I2C to CAN mode a bluish low rate blink starts. I am using new firmware 4.0.3

thanks for the feedback,
but the main question why i started the thread is why the can compasses are last.
If this decision is just arbitrary, I can bump them forward in the code.
If they are still less trustworthy, if leave the ordering as is.


I agree that we should have made the CAN compasses appear first just like the other external compass that use I2C. This was discussed but in the end the effort was put into a much more complete solution that allows the user to select more flexibly which compasses they want to use and their priority. This change will be included in Copter-4.0.4 and you can see a preview of MP’s enhanced setup page here:

1 Like

Why not just statically assign a node ID to each compass?

Thanks for your answer Randy!
For now i can change the order of the compasses myself, as I use a custom build.
I just wanted to know whether the current place in the sequence was just arbitrary or a deliberate choice.
I think the new development is a great improvement and will give us a lot more control and insight of all the available compasses in the system, so I’m looking forward to it.

Is there any way now (4.0.3) to fly with 2 Can GPS Here2 and guaranty that the same one always boots to be the compass?

While using 3.6.12 I was able to program address 124 and 125 for GPS 1 and 2. This worked perfectly every time (always used GPS 1 (lower address) for compass). Also it seemed to me that both GPS booted at the same time (blue leds came up at the same time on both GPS). I upgraded to 4.0.3 since GPS Blending does not work with CAN HERE2 on 3.6.12. But to my surprise (we had an accident - Pre arm check was OK but on take off the compass switched to the other GPS with no compass…), even if I program GPS address like before, the compass goes to the first one that boots (no respect to address). This means, about 50% of the time I turn on the copter, he asks for compass calibration. I also noticed (my impression) that on version 4.0.3 GPS boot behavior is different. Sometimes one GPS boots about 1 to 2 seconds after the other. The one that boots first gets the compass… Now I´m flying with an extra weight, since I turned my GPS2 off.