MATLAB Examples

Asynchronous Scheduling

This example shows how to use the c28x peripherals and Hardware Interrupt blocks to control the real-time execution of Simulink® function-call subsystems in an asynchronous fashion.

Required Hardware:

  • Spectrum Digital F2808/F2812/F28335 eZdsp
  • Texas Instruments™ F2808/F28035/F28069/F28335/F28343 ControlCARD with docking station
  • Texas Instruments™ F28069 ControlSTICK
  • Texas Instruments™ F28M35xx/F28M36xx ControlCARD(To use F28M35x/F28M36x you need Texas Instruments C2000 Concerto Support Package)
  • Texas Instruments™ F2807x/F2837xS/F2837xD ControlCARD or LaunchPad
  • Oscilloscope and probes

Available versions of this example:

Contents

Model

The following figure shows the example model.

close;
open_system('c280x_2833x_asyncscheduling_ert');

Description

The EV Timer blocks are used to configure timer interrupts to be raised on period match. Hardware Interrupt block installs the ISRs for the timer interrupts as well as for an eCAN message receive interrupt. The ISRs in turn call function-call subsystems connected to the Hardware Interrupt block output ports.

Configure the interrupt operation with Configuration Parameters > Hardware Implementation > Hardware board settings > Target hardware resources > External Interrupt. For more information, see docid:texasinstrumentsc2000_ug.buj0fos-1.

The outputs of first two subsystems are running counters. Their sum is used to control the duty cycle of the PWMB for F2812 or ePWM2 for F2808/F28335. The PWM waveform duty cycle increases linearly from 0 to 100 %.

The third subsystem contains an eCAN Rcv block whose message output drives a PWM block (PWMA for F2812 or ePWM1 for F2808/F28335) to control its duty cycle. The duty cycle varies from 0 to 100 % as the eCAN messages are received from an eCAN Xmt block.

NOTE: The Self-Test mode of eCAN_A is enabled to connect eCAN_A transmitter and receiver internally to avoid external connection between transmitter and receiver. Disabling the Self-Test mode for eCAN_A requires transmitter and receiver to be connected together externally.

close_system('c280x_2833x_asyncscheduling_ert', 0);

How to Run the Example on the Board

The following sections explain how to configure, build, and deploy the application that corresponds to your Simulink model..

  • Open the model corresponding to the target hardware you are using.
  • Each model is configured for a default target hardware. To select a different target hardware, go to Model Configuration Parameters > Hardware Implemenation > Hardware board.
  • By default, the model is configured with the CCSv5 toolchain to build, load and run. To change the version of toolchain, go to Model Configuration Parameters > Code Generation > Build process > Toolchain and select the appropriate toolchain matching your Code Composer Studio(CCS) installation.
  • Note that with CCSv3.3, download of the executable to the target is not supported. After building the model, use CCSv3.3 to download and run the program on the hardware.
  • Go to Hardware Implementation > Target Hardware Resources > eCAN_A and check Self-Test Mode.
  • Click OK.
  • Click Build Model or press Ctrl+B to generate and build an .out executable file.
  • Click Build Model to generate, build, load and run the program.
  • Observe the change of the PWM waveform on the oscilloscope.

LocalWords: eZdsp Rcv eZdsp Rcv PWMB PWMA Xmt Sv xmakefilesetup helptargets LocalWords: Xmakefile gmake ticcs ccsv XMakefile