Why the spin keeps going
According to the wiki, a violent yaw spin turns the frame so fast that the motors swap places (rotate 180 degrees) in 40 ms or less, about as fast as a motor can change speed. By the time a pitch or roll correction actually changes motor speed, that motor is already on the opposite side of the quad. The corrections start feeding the wobble instead of damping it. At the same time the PID loop keeps switching motors up and down to chase huge pitch and roll readings, so nothing puts full effort into stopping the yaw. The result can be a spin that lasts a very long time.
Pure high-rate pitch spins and axle rolls do not cause this. The key ingredient is a very high yaw rate combined with pitch and roll movement.
What yaw spin recovery does
When the yaw rate goes over the threshold, Betaflight gives all motor authority to stopping the spin and drops every other PID and throttle input. One diagonal pair of motors goes to full power, the other pair to minimum. When the yaw rate has fallen 100 deg/s below the threshold and stayed there for 20 ms, control goes back to the pilot. The quad may still be rotating at that point, but with the PIDs active again it settles quickly.
The wiki shows a log of a small ground strike with an MPU gyro and an 800 deg/s threshold: the yaw rate peaked around 1800 deg/s within 2 ms, normal control came back after about 140 ms, and the quad was flyable again about a quarter of a second after impact. In the worst case recorded there, a hard hit with bent props, recovery mode stayed active for about 600 ms. Most spins, the wiki says, resolve in under 400 ms.
What you should do on the sticks: nothing special. The wiki's advice is to cut throttle, centre the sticks and be ready either to take back control or to disarm. Recovery drives the quad at about 50% effective throttle, so it may shoot off briefly sideways to the spin axis, but it should not climb much and you do not need to add throttle. If the spin lasts longer than about half a second, suspect a gyro overflow, a badly bent prop or another hardware problem, and disarm.
OFF, ON or AUTO
In the CLI there are two settings:
yaw_spin_recovery-OFF,ONorAUTO.yaw_spin_threshold- the spin rate in deg/s that triggers recovery, range 500-1950, used only withON.
AUTO arrived with pull request #9455 and has been the default since Betaflight 4.2. It calculates the threshold from the maximum yaw rate in the current rate profile, plus an overshoot margin of 25% of that rate or 200 deg/s, whichever is larger. The result is clamped to 500-1950. In the Betaflight source this looks like:
threshold = constrain(maxYawRate + MAX(maxYawRate / 4, 200), 500, 1950)
A profile with 800 deg/s max yaw therefore gets a 1000 deg/s threshold. A profile with 1200 deg/s gets 1500. Because the value is recalculated when rates change, switching rate profiles in flight also moves the threshold. That is the main reason to stay on AUTO.
Check what you have with:
get yaw_spin
If you set the threshold by hand with ON, the wiki's guidance is 100-200 deg/s above your maximum configured yaw rate. For a quad with 700 deg/s max yaw it gives set yaw_spin_threshold = 850. Lowering the threshold from 1950 to 1000 cuts the time spent in a typical out-of-control spin roughly in half, according to the same page.
Set ON and a threshold only if you have a reason, for example you want it tighter than AUTO calculates. Then run save.
When the threshold is too low
If the maximum yaw rate in your rates is higher than the threshold, a long deliberate yaw spin will trip recovery over and over. The wiki describes it with an example: rates up to 1000 deg/s, threshold at 800. The quad speeds up to 800 deg/s, the opposite motor pair goes to full power and brakes it to about 700, control comes back, the quad speeds up again. For that short moment you have no pitch or roll authority. You see yaw jittering between 700 and 800 deg/s, some pitch and roll wobble, and hear an odd noise.
The fix is to raise the threshold or lower the maximum yaw rate. On AUTO this cannot happen, because the threshold always sits above the configured maximum.
Racing pilots rarely go past 500 deg/s on yaw even in fast turns, per the wiki. Freestyle pilots who do sustained yaw spins with rates around 1000 deg/s are the ones who hit a hand-set threshold. Pilots who fly line of sight in acro with high yaw rates may prefer to switch the feature off, the wiki notes.
Gyro overflow detect
gyro_overflow_detect (values OFF, YAW, ALL, default ALL) exists for ICM gyros. When they are pushed past their range, the output can overflow and flip sign, so the flight controller sees the spin going the wrong way. A comment in the Betaflight gyro code notes that ICM gyros are specified to +/-2000 deg/s and that an overflowed reading tends to show up as about +1996 or -1996.
With ALL, Betaflight turns off all PIDs as soon as any axis goes over 1950 deg/s. Since it no longer knows which way the quad is turning, it drops all motors to idle until every axis is below 1850 deg/s. The quad does not fight the spin during that time, so it can take a while.
The wiki says it is unwise to turn this off on a quad with an ICM gyro, and that it does nothing useful on MPU gyros. It also answers the obvious question: yes, yaw spin recovery is still worth having on an ICM gyro. With a threshold of, say, 800, the quad is brought below 800 deg/s faster and more cleanly than overflow protection alone would manage. For a big crash the wiki estimates that an ICM gyro relying only on overflow protection could take more than 3-4 seconds to slow down enough on its own.
Why it doesn't fly back to the original heading
The wiki explains this too. Restoring heading and attitude would need accelerometer and magnetometer data, and those can be wrong right after an impact. Such a recovery would also take time and could fight the pilot's inputs. Betaflight only stops the spin and hands control back.
Short version
- Leave
yaw_spin_recovery = AUTOandgyro_overflow_detect = ALLunless you have a specific reason to change them. - If yaw stutters during long deliberate yaw spins, check
get yaw_spin. A manual threshold below your max yaw rate is the usual cause. - After a clip: throttle down, sticks centred, and disarm if the spin doesn't stop within about half a second.