I copied board_ILI9341_spi.h from boards/addons/gdisp for my nucleo32 STM32L432 project
Couldn't get the LCD working, so I attached a logic analyser and ever byte that was being written was followed by a 0x00, which was obviously screwing up the init procedure.
Turns out on the newer STM32's "SPI2->DR = data;" is a 16bit write to the DR register, which puts the low byte on the FIFO, followed by the high byte - always zero in this case as it's supposed to be an 8 bit transfer.
This makes the SPI device perform two 8 bit transfers.
I finally found my google-foo this morning after a few wasted hours last night and you need to cast the DR register to a uint8_t when you do the write:
*((uint8_t*)&SPI3->DR) = (uint8_t) data;
The STM32F4's don't do data packing on the DR register, but the newer L4's do. I assume other recent STM32's do as well.