# Mag read failed

**URL:** <https://forum.zubax.com/t/mag-read-failed/55>\
**Category:** Sensors\
**Created:** [December 21, 2015, 3:25am UTC](https://forum.zubax.com/t/mag-read-failed/55 "2015-12-21T03:25:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![joey](https://forum.zubax.com/letter_avatar_proxy/v4/letter/j/f14d63/32.png) [@joey](https://forum.zubax.com/u/joey)\
**Post date:** [December 21, 2015, 3:25am UTC](https://forum.zubax.com/t/mag-read-failed/55/1 "2015-12-21T03:25:02Z")

</div>

Hi Pavel,

I have encountered some problems with the use of APM firmware:

Serial port zubax\_gnss module has been printed:  
…  
Mag read failed  
Mag read failed  
Mag read failed  
…

nsh\> uavcan status  
…  
Sensor ‘gnss’:  
RX errors: 0, receiver node id: 50

Sensor ‘mag’:  
devname: /dev/mag  
channel 0: node id 50 → class instance 1  
channel 1: empty  
channel 2: empty  
channel 3: empty  
channel 4: empty  
…

I use the APM firmware is V3.3.2 Copter,and zubax\_gnss\_fw\_v1.bin.

GPS is ok, but CAN’s external magnetic compass is not calibrated, which is why?

thanks,  
Joey.

---

<div class="post-metadata">

**Author:** ![pavel-kirienko](https://forum.zubax.com/user_avatar/forum.zubax.com/pavel-kirienko/32/180_2.png) [@pavel-kirienko](https://forum.zubax.com/u/pavel-kirienko)\
**Post date:** [December 21, 2015, 12:39pm UTC](https://forum.zubax.com/t/mag-read-failed/55/2 "2015-12-21T12:39:30Z")

</div>

Either the compass IC or the I2C bus are broken. Considering the fact that your CAN2 is also malfunctioning, I would suggest you to replace the whole unit. Has it been damaged in some way?

If you have soldering equipment, I would suggest to resolder the compass IC (it’s position is shown on the diagram here: [docs.zubax.com/zubax\_gnss](https://docs.zubax.com/zubax_gnss)).

---

<div class="post-metadata">

**Author:** ![joey](https://forum.zubax.com/letter_avatar_proxy/v4/letter/j/f14d63/32.png) [@joey](https://forum.zubax.com/u/joey)\
**Post date:** [December 22, 2015, 10:04am UTC](https://forum.zubax.com/t/mag-read-failed/55/3 "2015-12-22T10:04:21Z")

</div>

## Yes, I’ve been to the magnetic compass chip again.

þWatchdog: Reset was not caused by watchdog, it’s OK  
Config: 13 params restored  
CAN bitrate 1000000  
Air sensor disabled  
Watchdog: Global timeout set to 1000 ms  
Watchdog: Global timeout set to 1100 ms  
Git commit hash: 0x04C6F06D  
UDID: 35 FF DA 05 46 4E 34 34 43 58 17 43 00 00 00 00  
Time sync disabled  
UAVCAN node started, ID 50

## ChibiOS/RT Shell ch\> Mag self test sample, positive, x/y/z: 245 233 247 Mag self test sample, negative, x/y/z: -238 -231 -244 GNSS init… ublox: Trying baudrate 9600… ublox: Trying baudrate 115200… ublox: Trying baudrate 57600… ublox: Trying baudrate 38400… ublox: Baudrate match 38400 ublox: Unknown message: class=0x0A id=0x28 payload\_len=8 ublox: MON-GNSS supported=7 default=3 enabled=5 simultaneous=2 Mag read failed Mag read failed Mag read failed …

My CAN2 is good, this is the CAN2 print data:  
0x1134c808 0x00 0x00 0x00 0x01 0xff 0xf0 0x00 0x00 0x04 Extended Data  
0x1134c809 0x00 0x00 0x00 0x01 0xff 0xfc 0x00 0x00 0x04 Extended Data  
0x1134c80a 0x00 0x00 0x00 0x01 0xff 0xe0 0x00 0x00 0x04 Extended Data  
0x1134c80b 0x00 0x00 0x00 0x01 0xff 0xe0 0x00 0x00 0x04 Extended Data  
0x1134c80c 0x00 0x00 0x00 0x01 0xff 0xe0 0x00 0x00 0x04 Extended Data  
0x1134c80d 0x01 0x00 0x00 0x01 0xff 0xe0 0x00 0x00 0x04 Extended Data  
0x080cc808 0x69 0xb8 0x63 0xb0 0xdc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc809 0x6c 0xb8 0x63 0xb0 0xcc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80a 0x6c 0xb8 0x6a 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x1134c80e 0x01 0x00 0x00 0x01 0xff 0xfc 0x00 0x00 0x04 Extended Data  
0x080cc80b 0x69 0xb8 0x63 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80c 0x69 0xb8 0x63 0xb0 0xdc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80d 0x67 0xb8 0x63 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80e 0x69 0xb8 0x6a 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x1134c80f 0x01 0x00 0x00 0x01 0xff 0xf0 0x00 0x00 0x04 Extended Data  
0x080cc80f 0x6c 0xb8 0x5b 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc808 0x6c 0xb8 0x63 0xb0 0xcc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc809 0x6a 0xb8 0x63 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80a 0x67 0xb8 0x6a 0xb0 0xdc 0x30 0x1f 0x1d 0x08 Extended Data  
0x1134c808 0x01 0x00 0x00 0x01 0xff 0xf8 0x00 0x00 0x04 Extended Data  
0x080cc80b 0x69 0xb8 0x63 0xb0 0xe3 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80c 0x69 0xb8 0x6a 0xb0 0xcc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80d 0x6c 0xb8 0x6a 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80e 0x69 0xb8 0x63 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x1134c809 0x01 0x00 0x00 0x01 0xff 0xfc 0x00 0x00 0x04 Extended Data  
0x080cc80f 0x6a 0xb8 0x5b 0xb0 0xdc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc808 0x67 0xb8 0x63 0xb0 0xdc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc809 0x69 0xb8 0x63 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80a 0x6c 0xb8 0x6a 0xb0 0xcc 0x30 0x1f 0x1d 0x08 Extended Data  
0x1134c80a 0x02 0x00 0x00 0x01 0xff 0xe0 0x00 0x00 0x04 Extended Data  
0x080cc80b 0x6c 0xb8 0x63 0xb0 0xcc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80c 0x67 0xb8 0x5b 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80d 0x69 0xb8 0x5b 0xb0 0xcc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80e 0x6a 0xb8 0x6a 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x1134c80b 0x02 0x00 0x00 0x01 0xff 0xf0 0x00 0x00 0x04 Extended Data  
0x080cc80f 0x6c 0xb8 0x6a 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc808 0x67 0xb8 0x6a 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc809 0x69 0xb8 0x6a 0xb0 0xcc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80a 0x67 0xb8 0x6a 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x1134c80c 0x02 0x00 0x00 0x01 0xff 0xf0 0x00 0x00 0x04 Extended Data  
0x080cc80b 0x6a 0xb8 0x72 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80c 0x67 0xb8 0x63 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80d 0x6c 0xb8 0x63 0xb0 0xcc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80e 0x6c 0xb8 0x6a 0xb0 0xcc 0x30 0x1f 0x1d 0x08 Extended Data  
0x1134c80d 0x02 0x00 0x00 0x01 0xff 0xf0 0x00 0x00 0x04 Extended Data  
0x080cc80f 0x6a 0xb8 0x5b 0xb0 0xdc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc808 0x65 0xb8 0x63 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc809 0x69 0xb8 0x63 0xb0 0xe3 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80a 0x67 0xb8 0x6a 0xb0 0xcc 0x30 0x1f 0x1d 0x08 Extended Data  
0x1134c80e 0x02 0x00 0x00 0x01 0xff 0xf0 0x00 0x00 0x04 Extended Data  
0x080cc80b 0x6a 0xb8 0x6a 0xb0 0xcc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80c 0x6a 0xb8 0x63 0xb0 0xcc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80d 0x6a 0xb8 0x6a 0xb0 0xdc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80e 0x69 0xb8 0x6a 0xb0 0xe3 0x30 0x1f 0x1d 0x08 Extended Data  
0x0964c800 0x52 0xaa 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c810 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c820 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c830 0x00 0x00 0x04 0xc5 0xef 0xff 0x00 0x00 0x08 Extended Data  
0x0964c848 0x00 0x00 0x00 0x00 0x00 0x40 0x56 0x00 0x08 Extended Data  
0x0974c800 0x2f 0x11 0x40 0x56 0x40 0x56 0x40 0x56 0x08 Extended Data  
0x0974c810 0x40 0x56 0x40 0x56 0x40 0x56 0x40 0x56 0x08 Extended Data  
0x0974c828 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x02 Extended Data  
0x1134c80f 0x03 0x00 0x00 0x00 0x00 0x07 0xff 0xff 0x04 Extended Data  
0x080cc80f 0x65 0xb8 0x63 0xb0 0xdc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc808 0x6a 0xb8 0x72 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x0964c801 0x52 0xaa 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c811 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c821 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c831 0x00 0x00 0x04 0xc5 0xef 0xff 0x00 0x00 0x08 Extended Data  
0x0964c849 0x00 0x00 0x00 0x00 0x00 0x40 0x56 0x00 0x08 Extended Data  
0x080cc809 0x6a 0xb8 0x63 0xb0 0xcc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80a 0x69 0xb8 0x63 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x0964c802 0x52 0xaa 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c812 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c822 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c832 0x00 0x00 0x04 0xc5 0xef 0xff 0x00 0x00 0x08 Extended Data  
0x0964c84a 0x00 0x00 0x00 0x00 0x00 0x40 0x56 0x00 0x08 Extended Data  
0x1134c808 0x03 0x00 0x00 0x00 0x00 0x00 0xff 0xff 0x04 Extended Data  
0x080cc80b 0x67 0xb8 0x63 0xb0 0xdc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80c 0x67 0xb8 0x6a 0xb0 0xdc 0x30 0x1f 0x1d 0x08 Extended Data  
0x0964c803 0x52 0xaa 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c813 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c823 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c833 0x00 0x00 0x04 0xc5 0xef 0xff 0x00 0x00 0x08 Extended Data  
0x0964c84b 0x00 0x00 0x00 0x00 0x00 0x40 0x56 0x00 0x08 Extended Data  
0x080cc80d 0x6a 0xb8 0x6a 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc80e 0x6a 0xb8 0x63 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x0964c804 0x52 0xaa 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c814 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c824 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c834 0x00 0x00 0x04 0xc5 0xef 0xff 0x00 0x00 0x08 Extended Data  
0x0964c84c 0x00 0x00 0x00 0x00 0x00 0x40 0x56 0x00 0x08 Extended Data  
0x1134c809 0x03 0x00 0x00 0x00 0x00 0x00 0xff 0xff 0x04 Extended Data  
0x080cc80f 0x69 0xb8 0x6a 0xb0 0xcc 0x30 0x1f 0x1d 0x08 Extended Data  
0x080cc808 0x69 0xb8 0x6a 0xb0 0xd4 0x30 0x1f 0x1d 0x08 Extended Data  
0x0964c805 0x52 0xaa 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c815 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c825 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x08 Extended Data  
0x0964c835 0x00 0x00 0x04 0xc5 0xef 0xff 0x00 0x00 0x08 Extended Data  
0x0964c84d 0x00 0x00 0x00 0x00 0x00 0x40 0x56 0x00 0x08 Extended Data  
0x080cc809 0x69 0xb8 0x6a 0xb0 0xdc 0x30 0x1f 0x1d 0x08 Extended Data  
…

* * *

## Start printing information and flight control: … Starting FMUv2 sensors hmc5883: no device on bus 2 hmc5883: driver start failed No external hmc5883(Why did not identify the external magnetic compass?) hmc5883: no device on bus 1 hmc5883: driver start failed No internal hmc5883 … PX4: param\_find(UAVCAN\_NODE\_ID) PX4: param\_find(UAVCAN\_BITRATE) uavcan: Node ID 1, bitrate 1000000 uavcan: SW version vcs\_commit: 0x7f16e4d6 uavcan: sensor bridge ‘gnss’ init ok uavcan: sensor bridge ‘mag’ init ok uavcan: sensor bridge ‘baro’ init ok [uavcan\_mag] adding channel 50… [uavcan\_mag] channel 50 class instarted uavcan OK stance 1 ok [batt\_smbus] on I2C bus 2 at 0x0b (bus: 100 KHz, max: 100 KHz) Found batt\_smbus [oreoled] on I2C bus 2 at 0x68 (bus: 100 KHz, max: 100 KHz) uavcan: GNSS receiver node ID: 50 …

How can I be sure that I use the magnetic compass on my zubax\_gnss module?

---

<div class="post-metadata">

**Author:** ![pavel-kirienko](https://forum.zubax.com/user_avatar/forum.zubax.com/pavel-kirienko/32/180_2.png) [@pavel-kirienko](https://forum.zubax.com/u/pavel-kirienko)\
**Post date:** [December 22, 2015, 10:45am UTC](https://forum.zubax.com/t/mag-read-failed/55/4 "2015-12-22T10:45:12Z")

</div>

If you followed the setup instructions provided here, your APM will use the external compass: [docs.zubax.com/zubax\_gnss/tutor … th\_pixhawk](https://docs.zubax.com/zubax_gnss/tutorials/using_with_pixhawk)  
Although I am not sure how one can verify which compass is being used.

Concerning your question on why the firmware reports “No external hmc5883”: this message only indicates that the firmware could not find an external I2C compass, which is expected. It has no relation to a CAN-interfaced compass.

Seems like you have repaired CAN2, what was the problem with it?

---

<div class="post-metadata">

**Author:** ![joey](https://forum.zubax.com/letter_avatar_proxy/v4/letter/j/f14d63/32.png) [@joey](https://forum.zubax.com/u/joey)\
**Post date:** [December 23, 2015, 6:54am UTC](https://forum.zubax.com/t/mag-read-failed/55/5 "2015-12-23T06:54:20Z")

</div>

Yes, my CAN receiver chip is bad. I’ve switched to another SN65HVD230.

Can you leave your email to me?My Friend！

thanks，  
joey.

---

<div class="post-metadata">

**Author:** ![pavel-kirienko](https://forum.zubax.com/user_avatar/forum.zubax.com/pavel-kirienko/32/180_2.png) [@pavel-kirienko](https://forum.zubax.com/u/pavel-kirienko)\
**Post date:** [December 23, 2015, 10:02am UTC](https://forum.zubax.com/t/mag-read-failed/55/6 "2015-12-23T10:02:56Z")

</div>

My email is actually in my profile: [pavel.kirienko@zubax.com](mailto:pavel.kirienko@zubax.com).
