Difference between revisions of "STM32F4 Discovery"

From PaparazziUAV
Jump to navigation Jump to search
(→‎Pinout: updated pinout according to header file)
Line 30: Line 30:


== Pinout ==
== Pinout ==
[[Image:Stm32f4_discovery_left_bank.png|thumb|right|300px|left pin bank in relation to paparazzi]]
[[Image:Stm32f4_discovery_left_bank.png|thumb|right|300px|left pin bank in relation to paparazzi(not up to date!)]]
[[Image:Stm32f4_discovery_right_bank.png|thumb|right|300px|right pin bank in relation to paparazzi]]
[[Image:Stm32f4_discovery_right_bank.png|thumb|right|300px|right pin bank in relation to paparazzi(not up to date!)]]
The Discovery has a male 100 pin (2x25pin on both sides, also accessible on both sides of the pcb) pinout.  
The Discovery has a male 100 pin (2x25pin on both sides, also accessible on both sides of the pcb) pinout.  


Line 65: Line 65:
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
|-
|-
|PD5||UART2 TX||Out||UART1 Serial Output
|PD5||UART2 TX||Out||UART2 Serial Output
|-
|-
|PD6||UART2 RX||In||UART1 Serial Input, also used for Spektrum input
|PD6||UART2 RX||In||UART2 Serial Input, also used for Spektrum input
|}
|}


Line 75: Line 75:
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
|-
|-
|PD8||UART3 TX||Out||UART1 Serial Output
|PD8||UART3 TX||Out||UART3 Serial Output
|-
|-
|PD9||UART3 RX||In||UART1 Serial Input
|PD9||UART3 RX||In||UART3 Serial Input
|}
|}


Line 85: Line 85:
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
|-
|-
|PC10||UART4 TX||Out||UART1 Serial Output
|PC10||UART4 TX||Out||UART4 Serial Output
|-
|-
|PC11||UART4 RX||In||UART1 Serial Input
|PC11||UART4 RX||In||UART4 Serial Input
|}
|}


Line 95: Line 95:
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
|-
|-
|PC12||UART5 TX||Out||UART1 Serial Output
|PC12||UART5 TX||Out||UART5 Serial Output
|-
|-
|PD2||UART5 RX||In||UART1 Serial Input
|PD2||UART5 RX||In||UART5 Serial Input
|}
|}


Line 105: Line 105:
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
|-
|-
|PC6||UART6 TX||Out||UART1 Serial Output
|PC6||UART6 TX||Out||UART6 Serial Output
|-
|-
|PC7||UART6 RX||In||UART1 Serial Input
|PC7||UART6 RX||In||UART6 Serial Input
|}
|}


{|border="1"  cellspacing="0" style="text-align:center" cellpadding="2%" width="60%"
|+'''SPI1 for onboard LIS302'''
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
|-
|PA5||SPI1 SCK||I/O||SPI1 Serial clock
|-
|PA6||SPI1 MISO||I/O||SPI1 Master In Slave Out
|-
|PA7||SPI1 MOSI||I/O||SPI1 Master Out Slave In
|-
|PE2||SPI SS0||I/O||SPI1 Select Slave0
|}


{|border="1"  cellspacing="0" style="text-align:center" cellpadding="2%" width="60%"
{|border="1"  cellspacing="0" style="text-align:center" cellpadding="2%" width="60%"
Line 120: Line 133:
|-
|-
|PB5||SPI1 MOSI||I/O||SPI1 Master Out Slave In
|PB5||SPI1 MOSI||I/O||SPI1 Master Out Slave In
|-
|PE2||SPI SS0||I/O||SPI1 Select Slave0
|}
|}


Line 127: Line 142:
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
|-
|-
|PB3||SPI2 SCK||I/O||SPI2 Serial clock
|PB13||SPI2 SCK||I/O||SPI2 Serial clock
|-
|PB14||SPI2 MISO||I/O||SPI2 Master In Slave Out
|-
|-
|PB4||SPI2 MISO||I/O||SPI2 Master In Slave Out
|PB15||SPI2 MOSI||I/O||SPI2 Master Out Slave In
|-
|-
|PB5||SPI2 MOSI||I/O||SPI2 Master Out Slave In
|PE7||SPI SS1||I/O||SPI2 Select Slave1
|}
|}


Line 139: Line 156:
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
|-
|-
|PB10||SPI3 SCK||I/O||SPI3 Serial clock
|PC10||SPI3 SCK||I/O||SPI3 Serial clock
|-
|-
|PB11||SPI3 MISO||I/O||SPI3 Master In Slave Out
|PC11||SPI3 MISO||I/O||SPI3 Master In Slave Out
|-
|-
|PB12||SPI3 MOSI||I/O||SPI3 Master Out Slave In
|PC12||SPI3 MOSI||I/O||SPI3 Master Out Slave In
|}
 
 
{|border="1"  cellspacing="0" style="text-align:center" cellpadding="2%" width="60%"
|+'''SPI SS'''
!width="7%"|''Pin #''!!width="10%"|''Name''!!width="10%"|''Type''!!''Description''
|-
|PE2||SPI SS0||I/O||SPI Select Slave0
|-
|-
|P"7||SPI SS1||I/O||SPI Select Slave1
|PE3||SPI SS2||I/O||SPI3 Select Slave1
|}
|}


Line 194: Line 203:
|PB1||AUX1||I/O||ADC_1
|PB1||AUX1||I/O||ADC_1
|-
|-
|PC1||AUX2||I/O||ADC_2
|PC5||AUX2||I/O||ADC_2
|-
|-
|PC4||AUX3||I/O||ADC_3
|PC4||AUX3||I/O||ADC_3
|-
|-
|PA4||BATT||I/O||ADC_4, is used for Battery voltage
|PA4||BAT||I/O||ADC_4, is used for BAT voltage
|-
|PC5||AUX5||I/O||ADC_5
|-
|PC2||AUX6||I/O||ADC_6
|}
|}


Line 212: Line 225:
|PE13||PWM2||Out||Servo 3
|PE13||PWM2||Out||Servo 3
|-
|-
|PE13||PWM3||Out||Servo 4
|PE14||PWM3||Out||Servo 4
|-
|-
|PE5||PWM4||Out||Servo 5
|PE5||PWM4||Out||Servo 5

Revision as of 07:54, 9 March 2014

This page is for the STM32F4 Discovery board with STM32F407VGT6, STM32F4 Disco is a familiar board with STM32F401VCT6, do not use this Files for the Disco board !

STM32F4Discovery front.jpg STM32F4Discovery back.jpg


Overview

  • STMicroelectronics STM32F4VGT6 Cortex M4 MCU, up to 168Mhz with floating point unit (FPU), 192 KB RAM, 1024 KB Flash
  • on-board STLinkv2 with SWD header (capable of programming itself or an external MCU)
  • ob-board power regulator for the MCU (3V or 5V Input)
  • 1 x user push button
  • 4(5) x LED (orange, green, red, blue, green)
  • 6 x UART (UART1, UART2, UART3, UART4, UART5, UART6)
  • 3 x SPI (SPI1, SPI2, SPI3)
  • 2(3) x I2C (I2C1, I2C2, (I2C3))
  • 1 x PPM input
  • 4 x ADC input, which one is used for bat voltage
  • 97 x 66 mm PCB
  • 4 x status LED (USB red, USB green, power, USB OTG green, USB OTG red)
  • LIS302DL MEMS 3 axis accelerometer on SPI1

Pinout

left pin bank in relation to paparazzi(not up to date!)
right pin bank in relation to paparazzi(not up to date!)

The Discovery has a male 100 pin (2x25pin on both sides, also accessible on both sides of the pcb) pinout.

LED
Pin # Name Type Description Color
PD13 LED_3 I/O above LIS302DL Orange
PD12 LED_4 I/O left of LIS302DL Green
PD14 LED_5 I/O right of LIS302DL Red
PD15 LED_6 I/O below LIS302DL Blue
PA9 LED_9 I/O same as USB power (VBUS), needs to be enabled in stm32f4_discovery.h Green


UART1
Pin # Name Type Description
PB6 UART1 TX Out UART1 Serial Output
PB7 UART1 RX In UART1 Serial Input


UART2
Pin # Name Type Description
PD5 UART2 TX Out UART2 Serial Output
PD6 UART2 RX In UART2 Serial Input, also used for Spektrum input


UART3
Pin # Name Type Description
PD8 UART3 TX Out UART3 Serial Output
PD9 UART3 RX In UART3 Serial Input


UART4 (Can NOT be used if SPI_3 is active!)
Pin # Name Type Description
PC10 UART4 TX Out UART4 Serial Output
PC11 UART4 RX In UART4 Serial Input


UART5 (Can NOT be used if SPI_3 is active!)
Pin # Name Type Description
PC12 UART5 TX Out UART5 Serial Output
PD2 UART5 RX In UART5 Serial Input


UART6
Pin # Name Type Description
PC6 UART6 TX Out UART6 Serial Output
PC7 UART6 RX In UART6 Serial Input


SPI1 for onboard LIS302
Pin # Name Type Description
PA5 SPI1 SCK I/O SPI1 Serial clock
PA6 SPI1 MISO I/O SPI1 Master In Slave Out
PA7 SPI1 MOSI I/O SPI1 Master Out Slave In
PE2 SPI SS0 I/O SPI1 Select Slave0
SPI1
Pin # Name Type Description
PB3 SPI1 SCK I/O SPI1 Serial clock
PB4 SPI1 MISO I/O SPI1 Master In Slave Out
PB5 SPI1 MOSI I/O SPI1 Master Out Slave In
PE2 SPI SS0 I/O SPI1 Select Slave0


SPI2 (Can NOT be used if PWM10 & PWM11 is active!)
Pin # Name Type Description
PB13 SPI2 SCK I/O SPI2 Serial clock
PB14 SPI2 MISO I/O SPI2 Master In Slave Out
PB15 SPI2 MOSI I/O SPI2 Master Out Slave In
PE7 SPI SS1 I/O SPI2 Select Slave1


SPI3 (Can NOT be used if UART4 & UART5 is active!)
Pin # Name Type Description
PC10 SPI3 SCK I/O SPI3 Serial clock
PC11 SPI3 MISO I/O SPI3 Master In Slave Out
PC12 SPI3 MOSI I/O SPI3 Master Out Slave In
PE3 SPI SS2 I/O SPI3 Select Slave1


I2C1
Pin # Name Type Description
PB8 I2C1 SCL I/O I2C1 Serial Clock
PB9 I2C1 SDA I/O I2C1 Serial Data


I2C2
Pin # Name Type Description
PB10 I2C2 SCL I/O I2C2 Serial Clock
PB11 I2C2 SDA I/O I2C2 Serial Data


I2C3 (Can NOT be used if Spektrum bind / PPM input is active!)
Pin # Name Type Description
PA8 I2C3 SCL I/O I2C3 Serial Clock
PC9 I2C3 SDA I/O I2C3 Serial Data

Note: is disabled in stm32f4discovery.h, PA8 is used as Spektrum bind pin, PC9 is used as PPM input


ADC
Pin # Name Type Description
PB1 AUX1 I/O ADC_1
PC5 AUX2 I/O ADC_2
PC4 AUX3 I/O ADC_3
PA4 BAT I/O ADC_4, is used for BAT voltage
PC5 AUX5 I/O ADC_5
PC2 AUX6 I/O ADC_6


PWM
Pin # Name Type Description
PE9 PWM0 Out Servo 1
PE11 PWM1 Out Servo 2
PE13 PWM2 Out Servo 3
PE14 PWM3 Out Servo 4
PE5 PWM4 Out Servo 5
PE6 PWM5 Out Servo 6
PA3 PWM6 Out Servo 7
PA2 PWM7 Out Servo 8
PA1 PWM8 Out Servo 9
PA0 PWM9 Out Servo 10
PB14 PWM10 Out Servo 11, Can not be used if SPI2 is active
PB15 PWM11 Out Servo 12, Can not be used if SPI2 is active


PPM
Pin # Name Type Description
PC9 PPM In PPM input


Jumper

Jumper
Pin # Name Type Description
JP1 JP1 Switch MCU Current can be measured here
CN3 CN3 Switch closed: STLinkV2 is connected to onboard MCU, open: is not connectec to onboard, only external header


Soolder Jumper
Pin # Name Type Description
SB17 SB17 Switch Bypass for JP1, close this for security ! (if JP1 gets loose)

Firmware Flashing

FLASH_MODE=STLINK is set as default

STM32F4 Discovery can mainly be programmed in two different ways:

STLINK

  • with onboard STLinkV2 over SWD
  • required hardware: usb to mini USB cable
  • required software: st_flash and st_util from Texane
  • more information: STLink page

DFU-UTIL

  • with the MCU native (embedded in rom) DFU USB bootloader over the micro USB AB connector
  • required hardware: USB to micro and USB to mini usb cable
  • required external software: dfu-util
  • push MCU in DFU mode: connect mini and micro USB to PC, connect pin BOOT0 with 3V (if it doesnt work also BOOT1 (PB2) with GND), press reset button(LED LD7 should light up now), disconnect BOOT0 to 3V
  • more information: DFU page