STM32F4 Discovery: USART sending garbage

Although you might have done everything right, your USART / UART on the STM32f4 Discovery board is likely to send garbage characters. There are two main reasons:

  1. You decided to use USART1, which is a problem, because the required pins A9 / A10 are used otherwise (see here for further details and how to solve it)
  2. There is a wrong speed set for the HSE on the Discovery board

For the latter, just replace the predefined 25000000 Hz with the correct 8000000 Hz in stm32f4xx.h

#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */ (around line 100)