Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 6, 2018. It is now read-only.

Commit 81d0565

Browse files
committed
Merge pull request #389 from forGGe/g378_migrate_exti
Migrate EXTI example
2 parents 5f9eb56 + 8e671f3 commit 81d0565

File tree

7 files changed

+142
-132
lines changed

7 files changed

+142
-132
lines changed

‎doc/sphinx/source/examples/blinky.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ Running
6060

6161
* For TivaC launchpad::
6262

63-
tcore --sudo flash
63+
tcore flash --sudo
6464

6565
* For old STM32F407G-DISC boards, with STLINK/V2::
6666

67-
tcore --sudo flash
67+
tcore flash --sudo
6868

6969
* For new STM32F407G-DISC1 boards, with STLINK/V2.1::
7070

71-
tcore --sudo flash --debugger-config stlink-v2.1
71+
tcore flash --sudo --debugger-config stlink-v2.1
7272

7373
Expected output
7474
~~~~~~~~~~~~~~~
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
External interrupts from user button
2+
------------------------------------
3+
4+
:Location: https://github.com/theCore-embedded/example_button_interrupt
5+
:External HW: UART-to-USB converter
6+
7+
EXTI - the external interrupt.
8+
9+
An external interrupt is a computer system interrupt that happens as a result
10+
of outside interference, whether that’s from the user, from peripherals,
11+
from other hardware devices or through a network. These are different
12+
than internal interrupts that happen automatically as the machine
13+
reads through program instructions.
14+
15+
-- Techopedia_
16+
17+
In this application, one particular type of external interrupt is used:
18+
GPIO line interrupt. When voltage level changes on the line (e.g. when button is
19+
pressed), interrupt is generated.
20+
21+
.. STARTOF COMMON SECTION MARKER
22+
23+
Supported targets (boards)
24+
~~~~~~~~~~~~~~~~~~~~~~~~~~
25+
26+
+---------------------+--------------------------+-----------------------------------+
27+
| Target name | Configuration file | Description |
28+
+=====================+==========================+===================================+
29+
| stm32f4_disc | stm32f4_discovery.json | STM32F4 discovery board |
30+
+---------------------+--------------------------+-----------------------------------+
31+
| tiva_tm4c_launchpad | tiva_tm4c_launchpad.json | TM4C123G LaunchPad Evaluation Kit |
32+
+---------------------+--------------------------+-----------------------------------+
33+
34+
Wiring
35+
~~~~~~
36+
37+
* If you have Tiva TM4C Launchpad - simply connect it to the USB.
38+
39+
* If you have STM32F4 Discovery board:
40+
41+
#. Attach any preferable UART-to-USB
42+
converter module (`such as this`_) according to following pinout:
43+
44+
+-------------------+-----------------+
45+
| PD8 (USART3 TX) | module's RX |
46+
+-------------------+-----------------+
47+
| PD9 (USART3 RX) | module's TX |
48+
+-------------------+-----------------+
49+
| GND | module's GND |
50+
+-------------------+-----------------+
51+
52+
.. image:: https://i.imgur.com/dRVRHV2.jpg
53+
:alt: UART wiring for stm32f4discovery EXTI example
54+
55+
56+
#. Connect your STM32 Discovery board to the PC.
57+
58+
Preparing
59+
~~~~~~~~~
60+
61+
#. Install and initialize theCore (if not done previously)::
62+
63+
pip3 install tcore
64+
tcore bootstrap
65+
66+
#. Download the example::
67+
68+
tcore init --remote https://github.com/theCore-embedded/example_button_interrupt
69+
70+
#. Step into the project directory::
71+
72+
cd example_button_interrupt
73+
74+
Building
75+
~~~~~~~~
76+
77+
* For STM32 Discovery board::
78+
79+
tcore compile --target stm32f4_disc
80+
81+
* For Tiva TM4C LaunchPad::
82+
83+
tcore compile --target tiva_tm4c_launchpad
84+
85+
Running
86+
~~~~~~~
87+
88+
#. Launch ``minicom`` with device associated with USB <-> UART converter.
89+
(``/dev/ttyUSB0`` here used as an example)::
90+
91+
# From new terminal
92+
tcore runenv "minicom -D /dev/ttyUSB0"
93+
94+
Or the same, but with superuser permissions::
95+
96+
# From new terminal
97+
tcore runenv --sudo "minicom -D /dev/ttyUSB0"
98+
99+
#. Run:
100+
101+
* On TivaC launchpad::
102+
103+
tcore flash --sudo
104+
105+
* For old STM32F407G-DISC boards, with STLINK/V2::
106+
107+
tcore flash --sudo
108+
109+
* For new STM32F407G-DISC1 boards, with STLINK/V2.1::
110+
111+
tcore flash --sudo --debugger-config stlink-v2.1
112+
113+
Expected output
114+
~~~~~~~~~~~~~~~
115+
116+
Observe console output using ``minicom`` if running on the embedded device)::
117+
118+
Welcome to theCore
119+
the_core v0.3.0.307 9ff344b-dirty
120+
Starting EXTI (button interrupt) demo
121+
122+
Every time you press a button (SW1 on TivaC board, USR_BTN on STM32F4 Discovery),
123+
following output will be displayed::
124+
125+
Button pressed!
126+
127+
.. _such as this: http://www.geekfactory.mx/wp-content/uploads/2013/06/converdidor_usb_ttl_rs232_pl_2303hx_01.jpg
128+
.. _Techopedia: https://www.techopedia.com/definition/7115/external-interrupt
129+
130+
.. ENDOF COMMON SECTION MARKER

‎doc/sphinx/source/examples/hello-world.rst‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _theCore_hello_world:
22

3-
Simple host hello world example
4-
-------------------------------
3+
Simple Hello World example
4+
--------------------------
55

66
:Location: https://github.com/theCore-embedded/example_hello_world
77
:External HW: UART-to-USB converter for STM32F4Discovery board
@@ -89,15 +89,15 @@ Running
8989

9090
* On TivaC launchpad::
9191

92-
tcore --sudo flash
92+
tcore flash --sudo
9393

9494
* For old STM32F407G-DISC boards, with STLINK/V2::
9595

96-
tcore --sudo flash
96+
tcore flash --sudo
9797

9898
* For new STM32F407G-DISC1 boards, with STLINK/V2.1::
9999

100-
tcore --sudo flash --debugger-config stlink-v2.1
100+
tcore flash --sudo --debugger-config stlink-v2.1
101101

102102
* For host target, execute::
103103

‎doc/sphinx/source/examples/index.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Examples
99

1010
blinky
1111
hello-world
12+
exti-button-interrupt
1213
stm32f4-discovery-htu21d-sensor
1314
stm32f4-discovery-cs43l22
14-
stm32f4-discovery-exti
1515
stm32f4-discovery-bluetooth-hm10
1616
ti-tm4c123g-sdcard-fatfs-sdspi
1717

‎doc/sphinx/source/examples/stm32f4-discovery-exti.rst‎

Lines changed: 0 additions & 121 deletions
This file was deleted.

‎platform/stm32/export/platform/exti_manager.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ void exti_manager::subscribe(handler &h, trigger t)
237237

238238
save_handler<Gpio>(h);
239239

240-
// Do not let EXTI fire unless user explicitely ask for it.
240+
// Do not let EXTI fire unless user explicitly ask for it.
241241
mask(h);
242242
configure_line<Gpio>(t);
243243

‎platform/tm4c/templates/irq.in.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <platform/exti_manager.hpp>
99
#include <platform/execution.hpp>
10+
#include <common/console.hpp>
1011

1112
#include "aux/uart_cfg.hpp"
1213
#include "aux/spi_cfg.hpp"
@@ -315,7 +316,7 @@ void FLASH_Handler()
315316
extern "C"
316317
void GPIOF_Handler()
317318
{
318-
ecl::abort();
319+
ecl::exti_irq_proxy::deliver_irq<ecl::gpio_hw::port::f>();
319320
}
320321

321322
/* 49 UART2 */

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /