0% found this document useful (0 votes)
68 views4 pages

BEE-9D ESD Lab 1

This lab report summarizes work done with an ARM microcontroller development board. The objectives were to set up the IAR Embedded Workbench for programming the STM32F429I board and translate concepts from 8-bit to 32-bit ARM processors. Two tasks were completed: 1) toggling LEDs using GPIO pins and delays, and 2) toggling an LED based on button press detection using GPIO pins. The conclusion states the key learnings were how an ARM MCU works and using the IAR Embedded Workbench environment.

Uploaded by

Saad Nadeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views4 pages

BEE-9D ESD Lab 1

This lab report summarizes work done with an ARM microcontroller development board. The objectives were to set up the IAR Embedded Workbench for programming the STM32F429I board and translate concepts from 8-bit to 32-bit ARM processors. Two tasks were completed: 1) toggling LEDs using GPIO pins and delays, and 2) toggling an LED based on button press detection using GPIO pins. The conclusion states the key learnings were how an ARM MCU works and using the IAR Embedded Workbench environment.

Uploaded by

Saad Nadeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Department of Electrical Engineering

Faculty Member: Dr. Usman Zabit Dated: 21st October 2020

Semester: 7th Section: BEE-9D

EE- 423: Embedded System Design

Lab1: Introduction to Development with ARM


Microcontrollers

PLO4-CLO4 PLO5- PLO8- PLO9-


CLO5 CLO7 CLO8
Name Reg. No Viva / Analysis Modern Ethics Individual
Quiz / Lab of data Tool and and Team
Performa in Lab Usage Safety Work
nce Report

5 Marks 5 Marks 5 Marks 5 Marks 5 Marks


Saad Nadeem 208857

(This lab report is submitted alone due to a late group formation. A group will be formed for
the next coming labs)
Introduction:
Development for embedded system engineers has never been about coming up with pieces
but an end-to-end solution. For this purpose, all the parties at stake need to be considered and
referred to throughout the development phase. One mode of communication with entities at
each layer is documentation which is already well-versed for famous microcontrollers. In
case of an embedded system design with STM32F4 microcontroller, following
documentations need to be frequently referred to:
• STM32F429ZI Discovery Kit User Manual (UM1670)
• STM32F4xxxx Application Developer Reference Manual (RM0090)
• ARMv7-M Architecture Reference Manual

Objectives:
The purpose of this lab is to:
1. Setup IAR Embedded Workbench for programming STM32F429I Discovery Board.
2. Translate 8 bit 8051 concepts to 32-bit ARM processor; particularly:
• GPIOs • Timers • Interrupts
3. Design an optimized embedded system through Embedded C using microcontrollers.

Task 1:
#include "stm32f4xx.h"

/* Function prototypes */
int main(void);
void delay(uint32_t);

int main(void)
{
/* Enable clock for GPIOG */
RCC->AHB1ENR |= 1 << 6;

/* Set Pin 13 and Pin 14 in General Purpose Output Mode */


GPIOG->MODER &= 0x00000000;
GPIOG->MODER |= (0x01 << 2*14 | 0x01 << 2*13);

/* Set Pin 13 and Pin 14 as pull-up pins */


GPIOG->PUPDR &= 0x00000000;
GPIOG->PUPDR |= (0x01 << 2*14 | 0x01 << 2*13);

/* Set Pin 13 high */


GPIOG->ODR |= (1 << 13);

while(1)
{
delay(10000000);
GPIOG->ODR ^= (1 << 13) | (1 << 14); // Toggle LED
}

void delay(uint32_t s)
{
for(s; s>0; s--){
asm("NOP");
}
}

Output:

The LEDs turning on process toggles between red and green.

Task 2:
#include "stm32f4xx.h"

/* Function prototypes */
int main(void);
void delay(uint32_t);

int main(void)
{
/* Enable clock for
* - GPIO Port G
* - GPIO Port A
*/
RCC->AHB1ENR |= 1 << 6 | 1 << 0;

/* Set Pin 13 and Pin 14 in General Purpose Output Mode */


GPIOG->MODER &= 0x00000000;
GPIOG->MODER |= (0x01 << 2*14 | 0x01 << 2*13);

/* Set Pin 13 and Pin 14 as pull-up pins */


GPIOG->PUPDR &= 0x00000000;
GPIOG->PUPDR |= (0x01 << 2*14 | 0x01 << 2*13);
/* Set Pin A in Input Mode */
GPIOA->MODER &= 0xFFFFFFFC;
GPIOA->MODER |= 0x00000000;

/* Set Pin 13 and Pin 14 as neither pull-up, nor pull-down */


GPIOA->PUPDR &= 0xFFFFFFFC;
GPIOA->PUPDR |= 0x00000000;

/* Set Pin 13 high */


GPIOG->ODR |= (1 << 13);

while(1)
{
delay(10000000);
GPIOG->ODR ^= (1 << 13); // Toggle LED
if (GPIOA->IDR & 0x00000001) // Toggle for Button Press
GPIOG->ODR ^= (1 << 14);
}

void delay(uint32_t s)
{
for(s; s>0; s--){
asm("NOP");
}
}

Output:

The green LED is on continuously while the red one toggles when the button is pressed.

CONCLUSION:
In this lab, we learned how an ARM based MCU works and we learned about IAR Embedded
Workbench environment which is used by most industries.

You might also like