==== STM32 F4 discovery ====
{{:boards:f4.jpg?200}}
The STM32 F4 discovery is an evaluation board for the ARM Cortex-M4 STM32F407VGT6 MCU.
This board has an integrated [[:tools:stlink|STLink]] compatible interface which can be configured to allow the programming of either the board itself or to program an external device.
As with all STM evaluation boards there is lengthy list of restrictions in place regarding what you can and can't do with an evaluation board. See [[https://www.st.com/resource/en/evaluation_board_terms_of_use/evaluationproductlicenseagreement.pdf|this]] document.
=== Pinout ===
JP2 GND STLINKv2 USB GND JP3
GND GND
CN2 SWD
1 VDD_TARGET
2 SWCLK CN3 ST-LINK
3 GND x
4 SWDIO x
5 NRST x
6 SWO x
GND 1 2 GND GND 1 2 GND
VDD 3 4 VDD 5V 3 4 5V
GND 5 6 NRST 3V 5 6 3V
PC1 7 8 PC0 JP1 STM32F407VG PH0 7 8 PH1
PC3 9 10 PC2 idd PC14 9 10 PC15
PA1 11 12 PA0 PE6 11 12 PC13
PA3 13 14 PA2 PE4 13 14 PE5
PA5 15 16 PA4 PE2 15 16 PE3
PA7 17 18 PA6 PE0 17 18 PE1
PC5 19 20 PC4 LEDS PB8 19 20 PB9
PB1 21 22 PB0 ORANGE PD13 BOOT0 21 22 VDD
GND 23 24 PB2 GREEN PD12 RED PD14 PB6 23 24 PB7
PE7 25 26 PE8 BLUE PD15 PB4 25 26 PB5
PE9 27 28 PE10 PD7 27 28 PB3
PE11 29 30 PE12 USER PA0 RESET NRST PD5 29 30 PD6
PE13 31 32 PE14 BUTTONS PD3 31 32 PD4
PE15 33 34 PB10 PD1 33 34 PD2
PB11 35 36 PB12 PC12 35 36 PD0
PB13 37 38 PB14 PC10 37 38 PC11
PB15 39 40 PD8 PA14 39 40 PA15
PD9 41 42 PD10 PA10 41 42 PA13
PD11 43 44 PD12 PA8 43 44 PA9
PD13 45 46 PD14 PC8 45 46 PC9
PD15 47 48 NC PC6 47 48 PC7
GND 49 50 GND AUDIO OUT USB OTG GND 49 50 GND
USART2 TX PA2
USART2 RX PA3
I2C1 SCL PB6 PB8
ICC1 SDA PB7 PB9
SPI1 CLK PA5
SPI1 MISO PA6
SPI1 MOSI PA7
CN3 is used to configure either internal or external programming:
BOTH jumpers on: ST-LINK on board enabled, CN2 SWD disabled.
BOTH jumpers off: ST-LINK on board disabled, CN2 SWD enabled.
There are different revisions of this board and the sample here
is the MB997C. One difference between this and the original board
revision MB997B is that they changed the MEMS sensor from the
LIS302DL to the LIS3DSH. The LIS3DSH is now obsolete and has been
replaced by the LIS3DH.
===Clocks===
MC0 8000000 X1 8MHz ST-LINK/V1
HSE 8000000 X2 8MHz
HSI 16000000
LSE 0 X3 NOT FITTED
LSI 32768
===Virtual COM port===
{{:boards:stm32f4_vcp.jpg?200}}
VCP on the board is supported, however, the pins were left unconnected and
ST propose you use jumper leads to fix this oversight.
=== LED demo ===
Install [[:tools:libopencm3|OpenCM3]].
Install [[:tools:stlink|STLink]] programmer.
Enter the OpenCM3 fancy blink example's sub-directory and program the chip.
cd /embedded/arm-cortex/src/libopencm3-examples/examples/stm32/f4/stm32f4-discovery/fancyblink/
make PREFIX=/embedded/arm-cortex/gcc-arm-none-eabi-4_9-2015q1/bin/arm-none-eabi fancyblink.stlink-flash
FLASH fancyblink.bin
INFO src/stlink-usb.c: -- exit_dfu_mode
INFO src/stlink-common.c: Loading device parameters....
INFO src/stlink-common.c: Device connected is: F4 device, id 0x10016413
INFO src/stlink-common.c: SRAM size: 0x30000 bytes (192 KiB), Flash: 0x100000 bytes (1024 KiB) in pages of 16384 bytes
INFO src/stlink-common.c: Attempting to write 1364 (0x554) bytes to stm32 address: 134217728 (0x8000000)
EraseFlash - Sector:0x0 Size:0x4000
Flash page at addr: 0x08000000 erased
INFO src/stlink-common.c: Finished erasing 1 pages of 16384 (0x4000) bytes
INFO src/stlink-common.c: Starting Flash write for F2/F4
INFO src/stlink-common.c: Successfully loaded flash loader in sram
size: 1364
INFO src/stlink-common.c: Starting verification of write complete
INFO src/stlink-common.c: Flash written and verified! jolly good!
=== Resources ===
[[https://www.st.com/en/evaluation-tools/stm32f4discovery.html|Product page]]
[[http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/DM00039084.pdf|User manual]]
[[https://community.element14.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-01-46/2671.STMicroelectronics.Schematics.zip|Schematic]]
[[https://www.st.com/resource/en/datasheet/stm32f407vg.pdf|MCU datasheet]]
[[https://www.st.com/resource/en/reference_manual/rm0090-stm32f405415-stm32f407417-stm32f427437-and-stm32f429439-advanced-armbased-32bit-mcus-stmicroelectronics.pdf|MCU reference manual]]