SPI Transfer with STM32F4 board gets stuck on SPI_WaitTX
There is lots of code that you haven't given to us, but since you are new to the STM32 family, I will explain the "classic cause" for this type of problem as this is probably the cause for you too.


On many STM32 cores, including the STM32F4 on your board, the various peripheral block clocks are disabled by default, to save power. If your code tries to access an unclocked peripheral block, you trigger a "Bus Fault" in the core.
A "hang" on devices with ARM Cortex-M3 &amp; M4 cores, is commonly caused by code which has either:

a) triggered a "Fault" type which is not a "Hard Fault", but does not have a registered fault-handler for that specific type of Fault; this then causes it to be escalated to become a "Hard Fault"; or  

b) directly triggered a "Hard Fault".

The default "Hard Fault handler" for many Cortex-M3 &amp; M4 toolchains is a simple infinite loop e.g. while (1) {}. You can install your own Fault handler code, but unless you do that, then triggering any type of Fault typically becomes a hang in a Fault handler. For simple investigations, you can then use your SWD/JTAG&#8209;attached debugger to find more about the core's state and read the relevant registers to find more information.


Now you can see that you put those two situations together and a hang which occurs on the first access to a peripheral block (in your case, SPI), is likely to be because you didn't enable the clock to that peripheral block. That attempted access triggers a Bus Fault. Either the default Bus Fault handler in your toolchain is an infinite loop, it was enabled (e.g. in your toolchain's startup code) and your core is sitting in that loop, or no Bus Fault handler was enabled so this Fault was escalated to become a Hard Fault, and you are sitting in the Hard Fault handler's infinite loop.

If my hypothesis is correct for your case, at least part of the fix would be to enable the SPI peripheral clock module before attempting to access it, using something like this line, if you have included the CMSIS headers:

RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);

I don't promise that this line is exactly correct for your MCU (it's currently too late for me to check datasheets here) but it gives you a clue of the type of thing you need to investigate. Note: You will also need to enable the peripheral clocks for whichever GPIO modules you are using for the various SPI-related pins.

P.S. In future, please try to include an MCVE (Minimum Complete Verified Example) of your code i.e. the smallest complete code example which still shows whatever problem you are requesting help with. That way, we don't have to guess what the missing code might include (or not include). Thanks!