Tutorial: STM32F746 (STM32F7 Discovery) - how to turn on LED (controlling GPIO)
- December 05 2015
- STM32F4, STM32F7, STM32L1, STM32F3, Nucleo, Discovery
- 12864 Reads
- 0 Comments
Other tutorials with STM32F7:
Tutorial: STM32F746 (STM32F7 Discovery) - how to turn on/off LED by button
Tutorial: STM32F746 (STM32F7 Discovery) - how to turn on LED (controlling GPIO)
STM32F746 discovery and AC6 (System Workbench for STM32)
How to begin with STM32 and why - tutorial
These example codes can be used for another STM32F (STM32F407, STM32F103, STM32F427, STM32F746...) and STM32L (STM32L100, STM32L152, STM32L476...) with easy changes - typically atypic peripherals and change of clock source for peripherals - AHB, APB...
These codes will be written for STM32F746 with AC6 System Workbench for STM32 IDE by http://openstm32.org. But you can use these codes in another IDE e.g. Keil.
At first: Why I don't want to use HAL or Standard Peripheral Library.
Codes write people and people do mistakes (sometimes errors). If you want to use HAL and in the code will be mistake, you have to check their codes and that's not easy.
On the other side, If you will write own code, you know the code and structure of ARM and STM32. Yes, HAL or Standard Peripheral Library are very good functions and if you want to use it, do it. But this tutorial isn't for you.
The tutorial will be written with finished example code which will be commented. If some code will be complicated, I will explain it on this tutorial.
Be careful, my codes can't be always right (under all conditions). I hope that you will read datasheet and reference manual of specifically STM32 product.
main.h
main.c
MODERy[1:0] setting of PIN
00: PIN as input
01: PIN as output
10: Alternative function of PIN
11: Analog input
OSPEEDRy[1:0] These bits are written by software to configure the I/O output speed
00: Low speed
01: Medium speed
10: Fast speed
11: High speed
You can download project. Other tutorials with STM32F7:
Tutorial: STM32F746 (STM32F7 Discovery) - how to turn on/off LED by button
Tutorial: STM32F746 (STM32F7 Discovery) - how to turn on LED (controlling GPIO)
STM32F746 discovery and AC6 (System Workbench for STM32)
How to begin with STM32 and why - tutorial