While it was very good of ST to make the fantastically inexpensive and versatile STM32F4Discovery board, they have made things a little difficult in the choice of peripherals in places.
I use the board as a test bed for my micromouse code. All the micromouse peripherals are wired up to some perfboard that also holds the STM32F4Discovery. The drivers for everything on the mouse can easily be tested and I can experiment with different user interfaces, motor PWM schemes and sensor combinations. All without putting my mouse board at risk.
Generally, this works fine but, for compatibility with my STM32F103 code, I chose to use USART1 as the main serial terminal on the mouse. The STM32f4Discovery schematic shows that the default pin for serial TX on this USART is PA9. That is connected to an LED and a 4.7uF capacitor (C49). The pin is used for the VBUS line on the USB OTG port. The capacitor means that the pin is essentially incapable fo doing any useful serial speed at all.
Since I have no interest in using the USB OTG functions, I simply desoldered the capacitor. Actually, I stood it up on one end so that I could put it back if ever I had a change of heart.
A further look at the schematic shows that pin PC0 is used to enable the STMPS2141 power switch. This will place 5V on the PA9 serial line whenever PC0 is set low. A zero Ohm resistor connects PC0 to the enable line of this switch so I stood that on end as well.
Finally, the LED (LD7) is lit when PA9 is high. However, the base of the driver transistor is not held low so the LED does not turn off reliably. There are pads available on the board to fit a suitable resistor as R57. I chose a 22k resistor so that 3V on PA9 would be enough to turn on the LED but anything less than about 2V would not.
Now I get good serial data out of USART1 and I don’t have to worry about 5V appearing on the line when PC0 is changed. As a bonus, I get the LED (LD7 at the bottom of the board) telling me when there is activity on the PA9 line. The TX line will idle high so the LED is on most of the time.
- The STM32F4Discovery
- STM32F4Discovery Datasheet
- The STMPS2141 power switch
- The Definitive Guide to the ARM Cortex-M3(Amazon)
Incoming search terms:
- stm32f4discovery usart (13)
- stm32f4 project (10)
- yhs-fh_lsonsw (7)
- stm32f4 usart example (3)
- STM32F4 USB OTG schematic (3)
- подключение can к stm32f4 (2)
- STM32F4 Discovery USART dma (1)
- example code for using usart on stm32f4discovery (cortex m4-f) using freertos (1)
- stm32f4discovery usb serial (1)
- stm32f4discovery usart usb (1)