Skip to content

jstasiak/rmit_simulink_f28335

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

Intro

Document explaining process of programming TI F28335 eZdsp using Simulink models

Requirements

To generate, build and run code you need the following:

  • Matlab R2011b with Simulink Coder and Embedded Coder add-ons
  • Texas Instruments Code Composer Studio 3.x (Currently we are unable to integrate CCS 4.x with Simulink Coder).

Also, as far as hardware is concerned, you need:

  • TI F28335 eZdsp on board connected to PC

Basic configuration

Steps to create Simulink model which can be used to generate DSP program are simple:

  1. Create new Simulink model
  2. Drop new Simulink Coder/Target Preferences block on the model. In Initializa Configuration Parameters select:
    • IDE/Tool Chain: Texas Instruments Code Composer Studio
    • Board: SD F28355 eZdsp_Do you want to update the model's Configuration Parameters to correspond to your selections: Yes
  3. When in your model window, open Tools/Code Generation/Options... dialog. In Code Generation/IDE Link select appropriate Build action:
    • Build - if you just want to generate and compile code, or
    • Build_and_execute - if you want to generate code, compile it and then automatically run on the DSP

You can find preconfigured model file in models/empty.mdl.

Now it should be possible to execute Tools/Code Generation/Build Model action (Ctrl+B) (program doesn't do anything useful at this point, though).

Interrupt service routines

Basics

Our program is interrupt-based - pieces of code are execute whenever interrupt occures. For that we need to place Embedded Coder/C280x/C28x3x Hardware Interrupt and Simulink/Function-Call Subsystem blocks in the model. Then we connect interrupt output to function-call function() trigger input and set interrupt block configuration.

In Interrupt block the most important parameters are CPU Interrupt Numbers and PIE Interrupt Numbers, they translate to final interrupt identifier.

Multiple interrupts

There can be only 1 interrupt block in the model. If you want to use more than one interrupt, you have to configure needed interrupts (for example: CPU Interrupt Numbers: [3 3], PIE Interrupt Numbers: [1 2]) in this interrupt block and then demux it's output using Demux block.

Interrupt list

Interrupt list for F28335 eZdsp can be found in Table 6-4. in [1]. Interrupt INTX.Y corresponds to CPU Interrupt Number: X and PIE Interrupt Number: Y.

Note

It is not enough just to provide ISR. Interrupt has to be also enabled/triggered in order to execute appropriate ISR. For instance: to enable EPWM1 interrupt, you have to place appropriate EPWM block in the model, set module to EPWM1 and enable interrupts in it's configuration properties.

Some interrupts

  • EPWM1_INT: INT3.1
  • EQEP1_INT: INT5.1
  • EQEP2_INT: INT5.2

Example

Let's configure EPWM1_INT interrupt service routine. We need to:

  • place EPWM block in the model
  • set Module to ePWM1 and check Enable ePWM Interrupt in EPWM's block properties
  • set following values in interrupt's block properties:
    • CPU interrupt numbers: [3] (EPWM Interrupts group)
    • PIE interrupt numbers: [1] (EPWM1 interrupt)
    • Simulink task priorities: [30]
    • Preemption flags: [0]

This configuration triggers function execution whenever EPWM1 interrupt occures.

Laboratory hardware

eQEP configuration

In RMIT laboratory we need following eQEP configuration (in eQEP block configuration parameters):

TODO: check that section

  • General
    • Module: eQEP2
    • Position counter mode: Quadrature-count (better counting precision)
  • Position counter
    • Check Output position counter
    • Set Maximum position counter value to 2048
    • Check Enable set to init value on index event
      • Initialization value: 0
    • Check Enable software initialization (?)

Examples

References

  1. TMS320x2833x, 2823x System Control and Interrupts

About

Some stuff regarding programming TI F28335 DSP with Simulink

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages