This homework assignment is to learn how to use interrupts.
SysTick's interrupt is unusual for the Nucleo64 board. Most interrupts have two levels of control, the first being the NVIC (see Interrupts slide 5). To start a device must have its interrupts enabled at that level. You can use the NVIC_EnableIRQ function to do this.
Example:
NVIC_EnableIRQ (EXTI4_IRQn)
This will enable interrupts for EXTI4 (external GPIO 4). All devices in the system have a pre-mapped macro for their IRQ number. It uses the format of <Device_Name>_IRQn.
Internally, many devices have multiple interrupts available. First the device as a whole must have interrupts enabled at the NVIC level. After that, individual, device specific interrupts can be set via control registers, similar to how we set SysTick's interrupt.
For this activity, enable read interrupts for USART2. USART2 has a lot of possible interrupts (see Interrupts slide 11). For this activity, make sure to only enable the interrupt for RXNE. Interrupt handlers all use a similar format:
void <Device_Name>_IRQHandler(void)Write a handler that does the echo. You are welcome to expand the handler to additional functionality, but it is not required for this assignment. Do remember that handlers stop all other activity until they finish so be careful to not spend a long time in them.
Create a new hw6.c file to hold the contents of this homework.
Submit your solution by pushing any code written to the course repo by the deadline.
To receive full credit, Code must compile and run as expected without any warnings!