PANIC: failed to take _spi_sem 100 times in a row, in AP_Compass_AK8963::_update

I am having this issue when connecting to APM from wi fi
pi@navio-rpi ~ $ sudo ArduPlane -A udp:
Raspberry Pi 1 with BCM2708!
PANIC: failed to take _spi_sem 100 times in a row, in AP_Compass_AK8963::_update

It works until the parameters are loaded and then suddenly disconnects. Also it says there is not enough data points to calibrate the compass. Any ideas ?

Ok I got it to connect via radio now and it seems to work the same, I could calibrate the barometer and accelerometer but it still gives me the same error and I can’t calibrate anything anymore…Can’t calibrate the compass as well. @CodeChief what do you think ?

Okay first I presume by “can’t run the compass calibration” you mean the APM/ground control software is reporting an error or did not get enough data?

The usual next step when a sensor appears to be malfunctioning, is to run the sample program to unit test the hardware outside of APM. In this case we want to test the magnetometer inside the MPU9250. If the data is good then it should just be a software issue rather than hardware fault.

The error appears to be coming from Emlid’s Linux HAL for APM, so one of their guys is best to diagnose that with you. That chip is connected via SPI and the message suggests problems talking to the chip. I haven’t looked at the APM HAL source but a semaphore is commonly used to synchronize access, so I guess this technical message is equivalent to simply “No response from MPU9250 after 100 attempts”.

Emlid will not doubt require copies of all output and errors messages to help you further. Hopefully it’s just a driver initialization problem rather than a permanent fault. I would also do a fresh install/re-write of the SD to rule-out Linux configuration/update issues. Also you should try both the original Emlid APM build (the apm.deb) and the new “latest” DIY Drones build (see APM 3.3-rc9 beta testing - #23 by CodeChief for instructions how to download).

Thanks… I’ve downloaded the latest DIY drones buid for ArduPlane and now when I type sudo ArduPlane -A udp etc… nothing is showing up :confused:

Ok uninstalled everything and re installed APM from the emlid docs.
Still the same problem with the compass !

@Maysun_Hassanaly do you connect to RPi over SSH? It’s okay if there is no output in the console when you run APM, that just means that that autopilot ran fine and keeps working. Please try DIYdrones build once again and see if you can connect to running APM using APM planner.