Tutorial 2 - Getting Started

STM32F4Discovery Tutorial 2 - Getting Started

This is the second tutorial on the video tutorial series on stm32f4discovery board. In this tutorial we will get an in depth knowledge about the technical things of embedded programming. We will understand what is meant by datasheet. If you had any prior experience with electronic components then you must have heard about this term. So will look into datasheets of this discovery board. What are the datasheets we have? What kind of information we get from each datasheet? How to look for information in the datasheets? This all we will understand in this tutorial.

After this we will directly start on using the discovery board. We will create our first project and start writing the code. We will understand how to write code for the microcontroller on the discovery board. What are the technical terms to understand for writing code for microcontroller? We will then create a program for the board. And then finally we will execute the program on the discovery board.

#include "stm32f4xx.h"

GPIO_InitTypeDef GPIO_LED;

int main(void)
{
  int i = 0;

  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
  GPIO_LED.GPIO_Pin = GPIO_Pin_12;
  GPIO_LED.GPIO_Mode = GPIO_Mode_OUT;
  GPIO_LED.GPIO_OType = GPIO_OType_PP;
  GPIO_LED.GPIO_Speed = GPIO_Speed_50MHz;
 
  GPIO_Init(GPIOD, &GPIO_LED);
 
  GPIO_WriteBit(GPIOD, GPIO_Pin_12, Bit_SET);

  while (1)
  {
        i++;
  }
}