Professional Documents
Culture Documents
Silicon Valley
Stanford University
University of California, Berkeley
Napa Valley Yosemite National Park
1
Full Class Schedule
Day Subject Contents Reference (Text Book) Remark
Class-1: ARM STM32F429ZIT Architecture p.1-25
NUCLEO-F429ZI B/D &
Day-01 Class-2: NUCLEO-F429ZI Reference Board p.1-25
Development Environment
Class-3: STM32CubeIDE Installation & Code Analysis p.1-25
Class-1: Introduction, GPIO_EX3_1 p.57
Day-02 GPIO(1) Class-2: GPIO_EX3_4 p.69
Class-3: GPIO_EX3_8, Summary p.73
Class-1: Introduction, GPIO_EX3_3 p.64
Day-03 GPIO(2) Class-2: GPIO_EX3_7 p.71
Class-3: GPIO_EX3_9, Summary p.76
Class-1: Introduction, INTERRUPT_EX4_1 p.88 Polling method
Day-04 Interrupt(1) Class-2: INTERRUPT_EX4_5 p.94
Class-3: INTERRUPT_EX4_6, Summary p.96
NVIC :
Class-1: Introduction, INTERRUPT_EX4_8 p.101
Interrupt method
Day-05 Interrupt(2)
Class-2: INTERRUPT_EX4_11 p.111
Class-3: INTERRUPT_EX4_12, Summary p.112
Fundamental
Class-1: Introduction, ADC_EX5_1 p.120
Reference
Day-06 ADC(1)
Class-2: ADC_EX5_2 p.123
Class-3: ADC_EX5_3, Summary p.132
Class-1: Introduction, ADC_EX5_4 p.134 Advanced
Day-07 ADC(2) Class-2: ADC_EX5_5 p.136 Structure : 3-ways
Class-3: ADC_EX5_6, Summary p.138
Class-1: Introduction, TIMER_EX1
Day-08 Timer(1) Class-2: TIMER_EX2
Class-3: TIMER_EX3, Summary
Class-1: Introduction, TIMER_EX4
Day-09 Timer(2) Class-2: TIMER_EX4
Class-3: TIMER_EX5, Summary
Class-1: Introduction, Buzzer p.178, p.181, p.183 Final Exam. : 90Min
Day-10 Application Programming Class-2: Light_Sensor, Water Sensor p.195, p.201
Class-3: UART, Summary p.241
November 10, 2021 -3-
Learning Object
How to program the operation to turn on and off all LEDs in 3 ways, CubeMX, HAL
library function, and register direct access
GPIO_EX3_8, p.72
How to design with register
GPIO_EX3_9, p.76
Class-3 direct access and without using
CubeMX for GPIO port setting
2
Class-1 : Implement a program to set GPIO port and
turn on/off all LED sequentially using
CubeMX
GPIO_Ex4 : HAL Library, STM32 Project, CbueMX for GPIO Port setting : O
GPIO_Ex5 : HAL Library, STM32 Project, CbueMX for GPIO Port setting : x
GPIO_Ex6/7 : Register directive access, STM32 Project, CbueMX for GPIO Port setting : x
3
1. Create a Project
2. MCU/MPU Selector
-Core : Arm Cortex-M4
-Series : STM32F4
-Line : STM32F429/439
-Package : LQFP144
3. Next
4. Project Name : GPIO_Ex3_3
5. Finish
2. Clock Configuration
If the clock setting is set as the default setting, the LED ON/OFF time becomes longer.
4
3. Pinout & Configuration (1 of 3)
5
3. Pinout & Configuration (3 of 3) Refer p.64
main.h (1 of 1)
6
main.c (1 of 2) Refer p.64
{
/* USER CODE BEGIN 2 */
uint16_t LED[8]=
{
GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_2, GPIO_PIN_3, GPIO_PIN_4,
GPIO_PIN_5,GPIO_PIN_6,GPIO_PIN_7
};
/* Infinite loop */
/* USER CODE BEGIN WHILE */
7
Class-2 : Implement a program to set GPIO port and
turn on/off all LEDs sequentially without
using CubeMX
8
Refer p.71
1. Project
-Same as Example GPIO_EX4, GPIO_EX5, GPIO_EX6, GPIO_EX7
2. Clock Configuration
-Same as Example GPIO_EX1
main.c
main.h (1 of 1)
#include "main.h"
-No additional code in this file
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
while (1)
{
// function definition
}
}
9
main.c (1 of 2) First, deleting the setted port Refer p.71
{
/* USER CODE BEGIN 2 */
__HAL_RCC_GPIOD_CLK_ENABLE();
GPIO_InitTypeDef myLEDConfig;
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
for (int i=0; i<8; i++) {
HAL_GPIO_WritePin (GPIOD, LED[i], GPIO_PIN_SET);
HAL_Delay (1000);
}
10
/**
* @brief GPIO Init structure definition
*/
typedef struct
{
uint32_t Pin; /*!< Specifies the GPIO pins to be configured.
This parameter can be any value of @ref GPIO_pins_define */
uint32_t Mode; /*!< Specifies the operating mode for the selected pins.
This parameter can be a value of @ref GPIO_mode_define */
uint32_t Pull; /*!< Specifies the Pull-up or Pull-Down activation for the selected pins.
This parameter can be a value of @ref GPIO_pull_define */
uint32_t Speed; /*!< Specifies the speed for the selected pins.
This parameter can be a value of @ref GPIO_speed_define */
11
GPIO_EX3_8 : refer p.72
• Mathod-1 : Register directive access, STM32 Project, without using CbueMX for GPIO Port
setting port code : x (memory map head file)
• Mathod-2 : Register directive access, STM32 Project, without using CbueMX for GPIO Port
setting port code : o (memory map no head file)
Refer p.76
Method-1 : GPIO_EX3_8
12
Refer p.76
1. Project
-stm32 project
2. Clock Configuration
-Same as Example GPIO_Ex3_3/7
main.h (1 of 1)
Since this code is defined in file a, there is no need to add it. (for explanatory purpose only)
13
main.c (1 of 2)LED’s Operation On/Off Refer p.73-76
int main(void)
{
…
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
for (int i=0; i<8; i++){
GPIOD->ODR |= (1<<i); // ON sequentially from the first LED
for (int i=0; i<1000000; i++);
}
14
Refer p.76
15
main.c (2 of 2) Refer p.76
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
Refer p.76
16
Summary : Day-3
17