Posts

Showing posts from August, 2023

Musical Keyboard : STM32 UART Receiver

Image
Musical Keyboard Let's configure the STM32F401 Nucleo-64 Development Board to work as a UART Receiver and emulate a Musical Keyboard by using our own libraries and drivers. We will use the STM32F401's  GPIOA Port USART2 Peripheral SysTick Timer The basic functionality is to Receive a character from the PC Keyboard and play the sound note mapped to the keystroke in the Keyboard.h file. I have written separate Modules for each peripherals, that is, GPIO.h  To initialise and Toggle the GPIO Pin Output UART.h To initialise the USART2 Peripheral, Receive the Characters from PC and to Print info on the Serial console  Delay.h To produce Micro-second and Milli-second specific delays Keyboard.h Mapping the Music Note periods and the function definition for playing a specific Musical Note GPIO Module The GPIO Module has two functions. The GPIO_Init() function enables the clock access to AHB1 Bus, Configures the GPIO Port A Pin 5 to Output Mode. GPIO_Toggle() function toggles the Output