Modes (CPOL/CPHA)
CPOL=0: clock idle low; CPOL=1: idle high. CPHA=0: sample on first edge; CPHA=1: sample on second edge. Modes 0–3 are the four combinations.
Mismatch shifts every bit by one edge — data looks “almost right” but wrong. Always confirm against the slave datasheet timing diagram.
Some parts use “mode 0” naming inconsistently; trust setup/hold relative to CS and first clock.