There was not enough memory to start the EKF
What ArduPilot says:
- EKF2 IMUNGSF: allocation failed
- EKF3 allocation failed
- EKF3 not enough memory
- NavEKF2: memory allocation failed
- NavEKF2: core N setup failed
- NavEKF2: not enough memory available
Also explained here: 3 more
- EKF3 IMUNGSF: allocation failed
- EKF3 IMUN GSF: not enough memory
- EKF2 IMUN GSF: not enough memory
The EKF, ArduPilot's position and attitude estimator, needs a large block of memory for each copy it runs (one per IMU in EK3_IMU_MASK), and more for the GSF yaw estimator. At start-up the board did not have it. After “EKF3 not enough memory” or “allocation failed” the EKF is switched off until the next reboot, and the aircraft will not arm. The GSF lines mean the EKF copy for that IMU could not be set up and will be tried again.
What to do, most likely first
A small board (F4, or an F7 with little RAM) runs too many memory-hungry features at once: Lua scripting, terrain, a large log buffer.
CheckThe ground station shows the free memory (freemem).
SCR_ENABLE1 with a largeSCR_HEAP_SIZEis the usual culprit.FixSwitch off what you do not use (
SCR_ENABLE,TERRAIN_ENABLE), reduceSCR_HEAP_SIZEandLOG_FILE_BUFSIZE, then reboot.More EKF copies are asked for than the board can hold, or EKF2 and EKF3 are both enabled.
Check
EK3_IMU_MASKis 3 or 7 (two or three copies);EK2_ENABLEis 1 as well asEK3_ENABLE.FixSet
EK2_ENABLEto 0. On a small board setEK3_IMU_MASKto 1, one copy on the first IMU, and reboot.
Parameters to look at
| Parameter | What it is |
|---|---|
EK3_IMU_MASK | Bitmask of active IMUs |
EK2_ENABLE | Enable EKF2 |
EK3_GSF_RUN_MASK | Bitmask of which EKF-GSF yaw estimators run |
SCR_ENABLE | Enable Scripting |
SCR_HEAP_SIZE | Scripting Heap Size |
LOG_FILE_BUFSIZE | Logging File and Block Backend buffer size max (in kilobytes) |
TERRAIN_ENABLE | Terrain data enable |
Where to do it:Firmware InspectorStarting Parameters
The code that sends it
EKF2 IMUNGSF: allocation failed
libraries/AP_NavEKF2/AP_NavEKF2_core.cpp NavEKF2_core::setup_core() · Open in ArduPilot Copter-4.7.1
EKF3 allocation failed
libraries/AP_NavEKF3/AP_NavEKF3.cpp NavEKF3::InitialiseFilter() · Open in ArduPilot Copter-4.7.1
EKF3 not enough memory
libraries/AP_NavEKF3/AP_NavEKF3.cpp NavEKF3::InitialiseFilter() · Open in ArduPilot Copter-4.7.1
NavEKF2: memory allocation failed
libraries/AP_NavEKF2/AP_NavEKF2.cpp NavEKF2::InitialiseFilter() · Open in ArduPilot Copter-4.7.1
And 5 more messages, sent from the same places.