Main Content

Real-Time ECG QRS Detection on ARM Cortex-A Processor

This example shows how to generate and run optimized code for real-time QRS detection of an electrocardiogram (ECG) signal on the ARM® Cortex®-A processor. It uses an ECG signal selector to allow users to choose ECG signal sources with different mean heart rates in the SIMULINK® environment. The optimized code uses the NE10 library for the discrete FIR blocks in the example.

Introduction

The electrocardiogram (ECG) is a recording of body surface potentials generated by the electrical activity of the heart. Clinicians can evaluate an individual's cardiac condition and overall health from the ECG recording and perform further diagnosis. Because of the physiological variability of the QRS complex and various types of noise present in the real ECG signal, it is challenging to accurately detect the QRS complex. The real-time QRS detection algorithm is described in the Real-Time ECG QRS Detection example of DSP System Toolbox.

The NE10 library contains a set of optimized signal processing algorithms for ARM Cortex-A processors. This example shows how to optimize the generated code of a ECG QRS detection model with code replacement from the NE10 library for ARM Cortex-A processors.

Required MathWorks™ Products

DSP System Toolbox™

Simulink Coder™

Embedded Coder™

Embedded Coder Support Package for BeagleBone Black Hardware

DSP System Toolbox Support Package for ARM Cortex-A

Required Hardware

BeagleBone Black board

Open Model

open_system('ex_ecg_sigprocessing_ne10');

Task 1: Simulate

1. Open the ex_ecg_sigprocessing_ne10 example model.

2. Change your current folder in MATLAB® to a writable folder.

3. On the model tool strip, click Run to start the simulation.

4. Use the ECG Signal Selector to switch among ECG signals with different mean heart rates.

5. Click Stop to end simulation.

Task 2: Configure model and Create a PIL block with Optimized Code on ARM Cortex-A Processor

1. Configure the model for ARM Cortex-A code replacement and PIL simulation by following Task 2 of Short-Time Spectral Attenuation on ARM Cortex-A Processor example.

2. Create a PIL block for the ECGSignalProcessingSubsystem block by following Task 1 in example Code Verification and Validation with PIL and External Mode of Embedded Coder Support Package for BeagleBone Black Hardware.

3. When the build finishes, examine the generated code of the PIL block by clicking on the ECGSignalProcessingSubsystem.c file. Notice the multiple function calls, ne10_fir_float_neon, in the generated C code.

Task 4: Real-Time Processing with Processor-in-Loop Mode

1. Replace the ECGSignalProcessingSubsystem block with the generated processor-in-loop (PIL) block.

2. On the model tool strip, click Run to start the simulation with PIL block. The PIL block runs on the BeagleBone Black target. All other parts of the model run on the host machine. The BeagleBone Black target communicates with the host via PIL block input and output.

2. Use the drop down menu of the ECG Signal Selector to switch among ECG signals with different mean heart rates.

3. To configure, build, and run the model in external mode, follow the steps in the Code Verification and Validation with PIL and External Mode example of Embedded Coder Support Package for BeagleBone Black Hardware.

Close Model

bdclose('all')