This is a cost-saving board for everyday STM32 projects: an STM32F407VET6 with the parts I usually need around it. I designed it in EasyEDA and had it made at JLCPCB. It is open source. Use it, change it and build your own. Gerbers and BOM are in the Files section.

What is on the board

  • STM32F407VET6 (LQFP100) with an 8 MHz crystal
  • 10 to 15 V input with reverse-polarity protection (SS34), an L78M05 5 V regulator and an AMS1117-3.3
  • A jumper to take 5 V from the DC input or from USB
  • Mini-USB connector for USB CDC (virtual COM port)
  • 20-pin JTAG/SWD connector
  • BOOT switch (SYSTEM / FLASH)
  • RTC with a 32.768 kHz crystal and coin cell backup
  • W25Q16 16 Mbit SPI flash for data storage (see known issues)
  • UART header on PA9 (TX) and PA10 (RX)
  • 16-pin LCD header on port D
  • GPIO headers
  • Four transistor outputs on a 12 V logic connector, for signals to things like a motor driver (see known issues)
  • Two analog inputs, FWD (to PA2) and REV (to PA1), through an LM324 with trim pots
  • Adjustable ADC reference using a TL431 and a trim pot
  • Buttons: reset, PA0 wake-up, PE3 and PE4. LEDs on PA6 and PA7, plus power and USB

Layout and schematic

Known issues in revision 1.0 (read before ordering)

  • 12 V transistor outputs do not switch off as drawn. The BC557C PNP transistors have their emitters on 12 V and their bases driven from 3.3 V pins through 47 k. Even with the pin high, the base is far below 12 V, so the output stays on. The fix is a small NPN stage per channel (for example BC547) that pulls the PNP base down, with a pull-up of about 10 k from the PNP base to 12 V, and a pull-down on the NPN base so outputs stay off at reset. Remove the 100 k pull-ups to 3.3 V (R43, R45 to R47) on those lines.
  • SPI flash chip select is not connected to the microcontroller. U4 pin 1 only goes to the 10 k pull-up R11. Add a wire from U4 pin 1 to a free GPIO on the headers, for example PB12, and use that pin as chip select.
  • PB3 and PB4 are shared with JTAG. SPI1 uses PB3 to PB5, so set debug to Serial Wire (SWD) if you use the flash.
  • Analog inputs: the LM324 runs from 12 V. Set the trim pots so PA1 and PA2 never see more than 3.3 V.

Step by step: build it

  1. Download the Gerber zip and the BOM from the Files section.
  2. Upload the Gerber zip to JLCPCB (or another fab). It is a two-layer board. The BOM lists LCSC part numbers. For assembly service you also need a pick-and-place file, which is not included, so export it from EasyEDA or solder the board by hand.
  3. Solder the power section first: D6, U10, U2 and their capacitors.
  4. Check for shorts, apply 10 to 15 V, and measure 5 V and 3.3 V before going further. Set the 5 V jumper to the source you are using.
  5. Solder the microcontroller, then the crystals, the small parts, and the headers and connectors last.
  6. Check 3.3 V to ground for shorts again, then fit the coin cell.

Step by step: set up the software

  1. In STM32CubeMX (or STM32CubeIDE) start a project for STM32F407VETx.
  2. System Core, SYS: Debug = Serial Wire.
  3. RCC: HSE = crystal, LSE = crystal.
  4. Clock tree: HSE 8 MHz, PLL M = 8, N = 336, P = 2, Q = 7. That gives 168 MHz system clock and 48 MHz for USB.
  5. PA6 and PA7 as outputs (LEDs). PA0, PE3 and PE4 as inputs (buttons).
  6. USART1 on PA9 and PA10. ADC1 channels IN1 (PA1) and IN2 (PA2). RTC clocked from LSE.
  7. For the flash: SPI1 on PB3, PB4 and PB5, plus your chip-select GPIO.
  8. For USB: USB_OTG_FS in device-only mode with VBUS sensing off (PA9 is used by the UART), then add the USB_DEVICE middleware with the CDC class.
  9. Set the toolchain to MDK-ARM and generate the code for Keil.

Step by step: program and test

  1. Open the project in Keil. As a first test, toggle PA6 in the main loop with HAL_GPIO_TogglePin and HAL_Delay(500), then build.
  2. Set the BOOT switch to FLASH, connect an ST-Link (SWD) to the debug header and download.
  3. Without a debugger, you can set the switch to SYSTEM, reset, and use STM32CubeProgrammer with the chip's built-in USB bootloader.
  4. To test USB CDC, call CDC_Transmit_FS to send a short string and watch it on the new COM port.

Files

  • Gerber and drill files (zip)...
Read more »