Skip to content
This repository has been archived by the owner on Nov 3, 2019. It is now read-only.

theCore-embedded/example_button_interrupt

Repository files navigation

Button interrupt (EXTI) example for theCore embedded C++ framework

https://travis-ci.org/theCore-embedded/example_button_interrupt.svg?branch=master

In this application, one particular type of external interrupt is used: GPIO line interrupt. When voltage level changes on the line (e.g. when button is pressed), interrupt is generated.

EXTI - the external interrupt.

An external interrupt is a computer system interrupt that happens as a result of outside interference, whether that’s from the user, from peripherals, from other hardware devices or through a network. These are different than internal interrupts that happen automatically as the machine reads through program instructions.

Techopedia

Detailed description

See theCore documentation for EXTI example for more information.

Supported targets (boards)

Target name Configuration file Description
stm32f4_disc stm32f4_discovery.json STM32F4 discovery board
tiva_tm4c_launchpad tiva_tm4c_launchpad.json TM4C123G LaunchPad Evaluation Kit

Wiring

  • If you have Tiva TM4C Launchpad - simply connect it to the USB.

  • If you have STM32F4 Discovery board:

    1. Attach any preferable UART-to-USB converter module (such as this) according to following pinout:

      PD8 (USART3 TX)

      module's RX

      PD9 (USART3 RX)

      module's TX

      GND

      module's GND

      UART wiring for stm32f4discovery EXTI example
    2. Connect your STM32 Discovery board to the PC.

Preparing

  1. Install and initialize theCore (if not done previously):

    pip3 install tcore
    tcore bootstrap
    
  2. Download the example:

    tcore init --remote https://github.com/theCore-embedded/example_button_interrupt
    
  3. Step into the project directory:

    cd example_button_interrupt
    

Building

  • For STM32 Discovery board:

    tcore compile --target stm32f4_disc
    
  • For Tiva TM4C LaunchPad:

    tcore compile --target tiva_tm4c_launchpad
    

Running

  1. Launch minicom with device associated with USB <-> UART converter. (/dev/ttyUSB0 here used as an example):

    # From new terminal
    tcore runenv "minicom -D /dev/ttyUSB0"
    

    Or the same, but with superuser permissions:

    # From new terminal
    tcore runenv --sudo "minicom -D /dev/ttyUSB0"
    
  2. Run:

    • On TivaC launchpad:

      tcore flash --sudo
      
    • For old STM32F407G-DISC boards, with STLINK/V2:

      tcore flash --sudo
      
    • For new STM32F407G-DISC1 boards, with STLINK/V2.1:

      tcore flash --sudo --debugger-config stlink-v2.1
      

Expected output

Observe console output using minicom if running on the embedded device):

Welcome to theCore
the_core v0.3.0.307 9ff344b-dirty
Starting EXTI (button interrupt) demo

Every time you press a button (SW1 on TivaC board, USR_BTN on STM32F4 Discovery), following output will be displayed:

Button pressed!