2- STM32F407VG GPIO PROCESSES 1
I am using STM32 CUBEMX IDE to program the board. I chose HAL (Hardware Abstraction Layer) library for projects.
You can download CUBEMX IDE from here.
GPIO meaning is General Purpose Input/Output. STM32F407VG board has 4 type of GPIO. These are A,B,C,D,E . Each type has 16 terminal, from 0 to 15. Each I/O port terminalsWe can use these GPIO terminals as severeal modes. These are Analog, Alternation, Output and Input variations. Variations are pull-up, pull-down and open drain. I will talk about these variations and other features in the coming sections.
In this section, user LEDS control will be applied. Application is starting with selection of the correct board from ide.
Choose the correct board with searchin from Part Number section then select the MCU from table then click to Next.
Giving the name of the project then choose the coding language. I will use C language for coding. Then you can click to Finish button.
At these pages, all configurations can be done. Firstly, we have to make clock configurations. We will use HSE(High Speed External) clock.
HSE is located in the System Core menu, RCC. RCC register is using for reset and clock control. HSE is selected as Crystal-Seramic Resonator.
As default, input frequency is setted as 25 Mhz. However, STM32F407VG board has 8 Mhz external clock. We should rearrange this value from Clock Configuration section. I chose the HCLK as maximum frequency 168 Mhz.
PD15, PD14, PD13, PD12 terminals are connected to board LED’s. We will use this LED’s. Then generate the code from Project-> Generate Code or CTRL+K.
After generation, IDE is preparing the configurations automaticaly. They are ready to use. You do not need to know deepply the architecture of the system.
In the main c file, there are so many comment spaces with description. We have to use correct spaces to write codes, otherwise they will be disappear after generation. Let’s control the LED’s.
HAL_GPIO_WritePin( — — — -) funciton writes to the intended terminal logic 1 or logic 0 as set, reset. HAL_Delay( — -) function gives delay to the program to see the changes.