SPI ICs may clock in and out on different clock edges (rising, falling).
If data out changed on clock rising edge, you likely want to clock in on clock falling edge, in centre of bit, after bit has stabilized (or even next rising edge).
Many CPUs allow you to configure what edges to clock data in/out on so you can match to many ICs without needing inverters on clock signals.
Check your STM32CubeMX settings for SPI for clock edge used.
If you clock in and out on same edge you'll be clock in at data transition = may get garbage input.
The delay between edges is suspicious, as if that picture would show waveforms from two different SPIs... which pins are we talking about? Are there other SPIs active on that board?
Prepare a minimal but complete compilable program exhibiting the problem and post.