The NSS (Slave Select, the leading N denotes "negated", i.e. active low) signal of SPI causes lots of confusion.
In slave mode, it's quite straigforward - it's an input signal, which gates the MISO input and threestates MISO when high (so that multiple slaves can be simply wired together), and when going from high to low, it resets the internal clock counter, so that it serves as a byte-level framing signal.
In master mode, NSS may have two very different roles: the more usual is, that it is set as an output by setting SPIx_CR2.SSOE, when it is supposed to control the slaves - although in a not very well designed manner.
If SPIx_CR2.SSOE = 0, NSS works as an input; when it is low, the module automatically switches from master to slave. User is notified of this by SPIx_SR.MODF bit being set (while SPIx_CR1.MSTR bit gets cleared simultaneously). The reason for this behaviour is an attempt for a relatively cumbersome multi-master arrangement: the idea is, that multiple masters have their NSS set to Open Collector, pulled up and wired together; then when any of them desires to transmit, it pulls NSS down, which turns all others to slaves. However, there are no clear guidelines in RM (nor is there an appnote dealing with this), how exactly to proceed after this, and perhaps more importantly, there's no mechanism to prevent two masters attempting to go to "active transmitting" simultaneously; so, at the end of the day, this is not a very useful feature.
But it is already there, and it may be confusing for those, who don't want to use the NSS pin in master mode (given it's not very useful either, they want to drive the select pin of slave(s) "manually", using any pin in GPIO Out mode) - if they leave SPIx_CR2.SSOE = 0, SPI very likely won't work. The reason is, that if there is no pin configured in GPIO as AF for the SPIx_NSS, the internal NSS input node is set to 01. And this, as explained above, will switch SPI surprisingly to Slave.
The remedy is easy, set SPIx_CR2.SSOE = 1 even if the actual SPIx_NSS pin is not intended to be used as output, and no pin is set as AF for SPIx_NSS in GPIO.
Another option is to set both SPIx_CR1.SSM = 1 and SPIx_CR1.SSI = 1 -- the former will replace the internal NSS input signal by the value of SPIx_CR1.SSI, and the latter being 1 prevents the switching to slave mode.