Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
1 result

fltk

  • Clone with SSH
  • Clone with HTTPS
  • Name Last commit Last update
    Drivers
    Lab5
    README.md

    ESP Lab 5.1

    Lab 5.1 Exercises

    All files are found in the source folder. Screenshots are found in media 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.