Why does SPI1 master RXONLY keep an extra byte only with CPHA=1 + GPIO LOW speed?
- 11 replies
- 37 views
STM32G474, SPI1 master RXONLY, 8-bit, MSB first, CPOL=0 / CPHA=1, NSS software, CS on a plain GPIO. Sensor: MT6701 in SSI mode, 24-bit frame. Read: HAL_SPI_Receive(&hspi1, buf, 3, ...).
Only one of four combinations fails:
SCK / MISO GPIO speed CPOL / CPHA 3-byte read
LOW 0 / 1 24 SCK pulses, frame wraps by 8 bits (33 E8 20 read as E8 20 33)
MEDIUM / HIGH / VERY_HIGH 0 / 1 32 SCK pulses, correct
LOW 1 / 0 correct
full duplex 0 / 1 24 SCK pulses, correct
The wrap-around means one extra byte is returned first and the last byte of the frame is lost. Rotating the bytes back makes the CRC pass, so the data on the wire is correct and only the alignment is wrong.




Two measurements:
- At LOW the first byte is available 0.27 us after SPE = 1; at MEDIUM it takes a full byte time (about 6.2 us). 0.27 us is far too short for a clocked byte.
- A 3-byte request produces 24 SCK pulses at LOW and 32 at the other speeds. A 4-byte request produces 32 at LOW and 40 at the others.
SR shows no overrun (OVR = 0) and no error flag in any of these cases. The wrap-around looks like an RX overrun or an extra buffered byte, but the registers do not show one. That is what makes this puzzling.
Question:
why does only the LOW + CPHA=1 combination leave an extra byte in the RX path? What is different inside the peripheral for that combination?
