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

Layout and schematic

Known issues in revision 1.0 (read before ordering)

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

If you build one or find another problem, leave a comment. I take on PCB and embedded design for remote clients: intricate-lab.com.