Home Code A look at the STM32F4DISCOVERY with an Arduino based example

A look at the STM32F4DISCOVERY with an Arduino based example

by shedboy71

In this example we look at the STM32F4DISCOVERY and in particular the STM32F407G-DISC1

Lets look at some key features

The STM32F4DISCOVERY kit leverages the capabilities of the STM32F407 high performance microcontrollers, to allow users to easily develop applications featuring audio.

It includes an ST-LINK embedded debug tool, one ST-MEMS digital accelerometer, a digital microphone, one audio DAC with integrated class D speaker driver, LEDs, push-buttons and an USB OTG micro-AB connector.

With the latest board enhancement, the new order code STM32F407G-DISC1 has replaced the old reference STM32F4DISCOVERY.

Key Features

  • STM32F407VGT6 microcontroller featuring 32-bit ARM®Cortex®-M4 with FPU core, 1-Mbyte Flash memory, 192-Kbyte RAM in an LQFP100 package
  • On-board ST-LINK/V2 on STM32F4DISCOVERY (old reference) or ST-LINK/V2-A on STM32F407G-DISC1 (new order code)
  • USB ST-LINK with re-enumeration capability and three different interfaces:
    • Debug port
    • Virtual Com port (with new order code only)
    • Mass storage (with new order code only)
  • Board power supply: through USB bus or from an external 5 V supply voltage
  • External application power supply: 3 V and 5 V
  • LIS302DL or LIS3DSH ST MEMS 3-axis accelerometer
  • MP45DT02 ST-MEMS audio sensor omni-directional digital microphone
  • CS43L22 audio DAC with integrated class D speaker driver
  • Eight LEDs:
    • LD1 (red/green) for USB communication
    • LD2 (red) for 3.3 V power on
    • Four user LEDs, LD3 (orange), LD4 (green), LD5 (red) and LD6 (blue)
    • 2 USB OTG LEDs LD7 (green) VBUS and LD8 (red) over-current
  • Two push-buttons (user and reset)
  • USB OTG FS with micro-AB connector
  • Extension header for all LQFP100 I/Os for quick connection to prototyping board and easy probing
  • Comprehensive free software including a variety of examples, part of STM32CubeF4 package or STSW-STM32068 to use legacy standard libraries.

 

There are 4 coloured LEDs on the STM32F407G-DISC1 development board as stated above, these are locate dunder the microcontroller

PIN NAME COLOUR POSITION
PD13 LD3 ORANGE UP
PD14 LD5 RED RIGHT
PD15 LD6 BLUE DOWN
PD12 LD4 GREEN LEFT

 

Parts List

STM32F4DISCOVERY Embeded ST-LINK/V2 STM32 Evaluation Development Board,Free shipping

Code

We used Atom IDE with Platform.IO installed and added support for the STM32 boards. This is an Arduino example (confused). You could add STM32 support to the Arduino IDE by adding stm32duino support but I like the look of Platform IDE so wanted to play about with the IDE

This is a fairly basic example to flash the LEDS off and on repeatedly

[codesyntax lang=”cpp”]

#include <Arduino.h>

void setup() {
  // put your setup code here, to run once:

  // Set the MCU's pin data direction.
  pinMode(PD13, OUTPUT);
  pinMode(PD14, OUTPUT);
  pinMode(PD15, OUTPUT);
  pinMode(PD12, OUTPUT);

  // Set all outputs LOW to have all LED's initially turned off.
  digitalWrite(PD13, LOW);
  digitalWrite(PD14, LOW);
  digitalWrite(PD15, LOW);
  digitalWrite(PD12, LOW);
}

void loop() {
  // put your main code here, to run repeatedly:

  // Turn off the GREEN LED, turn on the ORANGE LED and wait for 1000ms.
  digitalWrite(PD12, HIGH);
  digitalWrite(PD13, HIGH);
  digitalWrite(PD14, HIGH);
  digitalWrite(PD15, HIGH);
  delay(1000);

  digitalWrite(PD12, LOW);
  digitalWrite(PD13, LOW);
  digitalWrite(PD14, LOW);
  digitalWrite(PD15, LOW);
  delay(1000);

  // The code in the "loop()" statement will automatically repeat.
}

[/codesyntax]

 

Link

https://www.st.com/en/evaluation-tools/stm32f4discovery.html

Share

You may also like