diff --git a/README.md b/README.md index f218046dde356b9d90a656318eb7125b5011bc46..4f01cb3b7bd2039a165c81bf50524bc658249d42 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,26 @@ -# esp-lab-5.1 +# ESP Lab 5.1 -Part 1 of the worksheet on interrupts - this part deals with timer and button interrupts. +## Lab 5.1 Exercises +All files are found in the source folder. + +### Exercise 1 (main.c) : Build and execute time.c +• USART1 is initialized with BSP_COM_Init() to handle serial communication at 115200 baud rate. +• LED2_Init() and LED2_Toggle() is used to configure GPIO pin PB14 and toggles the state of the LED, used in the timer interrupt handler to blink the LED. +• configure_timer2_interrupt() initializes Timer 2 to generate interrupts every 1 second. +•The timer is configured to divide the system clock to 10 kHz and count up to 999 for a 1-second period. +• TIM2_IRQHandler() is the interrupt handler for Timer 2. It toggles the LED on every timer interrupt and processes the interrupt using HAL's HAL_TIM_IRQHandler(). +• SystemClock_Config() sets up the system clock to run at 80 MHz using the MSI oscillator and PLL. + +OUTPUT : Minicom runs perfectly with the code after having some issues regarding the Makefile. + + +##### Exercise 2 (button.c) : Configure TIM2 to generare a PWM signal +•LED1_On(), LED1_Off(), LED2_On(), and LED2_Off() control the LEDs' states. +• The program starts with LED1 on and LED2 off, toggling their states based on button interrupts. +• Configure the Blue Button (PC13) as an interrupt source using Blue_PB_EXT_Init(). +• Set the interrupt to trigger (button press). +• The EXTI15_10_IRQHandler() toggles between the LEDs when the button is pressed. +• USART1, for debugging at 115200 baud with __io_putchar() for printf() support. +• Send messages through UART, a welcome message and error logs (button configuration failure). +• MSI oscillator at 4 MHz. + OUTPUT : LED toggles but minicom is not diplaying any output.