yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
MSPM0G3519 Development Board📖
1. Introduction to MSPM0
  • 1. Introduction to MSPM0
2. Development environment construction
  • 1. CCS Theia Development
  • 2. MDK Arm Development
  • 3. UniFlash Downloader
  • 4. DAP-LINK download program
  • 5. Program Simulation and Debugging
  • 6. Engineering transplantation
3. Keil basic case
  • 1. Turn on the LED light
  • 2. System Delay
  • 3. Button Control
  • 4. External Interruption
  • 5. Serial Communication
  • 6. Timer
  • 7. PWM Breathing Light
  • 8. ADC Acquisition
  • 9. DMA Transfer
  • 10. Get MPU6050 data (I2C)
  • 11. LCD Display (SPI)
4. CCS basic case
  • 1. Turn on the LED light
  • 2. System Delay
  • 3. Button Control
  • 4. External Interruption
  • 5. Serial Communication
  • 6. Timer
  • 7. PWM Breathing Light
  • 8. ADC Acquisition
  • 9. DMA Transfer
  • 10. Get MPU6050 data (I2C)
  • 11. LCD Display (SPI)
5. MSPM0 Robot Expansion Board
  • 1. MSPM0 Robot Expansion Board Introduction
  • 2. Custom Buttons
  • 3. Drive Buzzer
6. MSPM0-K230Vision module application
  • 1. K230 Color Recognition
  • 2. K230 Barcode Recognition
  • 3. K230 QR Code Recognition
  • 4. K230 Apriltag Code Recognition
  • 5. K230 DM Code Recognition
  • 6. K230 Face Detection
  • 7. K230 Gaze Direction
  • 8. K230 Face Recognition
  • 9. K230 Human Body Detection
  • 10. K230 Fall Detection
  • 11. K230 Palm Detection
  • 12. K230 Gesture Recognition
  • 13. K230 OCR Character Recognition
  • 14. K230 Object Detection
  • 15. K230 Target Tracking
  • 16. K230 Self-learning Object Recognition
  • 17. K230 License Plate Recognition
7. MSPM0-K210Vision module application
  • 0. K210 Prerequisites For Making A Coprocessor - Must-see
  • 1. MSPM0_K210 Color Recognition
  • 2. MSPM0_K210 Barcode Recognition
  • 3. MSPM0_K210 QR Code Recognition
  • 4. MSPM0_K210 Mechanical Code Recognition
  • 5. MSPM0_K210 Face Detection
  • 6. MSPM0_K210 Facial Feature Detection
  • 7. MSPM0_K210 Mask Detection
  • 8. MSPM0_K210 Face Recognition
  • 9. MSPM0_K210 Object Detection
  • 10. MSPM0_K210 Self-study Classification
  • 11. MSPM0_K210 Handwritten Digit Recognition
8. Expansion case
  • 1. Autonomous Driving Car
  • 2. Vehicle-mounted Balance Ball Motion Control System
Download
  • Code
  • Hardware_Info
  • Software_Tools
Download ZIP

Welcome to MSPM0G3519 Development Board repository

4. External Interruption

External Interrupt Experiment

External Interrupt Experiment1. Learning Objectives2. External InterruptExternal Interrupt Advantages and Functions3. Hardware Setup4. Experiment Steps1. Open SYSCONFIG Configuration Tool2. Configure Pin Mode3. Write Program4. Compile4. Program Analysis5. Experimental Phenomena

 

1. Learning Objectives

  1. Learn about external interrupt knowledge on the MSPM0G3519 motherboard.

  2. Use the onboard button to control the onboard LED light on/off.

 

2. External Interrupt

An interrupt is when the CPU, while executing a program, has another event that needs to occupy the CPU. After receiving this interrupt request, the CPU pauses the execution of the original program to execute the interrupt function. After the interrupt function completes, it continues to execute from where it left off in the original program.

External Interrupt refers to an interrupt triggered by external hardware events (usually signals from outside the microcontroller). This interrupt can interrupt the current program execution flow of the microcontroller, allowing it to respond quickly to external hardware events.

External interrupts are usually associated with specific pins (GPIO pins), such as buttons, sensor signals, timer signals, etc. These pins are typically configured to detect specific signal changes (such as rising edge, falling edge, or level changes), thereby triggering an interrupt.

External Interrupt Advantages and Functions

Advantages:

  • Fast Response: External interrupts can respond immediately when a triggering event occurs, without polling signals.

  • Resource Saving: No need to continuously detect signal status in the main loop, saving CPU resources.

  • Improved Real-time Performance: The interrupt mechanism ensures timely processing of critical events, thereby improving system real-time performance.

Functions:

  • Fast Response to External Events: Can immediately interrupt the current program execution and quickly process the event when hardware events occur, without polling signal status. Avoids the program polling for events, greatly saving CPU resources and improving the system's response speed to external events.

  • Improved System Real-time Performance: In scenarios requiring real-time response, external interrupts ensure critical events are processed in a timely manner without waiting for the system main program to complete its current task, thereby improving system real-time performance.

  • Reduced Main Program Burden: External interrupts separate tasks related to external events from the main program, avoiding polling signal status in the main program and improving main program execution efficiency, allowing the main program to focus on core tasks.

  • Core of Event-Driven Systems: Can implement efficient event-driven mechanisms and reduce system complexity.

  • Hardware Interaction and Control: External interrupts enable microcontrollers to real-time process and respond to external hardware signals, ensuring the system operates normally.

  • Data Acquisition and Processing: In many real-time data acquisition systems, external interrupts are used to trigger data acquisition or processing.

  • Low-Power Scenario Triggering Mechanism: Through external interrupts, efficient low-power design can be achieved, allowing the system to remain in sleep state when not working and only run when necessary.

  • System Security Assurance: Timately processing security-related events to ensure system reliability and safety.

 

3. Hardware Setup

This course does not require additional hardware. You can directly use the onboard function button on the MSPM0G3519 development board.

MSPM0G3519 Main Control Diagram

image-20241118203957884

Button Part Schematic

image-20241119185237669

4. Experiment Steps

In this course, the PA18 button will be used to trigger LED1 on PB2 to light up and go out. In software, CPU interrupt mode is used. For LED1 PB2 pin configuration, please refer to the Turn On LED Light course.

1. Open SYSCONFIG Configuration Tool

Create a new empty project empty in CCS.

image-20241126182939655

image-20241126183128934

Find and open the empty.syscfg file in the left workspace of CCS.

image-20241127152938881

In SYSCONFIG, select MCU peripherals on the left, find the GPIO option and click to enter. Click ADD in GPIO to add two groups of pin peripherals: one for LED pins and one for button pins. For LED pin configuration, refer to the previous Turn On LED course. Only button pin configuration is explained here.

image-20241127153052323

 

2. Configure Pin Mode

Configure pin parameters, name the GPIO instance KEY. Since it is connected to PA18, Port selects PORTA.

Set the pin name to PIN_18, set to input mode Input. Internal Resistor sets to pull-down resistor Pull-Down Resistor. Assigned Pin sets the controlled pin to 18.

image-20241119192326266

Configure pin external interrupt. All GPIOA ports brought out from the chip can have external interrupt functionality set.

Enable Interrupts enables the interrupt. Interrupt Priority sets the interrupt priority to default. When multiple interrupts trigger simultaneously, the chip's default priority rules are followed.

Trigger Polarity sets the interrupt trigger mode to rising edge trigger. When the button is pressed, the GPIO pin level changes from low (0) to high (1). This process is called a rising edge. This means the external interrupt will be triggered when the pin state changes from low to high.

Event Publishing Channel does not enable the event publishing channel. The event publishing channel is a mechanism for publishing interrupt events to specified channels. Other peripherals can respond by subscribing to events on the channel.

image-20241119202106443

Save the configuration in the .syscfg file using the shortcut key Ctrl+S.

3. Write Program

According to the MSPM0G series user manual, after GPIO interrupts are triggered, they are all published to the bus through the GRP1 line. After the bus recognizes it, it enters the interrupt service function to execute the content.

img

After configuring the pin interrupt, we also need to manually write the external interrupt service function. Because we enabled the pin falling edge interrupt, when our button goes from pressed to released, the generated falling edge will trigger an interrupt, and after triggering, it will execute the interrupt service function. The interrupt service function name for each interrupt is usually fixed and cannot be modified arbitrarily; otherwise, you will not be able to correctly enter the interrupt service function. The interrupt service function name is GROUP1_IRQHandler.

In the empty.c file, write the following code

​x
#include "ti_msp_dl_config.h"

int main(void)
{
    SYSCFG_DL_init();
    NVIC_EnableIRQ(KEY_INT_IRQN);//Enable GPIOA port interrupt for button pin

    while (1)
    {

    }
}


void GROUP1_IRQHandler(void)//Interrupt service function of Group1
{
    // Read the interrupt register of Group1 and clear the interrupt flag
    switch( DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1) )
    {
        // Check if it is the GPIOA port interrupt of KEY, note that it is INT_IIDX, not PIN_18_IIDX
        case KEY_INT_IIDX:
            // If the button is pressed, it becomes high level
            if( DL_GPIO_readPins(KEY_PORT, KEY_PIN_18_PIN) > 0 )
            {
                // Set LED pin state toggle
                DL_GPIO_togglePins(LED1_PORT, LED1_PIN_2_PIN);
            }
        break;
    }
}

4. Compile

image-20241127155238783

Compilation was successful. You can now download the program to the development board.

4. Program Analysis

  • empty.c

image-20241127184717178

uint32_t DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP group) is used to get the highest priority pending interrupt index in the specified interrupt group.

group: An enumeration type DL_INTERRUPT_GROUP used to specify which interrupt group to check.

This code implements a basic interrupt service function, mainly using button-triggered interrupts to control the status of an LED.

After the main() function initializes, it enables the GPIOA port interrupt for the button. The GROUP1_IRQHandler() interrupt service function gets the highest priority pending flag in Group1, checks if a button interrupt occurred, then calls DL_GPIO_readPins(KEY_PORT, KEY_PIN_18_PIN) to read the button pin level change. If it becomes high level, the LED pin state toggles.

5. Experimental Phenomena

After the program is downloaded, you can control the LED light status with the button. Press once, the LED turns on; press again, the LED turns off.

Button Control
Serial Communication

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文