NetBurner 3.5.6
PDF Version
External NMI IRQ 7

External IRQ 7 (Non-Maskable Interrupt) Example

Overview

This example demonstrates how to configure and use External IRQ 7 as a non-maskable interrupt on NetBurner MCF5441X platforms. The application shows both C/C++ and assembly language interrupt service routine (ISR) implementations, providing a complete example of level 7 interrupt handling.

Supported Platforms

  • MOD5441X - MOD54415 development module
  • NANO54415 - Nano54415 development module

Both platforms use the MCF54415 processor with identical interrupt functionality.

Hardware Requirements

Physical Connection Required

This example requires a jumper wire connection between a GPIO pin and the IRQ 7 input pin to trigger the interrupt:

MOD5441X Platform

GPIO Signal Pin: J2.33 ----[JUMPER]---- IRQ 7 Input: J2.48

NANO54415 Platform (Dev Board Rev 1.3)

GPIO Signal: Pin 12 (P2.12) ----[JUMPER]---- IRQ 7: Pin 9 (P1.9)

Pin Configuration Summary

Platform GPIO Signal Pin IRQ 7 Input Pin
MOD5441X J2.33 J2.48
NANO54415 Pin 12 (P2.12) Pin 9 (P1.9)

Features

Interrupt Service Routine (ISR) Implementation

  • Mixed C/C++ and Assembly - Demonstrates both programming approaches
  • Register preservation - Complete context saving and restoration
  • Interrupt flag clearing - Proper interrupt acknowledgment
  • Counter mechanism - Tracks number of interrupts received

GPIO Control

  • Signal generation - Uses GPIO pin to trigger interrupts
  • Edge detection - Configurable for falling, rising, or both edges
  • Manual triggering - Interactive testing via serial console

Web Interface

  • Built-in web server - Provides web-based interface
  • Status display - Shows interrupt counter and system information

Code Architecture

Main Components

  1. UserMain() - Application entry point and main loop
  2. ConfigureIrq7() - IRQ 7 configuration function
  3. NMI_ASM_Part() - Assembly language ISR entry point
  4. NMI_C_Part() - C/C++ interrupt handler
  5. Function_Holder() - Assembly code container function

Interrupt Flow

Hardware IRQ 7 Signal
|
v
NMI_ASM_Part() (Assembly)
- Save processor state
- Mask interrupts (SR = 0x2700)
- Save all registers (D0-D7, A0-A6)
|
v
NMI_C_Part() (C/C++)
- Clear interrupt flag (EPFR)
- Reset GPIO trigger pin
- Increment counter
|
v
NMI_ASM_Part() (Assembly continued)
- Restore all registers
- Restore processor state
- Return from exception (RTE)

Register Usage

Assembly Code Register Operations

move.w #0x2700,%sr ; Set interrupt mask to level 7
lea -60(%a7),%a7 ; Allocate 60 bytes on stack
movem.l %d0-%d7/%a0-%a6,(%a7) ; Save all general registers
jsr NMI_C_Part ; Call C handler
movem.l (%a7),%d0-%d7/%a0-%a6 ; Restore all registers
lea 60(%a7),%a7 ; Restore stack pointer
rte ; Return from exception

Usage Instructions

Setup Process

  1. Build the application
  2. Deploy to device
  3. Install jumper wire
    • Connect GPIO signal pin to IRQ 7 input pin according to platform specifications above
  4. Connect serial terminal
    • Use MTTTY, PuTTY, or similar terminal program
    • Configure for 115200 baud, 8-N-1

Interactive Operation

  1. Start the application - Device will display initialization messages
  2. Press any key - Triggers a falling edge interrupt on IRQ 7
  3. View results - Interrupt counter increments and displays current count
  4. Repeat testing - Continue pressing keys to generate more interrupts

Example Console Output

MOD5441x IRQ 7 application started
Configuring J2-33 as GPIO
Configuring J2-48 as IRQ7
Hit any key to generate an IRQ
[User presses key]
Irq Count: 1
Hit any key to generate an IRQ
[User presses key]
Irq Count: 2
Hit any key to generate an IRQ

Web Interface

Access the web interface at http://<device_ip>/ to view:

  • Welcome page with NetBurner branding
  • System status information
  • Interrupt counter display

Technical Details

Interrupt Configuration

EPORT (External Port) Registers

  • EPPAR - Pin assignment register (edge/level configuration)
  • EPDDR - Data direction register (input/output configuration)
  • EPIER - Interrupt enable register
  • EPFR - Flag register (interrupt status)

Edge Detection Settings (EPPAR Register)

00: Level-sensitive (not used in this example)
01: Rising edge triggered
10: Falling edge triggered (used in this example)
11: Both edges triggered

Interrupt Controller Configuration

  • Vector: 7 (IRQ 7 source)
  • Level: 7 (highest priority, non-maskable)
  • Controller: 0 (primary interrupt controller)

Memory Layout

Stack Frame During Interrupt

Stack Layout (60 bytes total):
+--------+--------+--------+--------+
| D0 | D1 | D2 | D3 | Bytes 0-15
+--------+--------+--------+--------+
| D4 | D5 | D6 | D7 | Bytes 16-31
+--------+--------+--------+--------+
| A0 | A1 | A2 | A3 | Bytes 32-47
+--------+--------+--------+--------+
| A4 | A5 | A6 | --- | Bytes 48-59
+--------+--------+--------+--------+

Important Considerations

IRQ 7 Characteristics

  • Non-maskable - Cannot be disabled by interrupt mask bits
  • Highest priority - Preempts all other interrupts
  • Critical timing - Must be handled quickly to avoid system issues

Development Notes

  • Register preservation is critical in assembly ISR
  • Stack management must be precise (60-byte allocation)
  • Interrupt flag clearing prevents continuous triggering
  • GPIO reset ensures clean signal transitions

Troubleshooting

Common Issues

  1. No interrupts - Check jumper wire connection
  2. Continuous interrupts - Verify interrupt flag clearing in EPFR
  3. System instability - Check assembly code register preservation
  4. Build errors - Ensure SUPPORTED_PLATFORMS matches your hardware

Debug Steps

  1. Verify jumper wire connections match platform specifications
  2. Check serial console output for configuration messages
  3. Confirm GPIO pin functions are set correctly
  4. Test with multimeter to verify signal transitions

Learning Objectives

This example teaches:

  • Mixed-language programming - C/C++ with assembly integration
  • Interrupt handling - Non-maskable interrupt service routines
  • Hardware interface - GPIO and external interrupt configuration
  • Register programming - Direct MCF54415 register manipulation
  • Real-time concepts - Critical timing and context preservation

Build Configuration

Makefile Settings

  • Platforms: NANO54415, MOD5441X
  • Web content: Auto-generated from html/ directory
  • Compile: Standard NetBurner C++ compilation

Dependencies

  • NetBurner NNDK (Network Development Kit)
  • Compatible hardware platform
  • Serial terminal program for interaction

License and Support

This example is provided under NetBurner's standard licensing terms. For technical support:

  • Review the hardware platform documentation
  • Consult the MCF54415 processor reference manual
  • Contact NetBurner technical support for specific issues

Related Examples

For additional interrupt and GPIO examples, see:

  • Basic GPIO examples for pin control
  • Timer interrupt examples for periodic processing
  • External interrupt examples for maskable interrupts (IRQ 1-6)