Question: Labs should be written for STM 3 2 Cube IDE. For the STM 3 2 F 4 4 6 xC / E ARM Cortex -

Labs should be written for STM32 Cube IDE. For the STM32F446xC/E ARM Cortex - M432b board. On programming language C. Results should be provided like: step 1a and code below, step 1b and code below, for all parts and steps. And all explanations should be provided.
Template:
#include
#include
#include
#include "stm32f446zeLib.h"
#include "stm32f4xx.h"
//#define STEP2
//#define STEP3b
//#define STEP4_5
/*test of interrupts with various priority/occurrence conditions*/
int main(void){
lcd.begin(16,2);
lcd.clear();
lcd.print((char *)" INTERRUPT ");
// global disable interrupts
// init GPIO pins
// Select interrupt source
// unmask interrupt sources
// select the active edge
// Enable interrupt at NVIC level
#ifdef STEP4_5
// set priorities
#endif
// global enable interrupts
#ifdef STEP2
// test INT handler & LEDs using software interrupt
#endif
while (1){// waiting for interrupt
}
}
/*
**===========================================================================
**
** Interrupt handlers
**!! do not forget to modify startup_stm32f446xx.s file
**!! do not forget to clear interrupt flag
**===========================================================================
*/
void EXTI0_IRQHandler(void){
#ifndef STEP3b
// clear the INT flag here
#endif
// your ISR code here
#ifdef STEP3b
// clear the INT flag here
#endif
}
void EXTI1_IRQHandler(void){
// your code here
}
Part 1: Using interrupts
Note: Use the default HSI clock for the microcontroller. You are allowed to use the gpio functions available from the stm32f446zeLib library.
In violation of good programing practices, the ISR deliberately takes a long time to be able to verify the priority and preemption mechanisms.
STEP1: Write a code that loops infinitely and:
1a Blinks 5 times LD1 with a blink period of 500ms on port PG10 when a falling edge occurs on port PB0. Keep the interrupt priority at its default value.
1b Blinks 12 times LD2 with a blink period of 200ms on port PG13 when a falling edge occurs on port PC1. Keep the interrupt priority at its default value
STEP2: Add software interrupts to your code to test the interrupts without using the switches before entering the infinite loop
STEP3: The interrupt flag can be cleared anywhere in the ISR. What happens for an new interrupt on EXTI0 which occurs while ISR0 is currently running:
3a: if the flag is cleared at the very beginning of the ISR?
3b: if the flag is cleared at its very end?
STEP4: The interrupts are not simultaneous
4a: Set the same priority level to both interrupts. Verify that an interrupt is memorized if it occurs while the other interrupt is being served (i.e. no preemption). How many events can be memorized for a given interrupt vector?
4b: Same test but with a lower priority for EXTI0_IRQn. Verify preemtion of EXTI0_IRQHandler.
STEP5: The interrupts are simultaneous (i.e. connected to the same switch using the special cable provided)
5a: Test the behavior with the same priority for both interrupts. Which interrupt is served first and why?
5b: Same test but with a lower priority for EXTI0_IRQn. Which interrupt is served first and why?
5c: What happens if you press the switch twice during the execution of the ISR? Explain why.
5d: Same test as before but pressing the switch 3 times or more during the execution of the ISR? Explain.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!