Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
stm32:peripherals:exti [2019/09/16 07:24] – [Setup SYSCFG] kjaz | stm32:peripherals:exti [2022/12/28 08:29] (current) – [SYSCFG_EXTICR4 - External interrupt configuration register 4] ruan | ||
---|---|---|---|
Line 18: | Line 18: | ||
\\ | \\ | ||
- | ===== Programming Example ===== | ||
- | ==== Setup Peripheral (e.g. GPIOA Pin 5) ==== | ||
- | |||
- | <code c> | ||
- | #include " | ||
- | |||
- | RCC-> | ||
- | |||
- | /* Configure GPIO pin A.5 as input. */ | ||
- | GPIOA-> | ||
- | |||
- | GPIOA-> | ||
- | GPIOA-> | ||
- | </ | ||
- | \\ | ||
- | |||
- | ==== Setup SYSCFG ==== | ||
- | |||
- | To choose which GPIO peripheral should trigger EXTI line 5 you have to configure the SYSCFG register. | ||
- | |||
- | <code c> | ||
- | #include " | ||
- | |||
- | SYSCFG-> | ||
- | </ | ||
- | \\ | ||
- | |||
- | ==== Setup EXTI ==== | ||
- | |||
- | <code c> | ||
- | #include " | ||
- | |||
- | EXTI-> | ||
- | EXTI-> | ||
- | </ | ||
- | \\ | ||
- | |||
- | ==== Setup NVIC ==== | ||
- | |||
- | <code c> | ||
- | #include " | ||
- | |||
- | NVIC-> | ||
- | </ | ||
- | \\ | ||
===== Configuration Register ===== | ===== Configuration Register ===== | ||
- | ==== SYSCFG | + | ==== SYSCFG_EXTICR1 |
- | + | ||
- | === EXTICR1 === | + | |
- | + | ||
- | External interrupt configuration register 1 | + | |
\\ {{syscfg_reg_exticr1.svg}} \\ \\ | \\ {{syscfg_reg_exticr1.svg}} \\ \\ | ||
- | === EXTICR2 | + | ==== SYSCFG_EXTICR2 - External interrupt configuration register 2 ==== |
- | + | ||
- | External interrupt configuration register 2 | + | |
\\ {{syscfg_reg_exticr2.svg}} \\ \\ | \\ {{syscfg_reg_exticr2.svg}} \\ \\ | ||
- | === EXTICR3 | + | ==== SYSCFG_EXTICR3 - External interrupt configuration register 3 ==== |
- | + | ||
- | External interrupt configuration register 3 | + | |
\\ {{syscfg_reg_exticr3.svg}} \\ \\ | \\ {{syscfg_reg_exticr3.svg}} \\ \\ | ||
- | === EXTICR4 | + | ==== SYSCFG_EXTICR4 - External interrupt configuration register 4 ==== |
- | + | ||
- | External interrupt configuration register 4 | + | |
\\ {{syscfg_reg_exticr4.svg}} \\ \\ | \\ {{syscfg_reg_exticr4.svg}} \\ \\ | ||
+ | Select the source input for EXTI | ||
|< 100% 5em 5em >| | |< 100% 5em 5em >| | ||
|EXTIx|0000|GPIOA pin x (reset state)| | |EXTIx|0000|GPIOA pin x (reset state)| | ||
Line 100: | Line 46: | ||
\\ | \\ | ||
- | ==== EXTI - RTSR / FTSR ==== | + | ==== EXTI_RTSR |
- | + | ||
- | Rising / falling trigger selection register | + | |
\\ {{exti_reg_xtsr.svg}} \\ \\ | \\ {{exti_reg_xtsr.svg}} \\ \\ | ||
Line 111: | Line 55: | ||
\\ | \\ | ||
- | ==== EXTI - IMR ==== | + | ==== EXTI_IMR |
- | + | ||
- | Interrupt mask register | + | |
\\ {{exti_reg_imr.svg}} \\ \\ | \\ {{exti_reg_imr.svg}} \\ \\ | ||
Line 122: | Line 64: | ||
\\ | \\ | ||
- | ==== EXTI - PR ==== | + | ==== EXTI_PR |
- | + | ||
- | Pending register | + | |
\\ {{exti_reg_pr.svg}} \\ \\ | \\ {{exti_reg_pr.svg}} \\ \\ | ||
Line 132: | Line 72: | ||
|::: | |::: | ||
* This bit is set when the selected edge event arrives on the external interrupt line x. This bis is cleared by programming it to ' | * This bit is set when the selected edge event arrives on the external interrupt line x. This bis is cleared by programming it to ' | ||
+ | |||
+ | ===== Programming Example ===== | ||
+ | |||
+ | ==== Setup Peripheral (e.g. GPIOA Pin 5) ==== | ||
+ | |||
+ | <code c> | ||
+ | #include " | ||
+ | |||
+ | RCC-> | ||
+ | |||
+ | /* Configure GPIO pin A.5 as input. */ | ||
+ | GPIOA-> | ||
+ | |||
+ | GPIOA-> | ||
+ | GPIOA-> | ||
+ | </ | ||
+ | \\ | ||
+ | |||
+ | ==== Setup SYSCFG ==== | ||
+ | |||
+ | To choose which GPIO peripheral should trigger EXTI line 5 you have to configure the SYSCFG register. | ||
+ | |||
+ | <code c> | ||
+ | #include " | ||
+ | |||
+ | SYSCFG-> | ||
+ | </ | ||
+ | \\ | ||
+ | |||
+ | ==== Setup EXTI ==== | ||
+ | |||
+ | <code c> | ||
+ | #include " | ||
+ | |||
+ | EXTI-> | ||
+ | EXTI-> | ||
+ | </ | ||
+ | \\ | ||
+ | |||
+ | ==== Setup NVIC ==== | ||
+ | |||
+ | <code c> | ||
+ | #include " | ||
+ | |||
+ | NVIC-> | ||
+ | </ | ||
+ | \\ | ||