How to configure external interrupt lines.
Then the SystemClock_Config() function is used to configure the system clock (SYSCLK) to run at 48 MHz.
In this example, one EXTI line (EXTI_Line13) is configured to generate an interrupt on each falling edge. In the interrupt routine a led connected to a specific GPIO pin is toggled.
In this example:
- EXTI_Line13 is connected to PC.13 pin
- when falling edge is detected on EXTI_Line13 by pressing User push-button, LED1 toggles once
On NUCLEO-C071RB:
- EXTI_Line13 is connected to User push-button
In this example, HCLK is configured at 48 MHz.
Care must be taken when using HAL_Delay(), this function provides accurate delay (in milliseconds) based on variable incremented in SysTick ISR. This implies that if HAL_Delay() is called from a peripheral ISR process, then the SysTick interrupt must have higher priority (numerically lower) than the peripheral interrupt. Otherwise the caller ISR process will be blocked. To change the SysTick interrupt priority you have to use HAL_NVIC_SetPriority() function.
The example needs to ensure that the SysTick time base is always set to 1 millisecond to have correct HAL operation.
System, GPIO, EXTI, Output, Alternate function, Push-pull, Toggle
This example runs on STM32C071RBTx devices.
This example has been tested with NUCLEO-C071RB board and can be easily tailored to any other supported device and development board.
In order to make the program work, you must do the following :