General rule: you can't cast the left side of an assignment.
Also, it will give an hardfault when try to force this.
The peripheral registers have to be accessed by half-words (16 bits) or words (32 bits).
The SPI1->DR register is already defined as an volatile uint16_t in the header. C will perform an
implicit type conversion when you use it.
And you will have to wait for SPI to finish. The SPI Master is completed when RXNE = 1 and BUSY = 0.