SlideShare a Scribd company logo
1 of 47
Download to read offline
Digital Control Applications in
       Power Electronics

            Simone Buso


        University of Padova - Italy
 Department of Electronics and Informatics
      Power Electronics Laboratory


  e-mail: simone.buso@dei.unipd.it
Lesson 1


DSP applications in power electronics:
     ADMC401 and TMS320F240




July/August 2001     Lesson 1       2
Introduction
   Digital Control Advantages:
       • Flexibility
       • Ease of upgrade
       • Man to Machine Interface (MMI)
       • Sophisticated control techniques
       • Reduced number of components
       • Unsensitivity to components’ ageing …
   Digital Control Disadvantages:
        • Design complexity
        • Cost
        • Dynamic performance (sampling frequency,
          quantization...)
July/August 2001          Lesson 1                   3
Introduction
 Available tools for digital control implementation
        • Microcontrollers (µC)
           ♦ CISC (Complex Instruction Set Computer)
             machines (micro-coded instructions)
           ♦ RISC (Reduced Instruction Set Computer)
             machines (with/without hardware multiplier)
           ♦ 4 to 32 bit CPU and bus
        • Digital Signal Processors (DSP)
           ♦ Fixed-point arithmetic
           ♦ Floating-point arithmetic


July/August 2001            Lesson 1                       4
Introduction

General µC features:
  • specifically designed for control tasks
  • A/D converters almost always included on chip
  • capture and compare input pins available
  • several programmable I/O pins
  • timers and counters available (PWM)
  • different kinds of external memory available (ROM,
    EEPROM, FLASH)
  • different computational powers available (from 32 bit
    RISC to simple 8 bit CPU’s and even less)
  • lots of third party development tools (EV-Boards, in-
    circuit emulators (ICE’s))

July/August 2001           Lesson 1                         5
Introduction

General DSP features:
    • not specifically designed for control tasks
    • A/D converters not always included on chip
    • useful peripheral units (CapCom, timers, PWM)
      normally not present on chip
    • very high computational power available (32 bit RISC
      CPU’s both fixed and floating point)
    • relatively few third party development tools (EV-
      Boards)
    • DSP solutions for power electronic applications are
      now available (TMS320F240, ADMC401)


July/August 2001           Lesson 1                      6
Digital Signal Processors [1]

First development in the late 70’s (TMS320C10 - 1979).
Typically designed for open loop digital signal
processing e.g.:
        • real time FFT calculation;
        • digital filtering of sampled signals.
The market for this kind of applications is enormous
and steadily growing, including telecom and consumer
electronics.
Applications in industrial electronics (control tasks) are
rather insignificant in volume. The manifacturers offer
very few control oriented solutions.

July/August 2001               Lesson 1                      7
Digital Signal Processors

Two types of DSP’s can be found:
    • fixed point DSP (16, 24 bit);
    • floating point (typically 32 bit or more).
For control applications, fixed point DSP’s are very close to
modern top-level µC’s (RISC machines with Harvard
architecture and hardware multiplier) in terms of
performance. They are normally much less effective in
terms of peripherals. Globally, they appear more expensive.
Floating point DSP’s are very advantageous, but only for
those applications where high cost for the control system
can be afforded. The lack of peripheral units is almost total
(Þ you must add them).
 July/August 2001             Lesson 1                      8
Digital Signal Processors

                                         Schematic diagram of a
 Instruction                Data         DSP with Harvard
   Memory                  Memory        architecture.

            Instruction
                                       Parallel processing of
                                Data
            Stream                     instructions and data is
                                Stream
                                       allowed by multiple bus
             Instruction               architecture.
 Instruction   Stream    Processing
  Processor                 Unit         The instruction
                                         processor takes care of
                                         address computations.

July/August 2001              Lesson 1                       9
Digital Signal Processors

 Modern DSP’s normally adopt modified Harvard
 architectures featuring:
   • improved instruction processors with more than a
     single address generator;
   • improved processing units with multiple
     independent logic units (ALU, MAC, SHIFT);
   • application specific hardware modules (e.g.
     registers, timers etc. ) in the CPU to speed-up
     typical calculations (e.g. DFT);
   • different internal memory structures with multiple
     data memories and buses or mixed program and
     data memories (useful for filter coefficients).

July/August 2001             Lesson 1                     10
New DSP solutions

    Recently, new DSP solutions have been proposed
    by some manufacturers which merge the DSP
    computational capabilities with some typical µC
    peripheral units.
    The idea is to provide the designer with a control
    oriented DSP, allowing the direct implementation of
    closed loop digital control of power converters with
    minimum additional interface circuitry.
    The main advantage with respect to any µC is in the
    very high computational capability of the DSP.
    Since these devices are not very popular, the cost
    factor may be their weak point.

July/August 2001           Lesson 1                        11
Analog Devices ADMC401 [2]

  • Fixed-point DSP core features:
      ♦ 26 MIPS performance;
      ♦ ADSP 21xx compatible;
      ♦ Single cycle instruction execution
        (38.5 ns @ 13 MHz clock frequency);
      ♦ 16 bit arithmetic and logic unit;
      ♦ Single Cycle 16 bit X 16 bit MAC.
  • Built-in peripheral units:
     ♦ High resolution multi-channel ADC;
     ♦ Three-phase 16 bit PWM generation unit;
     ♦ dual channel event timer unit (CAPCOM);
     ♦ Incremental encoder interface unit.

July/August 2001               Lesson 1          12
Analog Devices ADMC401
                   Functional Block Diagram




        21xx core
                                         µC peripheral units
July/August 2001              Lesson 1                         13
ADMC401: Central Processing Unit




July/August 2001        Lesson 1           14
ADMC401: Central Processing Unit
In one processor cycle the DSP core can:
    • Generate the next program address.
    • Fetch the next instruction.
    • Perform one or two data moves.
    • Update one or two data address pointers.
    • Perform a computational operation.
At the same time, the ADMC401 continues to:
    • Receive and transmit through the serial ports.
    • Decrement the interval timers.
    • Generate PWM signals.
    • Convert the ADC input signals.
    • Operate the encoder interface unit.
    • Operate all other peripherals.
 July/August 2001           Lesson 1                   15
ADMC401: Central Processing Unit
• The ALU performs a standard set of arithmetic and logic
  operations; division primitives are also supported.
• The MAC performs single-cycle multiply, multiply/add,
  multiply/subtract operations with 40 bits of
  accumulation.
• The shifter performs logical and arithmetic shifts,
  normalization, denormalization and derive exponent
  operations. The shifter can be used to implement
  numeric format control efficiently.
• The internal result (R) bus directly connects the
  computational units so that the output of any unit may
  be the input of any unit on the next cycle.

  July/August 2001          Lesson 1                        16
ADMC401: Central Processing Unit


                                   The ALU block diagram
                                   allows to visualize the
                                   function of each ALU
                                   register.
                                   • AX1 AX2: X operand;
                                   • AY1 AY2: Y operand;
                                   • AR: result (used also as X
                                     operand);
                                   • AF: copy of AR (used also
                                     as Y operand);


July/August 2001        Lesson 1                             17
ADMC401: Central Processing Unit

                            The MAC block diagram
                            allows to visualize the
                            function of each MAC
                            register. The structure
                            replicates that of the ALU.

                            • MX1 MX2: X operand;
                            • MY1 MY2: Y operand;
                            • MR0 MR1 MR2: result
                              (used also as X operand);
                            • MF: copy of MR (used also
                              as Y operand);


July/August 2001        Lesson 1                          18
ADMC401: Central Processing Unit


                                   The Shifter block
                                   diagram allows to
                                   visualize the function
                                   of each register.

                                   • SI: input;
                                   • SB: block exponent;
                                   • SR0 SR1: result;
                                   • SE: exponent register.




July/August 2001        Lesson 1                      19
ADMC401: Central Processing Unit

                                      The program sequencer
                                      pre-fetches the next
                                      instruction, generating
                       3              the address from one of
                                      four sources:
                                        • PC incrementer
                                       • PC stack
                       1
                   2
   4                                   • instruction register
                                       • interrupt controller




July/August 2001           Lesson 1                             20
ADMC401: Analog to Digital Converter


                              •     8 analog inputs.
                              •     12 bit resolution.
                              •     conversion time: 2 µs (all
                                    channels thanks to four
                                    stage pipeline architecture).
                              •     4 V p-p input voltage range
                              •     2 channels can be
                                    simultaneously sampled.
                              •     conversion can be
                                    synchronized to PWM or
                                    externally triggered.


July/August 2001         Lesson 1                            21
ADMC401: PWM Generation Unit

                              •   6 PWM outputs.
                              •   16 bit counter resolution.
                              •   programmable output
                                  polarity.
                              •   static or chopped output
                                  signals.
                              •   programmable dead-time and
                                  minimum pulse width.
                              •   single update and double
                                  update mode (for
                                  asymmetrical PWM patterns).
                              •   switching frequency from 198
                                  Hz to 102 kHz.
July/August 2001           Lesson 1                       22
ADMC401: Incremental Encoder Interface

                            • 16 bit up-down counter
                              (frequency and direction of
                              rotation detection).
                            • programmable input noise
                              filter (to avoid spurious
                              triggering).
                            • two additional strobe
                              inputs (to latch the counter
                              contents into registers).
                            • 16 bit loop timer (position
                              and speed loops set point
                              generation).

July/August 2001       Lesson 1                        23
ADMC401: Event Timer Unit

                                 • 16 bit dedicated timer with
                                   programmable frequency.
                                 • 2 independent channels.
                                 • 2 programmable (rising edge
                                   or falling edge) events for
                                   each channel.
                                 • single shot and free-running
                                   modes of operation.
                                 • only capture function, no
                                   possibility of compare mode.



July/August 2001            Lesson 1                      24
ADMC401: Other Ancillary Fuctions


        •   2 auxiliary 8 bit PWM timers
        •   16 bit watchdog timer
        •   Programmable digital I/O port (12 pin)
        •   2 synchronous serial ports




July/August 2001             Lesson 1                25
ADMC401: Software examples (1)
        Approximation of function y = arcos(x)

 1
                                                         y = arcos(x)
0.9
                                                         y = Σi c i x i
0.8

0.7                                                c0 5.0004e-001   4000
0.6

0.5
                                                   c1 -3.3887e-001 D49F
0.4                                                c2 -1.3448e-005 0000
0.3

0.2
                                                   c3 8.8821e-002   0B5E
0.1
                                                   c4 -3.5333e-005 0000
 0
  -1             -0.5       0     0.5         1
                                                   c5 -2.1278e-001 E4C3
       July/August 2001                 Lesson 1                          26
ADMC401: Software examples (1)
.VAR/DM/RAM/SEG=USER_DM3 ACOS_COEFF[5];
.INIT ACOS_COEFF: 0xD49F, 0x0000, 0x0B5E, 0x0000, 0xE4C3;

Arcos:
    AR=-AR;                   { invert sign x=-x }
;
    M0=1; L0=0;
    I0=^ACOS_COEFF;           { pointer to coefficient vector }
;
    MY1=AR;                   { writes AR to MY1. Now MY1 = x}
;
    MF=AR*MY1 (SS),           MX1=dm(I0,M0);         {MF = x2}
    MR=MX1*MY1 (RND),         MX1=dm(I0,M0);         {MR = c1x}

   July/August 2001             Lesson 1
                                           parallel instructions
                                                              27
ADMC401: Software examples (1)

          CNTR=0x0003;                   { order -2 }
          DO appr UNTIL CE;              { executes Σ }
          MR=MR+MX1*MF (RND);            { MR=c1x+c2x2 }
appr: MF=AR*MF (SS), MX1=dm(I0,M0);      { MF=MF*x }
          MR=MR+MX1*MF (RND);
          AY0=0x4000;                    { add c0 }
          AR=MR1+AY0;                    { AR = y }


Complete execution requires less than 1 µs (≈800 ns)

  July/August 2001            Lesson 1                    28
ADMC401: Software examples (2)
PI controller
Equivalent block diagram:

                     kp
  u                                        +   y
                                           +
                    k’i
                          +     i
                          +

                                z-1            z-1 = unity delay

    where k’I = ki·T (sampling period).
July/August 2001                Lesson 1                     29
ADMC401: Software examples (2)
PI controller implementation:
kp = 16·6000h       k’i = (1/8)·200h
AX0 = dm(Vout);
AY0 = dm(Vref);                      { u(k) = Vout - Vref }
AR = AX0 - AY0;                      { compute error u(k) }
dm(u) = AR;                          { store u(k) in memory }
MX0 = AR;                            { MX0 = u(k) }
MY0 = kp;                            { load kp gain }
MR = MX0 * MY0 (SS);                 { MR = kp*u(k) }
IF MV SAT MR;                        { saturate if necessary }
SR = ASHIFT MR1 BY 4 (LO);           { multiply proportional }
{                                       part p by 16 to scale }
{                                       kp gain as required }
 July/August 2001         Lesson 1                                30
ADMC401: Software examples (2)
dm(p) = SR0;                       { store result in memory}
AF = PASS SR0;                     { AF = p(k) }
AR = dm(u);                        { AR = u(k) }
SR = ASHIFT AR BY -2 (LO);         { divide input variable u }
{                                    by 4 to scale ki gain }
MY0 = ki;                          { load ki gain }
MR1 = dm(i);                       { load i(k-1) }
MR = MR + SR0 * MY0 (SS);          { i(k) = i(k-1) + ki/4·u(k) }
IF MV SAT MR;                      { saturate if necessary }
AR = MR1;
dm(i) = AR;                        { store integral part }
AR = AR + AF;                      { AR = p(k) + i(k)}

Complete execution requires ≈ 700 ns
 July/August 2001            Lesson 1                              31
Texas Instruments TMS320F240 [3]

  • Fixed-point DSP core features:
      ♦ 20 MIPS performance;
      ♦ TMS320C25 source code compatible;
      ♦ Single cycle instruction execution
        (50 ns @ 20 MHz CPU clock frequency);
      ♦ 16 bit arithmetic and logic unit;
      ♦ Single Cycle 16 bit X 16 bit signed product.
  • Main built-in peripheral units:
     ♦ 10 bit resolution, 16 channel ADC;
     ♦ 12 channel 16 bit PWM generation unit;
     ♦ 3 16 bit general purpose timers;
     ♦ 4 independent capture circuits.

July/August 2001           Lesson 1                    32
TMS320F240 Functional Block Diagram

                                   Central Arithmetic
                                   Logic Unit (CALU)

                                   Event Manager:
                                   Timers
                                   Compare Units ...


                                   Dual 10 bit ADC


July/August 2001        Lesson 1                       33
TMS320F240 Central Arithmetic and Logic Unit


                        • Advanced Harvard
                          architecture with multiple
                          bus.
                        • 16 bit X 16 bit hardware
                          multiplier with 32 bit
                          accumulator (1 cycle
                          execution).
                        • 16 bit input scaling shifter
                          (used for data alignment
                          before logic or arithmetic
                          operations).


July/August 2001     Lesson 1                        34
TMS320F240 Event Manager
                                 • 3 general purpose timers for
                                   16 bit up/down counts and
                                   compare functions (including
                                   additional PWM generation).
                                 • 6 full compare ouputs for
                                   PWM applications with dead-
                                   time generators (0 to 102µs).
                                 • 3 simple compare units.
                                 • The 12 available PWM outputs
                                   have all 50 ns resolution and
                                   16 bit dynamic range.
                                 • 4 channel capture unit
                                   operating on GPT1 or GPT2,
                                   with 2 level FIFO.
July/August 2001              Lesson 1                     35
TMS320F240 Analog to Digital Converter

                                    • 2 10 bit ADC’s with
                                      built-in S/H circuits.
                                    • 16 input channels
                                      available, but only 2
                                      can be sampled
                                      simultaneously.
                                    • Minimum conversion
                                      time 6.1 µs.
                                    • Single shot or
                                      continuous mode of
                                      operation.
                                    • 2 level FIFO for result
                                      storing.
July/August 2001         Lesson 1                         36
TMS320F240 Ancillary Peripheral Functions

        • 4 pin serial peripheral interface
        • watchdog timer
        • Quadrature - encoder pulse circuit
        • 28 programmable I/O pins




July/August 2001          Lesson 1             37
TMS320F240: Comparison with ADMC401
 CPU:
        • TMS has a slightly lower throughput (20
          MIPS, 50 ns cycle @ 20 MHz vs 26 MIPS,
          38.5 ns cycle @ 13 MHz).
        • Similar pipelined architecture for single
          cycle execution of instructions.
        • The TMS shifter has lower flexibility (only
          left shift is programmable).
        • Both allow saturated arithmetic mode of
          operation.
July/August 2001           Lesson 1                     38
TMS320F240: Comparison with ADMC401

 CPU:
        • Only two registers are associated to the
          multiplier in the TMS. The ADMC has four.
          Multiplication by a 13-bit constant is
          available as a single instruction in the TMS.
        • TMS allows four different automatic shift
          strategies after multiplication, ADMC only
          fractional and integer mode.



July/August 2001           Lesson 1                    39
TMS320F240: Comparison with ADMC401
Timers / Counters:
      • Both have three timers. TMS has three GP
        timers with capture and compare functions.
        ADMC has also three timers, but two of them
        are dedicated to specific functions (PWM,
        Event Timing Unit).
      • Both have 16 bit timer resolution and wide
        frequency programmability.
      • The ADMC PWM unit provides double update
        mode of operation, while TMS doesn’t.
July/August 2001         Lesson 1                    40
TMS320F240: Comparison with ADMC401
Timers / Counters:
      • TMS offers an embedded SVM hardware
        module to automatically implement a flat-top
        type of PWM modulation. This simplifies the
        software [4] to some extent (T1 and T2 have
        to be computed).




July/August 2001         Lesson 1                 41
TMS320F240: Comparison with ADMC401

A/D converter:
      • The TMS provides up to 16 analog inputs
        thanks to two 8 to 1 multiplexers. ADMC only
        provides 8 inputs.
      • Both allow simultaneous sampling of two
        channels.
      • The TMS has a minimum conversion time of
        6.2 µs per channel. The ADMC converts all
        the 8 inputs in 2 µs.

July/August 2001         Lesson 1                 42
TMS320F240: Comparison with ADMC401

A/D converter:
      • The TMS has 10 bit resolution with 5V peak
        to peak dynamic range, the ADMC has 12 bit
        resolution with 4V peak to peak dynamic
        range.




July/August 2001        Lesson 1                 43
TMS320F240: Software example

PI controller implementation:
    voltage reference is #6DD0h

     LDP #0              ; select memory page
     CLRC SXM            ; disable sign extension
     LACC Vout           ; load voltage sample
     SFR                 ; right shift (alignment)
     SETC SXM            ; enable sign extension
     SUB #6DD0h          ; calculate error (Vout - Vref)
     NEG                 ; invert sign ACC = u = Vref - Vout
     LDP #6              ; select memory page
     SACL u              ; save voltage u(k) error in memory

July/August 2001                 Lesson 1                      44
TMS320F240: Software example

   LT u(k)              ; load TREG with u(k)
   MPY ki               ; compute ki*u(k)
   PAC                  ; ACC = ki*u(k)
   RPT #15              ; repeat following instruction 15 times
   SFR                  ; discard 16 LSB’s
   ADD i                ; ACC = ki*u(k) + i(k-1)
   SACL i               ; store lower ACC into variable i(k)
   ;
   MPY kp               ; compute kp*u(k), u(k) is in TREG
   PAC                  ; ACC = kp*u(k)
   SACH p               ; store higher ACC into variable p



July/August 2001                 Lesson 1                         45
TMS320F240: Software example

LACC i                 ; Load ACC with variable i(k)
ADD p                  ; ACC = i(k) + p(k)
RPT #4                 ; shift to scale the gains
SFR                    ; 4 bits right
LDP #0h                ; select memory page
SACL y                 ; store higher ACC in y = PI output


 Complete execution requires ≈ 1.5 µs




July/August 2001                  Lesson 1                   46
References

[1] P. Pirsch, “Architectures for Digital Signal Processing”, 1998,
    John Wiley and Sons (ISBN 0-471-97145-6).
[2] Analog Devices Winter 1999 Designers’ Reference Manual.
[3] Texas Instruments 1999 TMS320 DSP Solutions CD-ROM.
[4] Texas Instruments, Application Report SPRA524, ”Space-Vector
    PWM With TMS320C24x/F24x Using Hardware and Software
    Determined Switching Patterns”.




July/August 2001              Lesson 1                           47

More Related Content

What's hot (18)

Digital Signal Processors - DSP's
Digital Signal Processors - DSP'sDigital Signal Processors - DSP's
Digital Signal Processors - DSP's
 
DSP Processor
DSP Processor DSP Processor
DSP Processor
 
Digital Signal Processor evolution over the last 30 years
Digital Signal Processor evolution over the last 30 yearsDigital Signal Processor evolution over the last 30 years
Digital Signal Processor evolution over the last 30 years
 
DSP Memory Architecture
DSP Memory ArchitectureDSP Memory Architecture
DSP Memory Architecture
 
Digital signal processors
Digital signal processorsDigital signal processors
Digital signal processors
 
Modern processor art
Modern processor artModern processor art
Modern processor art
 
Unit ii.arc of tms320 c5 xx
Unit ii.arc of tms320 c5 xxUnit ii.arc of tms320 c5 xx
Unit ii.arc of tms320 c5 xx
 
DIGITAL SIGNAL PROCESSOR OVERVIEW
DIGITAL SIGNAL PROCESSOR OVERVIEWDIGITAL SIGNAL PROCESSOR OVERVIEW
DIGITAL SIGNAL PROCESSOR OVERVIEW
 
Fixed-point Multi-Core DSP Platform
Fixed-point Multi-Core DSP PlatformFixed-point Multi-Core DSP Platform
Fixed-point Multi-Core DSP Platform
 
An introduction to digital signal processors 1
An introduction to digital signal processors 1An introduction to digital signal processors 1
An introduction to digital signal processors 1
 
Uint3 vtu format
Uint3 vtu formatUint3 vtu format
Uint3 vtu format
 
Unit I.fundamental of Programmable DSP
Unit I.fundamental of Programmable DSPUnit I.fundamental of Programmable DSP
Unit I.fundamental of Programmable DSP
 
Digital Signal Processor
Digital Signal ProcessorDigital Signal Processor
Digital Signal Processor
 
Features of tms_320_2nd_generation_dsp
Features of tms_320_2nd_generation_dspFeatures of tms_320_2nd_generation_dsp
Features of tms_320_2nd_generation_dsp
 
Digital Signal processor ADSP 21XX family
Digital Signal processor ADSP 21XX familyDigital Signal processor ADSP 21XX family
Digital Signal processor ADSP 21XX family
 
01 dsp intro_1
01 dsp intro_101 dsp intro_1
01 dsp intro_1
 
TMS320C6X Architecture
TMS320C6X ArchitectureTMS320C6X Architecture
TMS320C6X Architecture
 
Unit4.addressing modes 54 xx
Unit4.addressing modes 54 xxUnit4.addressing modes 54 xx
Unit4.addressing modes 54 xx
 

Similar to dsp Lesson1

Sudhir tms 320 f 2812
Sudhir tms 320 f 2812 Sudhir tms 320 f 2812
Sudhir tms 320 f 2812 vijaydeepakg
 
PIC Introduction and explained in detailed
PIC Introduction and explained in detailedPIC Introduction and explained in detailed
PIC Introduction and explained in detailedAnkita Tiwari
 
0.FPGA for dummies: Historical introduction
0.FPGA for dummies: Historical introduction0.FPGA for dummies: Historical introduction
0.FPGA for dummies: Historical introductionMaurizio Donna
 
Overview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerOverview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerRup Chowdhury
 
Introduction2_PIC.ppt
Introduction2_PIC.pptIntroduction2_PIC.ppt
Introduction2_PIC.pptAakashRawat35
 
isa architecture
isa architectureisa architecture
isa architectureAJAL A J
 
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptxINDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptxMeghdeepSingh
 
LPC 2148 ARM MICROCONTROLLER
LPC 2148 ARM MICROCONTROLLERLPC 2148 ARM MICROCONTROLLER
LPC 2148 ARM MICROCONTROLLERsravannunna24
 
Introduction to microprocessor
Introduction to microprocessorIntroduction to microprocessor
Introduction to microprocessorRamaPrabha24
 
unit 1ARM INTRODUCTION.pptx
unit 1ARM INTRODUCTION.pptxunit 1ARM INTRODUCTION.pptx
unit 1ARM INTRODUCTION.pptxKandavelEee
 
TMSLF2407 DSP Controller
TMSLF2407 DSP ControllerTMSLF2407 DSP Controller
TMSLF2407 DSP ControllerANIRUDDHMAINI1
 
PLC Introduction Details
PLC Introduction DetailsPLC Introduction Details
PLC Introduction Detailssuhaskhadake
 
Lecture 1 (course overview and 8051 architecture) rv01
Lecture 1 (course overview and 8051 architecture) rv01Lecture 1 (course overview and 8051 architecture) rv01
Lecture 1 (course overview and 8051 architecture) rv01cairo university
 
Embedded systems, 8051 microcontroller
Embedded systems, 8051 microcontrollerEmbedded systems, 8051 microcontroller
Embedded systems, 8051 microcontrollerAmandeep Alag
 

Similar to dsp Lesson1 (20)

Sudhir tms 320 f 2812
Sudhir tms 320 f 2812 Sudhir tms 320 f 2812
Sudhir tms 320 f 2812
 
Lec09-DSP.pdf
Lec09-DSP.pdfLec09-DSP.pdf
Lec09-DSP.pdf
 
PIC Introduction and explained in detailed
PIC Introduction and explained in detailedPIC Introduction and explained in detailed
PIC Introduction and explained in detailed
 
DSP Processor.pptx
DSP Processor.pptxDSP Processor.pptx
DSP Processor.pptx
 
0.FPGA for dummies: Historical introduction
0.FPGA for dummies: Historical introduction0.FPGA for dummies: Historical introduction
0.FPGA for dummies: Historical introduction
 
Overview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerOverview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontroller
 
Introduction2_PIC.ppt
Introduction2_PIC.pptIntroduction2_PIC.ppt
Introduction2_PIC.ppt
 
Iot Workshop NITT 2015
Iot Workshop NITT 2015Iot Workshop NITT 2015
Iot Workshop NITT 2015
 
isa architecture
isa architectureisa architecture
isa architecture
 
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptxINDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
 
LPC 2148 ARM MICROCONTROLLER
LPC 2148 ARM MICROCONTROLLERLPC 2148 ARM MICROCONTROLLER
LPC 2148 ARM MICROCONTROLLER
 
Introduction to microprocessor
Introduction to microprocessorIntroduction to microprocessor
Introduction to microprocessor
 
unit 1ARM INTRODUCTION.pptx
unit 1ARM INTRODUCTION.pptxunit 1ARM INTRODUCTION.pptx
unit 1ARM INTRODUCTION.pptx
 
TMSLF2407 DSP Controller
TMSLF2407 DSP ControllerTMSLF2407 DSP Controller
TMSLF2407 DSP Controller
 
PLC Introduction Details
PLC Introduction DetailsPLC Introduction Details
PLC Introduction Details
 
Lecture 1 (course overview and 8051 architecture) rv01
Lecture 1 (course overview and 8051 architecture) rv01Lecture 1 (course overview and 8051 architecture) rv01
Lecture 1 (course overview and 8051 architecture) rv01
 
Ppt embedded
Ppt embeddedPpt embedded
Ppt embedded
 
abc
abcabc
abc
 
dspa details
dspa detailsdspa details
dspa details
 
Embedded systems, 8051 microcontroller
Embedded systems, 8051 microcontrollerEmbedded systems, 8051 microcontroller
Embedded systems, 8051 microcontroller
 

Recently uploaded

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

dsp Lesson1

  • 1. Digital Control Applications in Power Electronics Simone Buso University of Padova - Italy Department of Electronics and Informatics Power Electronics Laboratory e-mail: simone.buso@dei.unipd.it
  • 2. Lesson 1 DSP applications in power electronics: ADMC401 and TMS320F240 July/August 2001 Lesson 1 2
  • 3. Introduction Digital Control Advantages: • Flexibility • Ease of upgrade • Man to Machine Interface (MMI) • Sophisticated control techniques • Reduced number of components • Unsensitivity to components’ ageing … Digital Control Disadvantages: • Design complexity • Cost • Dynamic performance (sampling frequency, quantization...) July/August 2001 Lesson 1 3
  • 4. Introduction Available tools for digital control implementation • Microcontrollers (µC) ♦ CISC (Complex Instruction Set Computer) machines (micro-coded instructions) ♦ RISC (Reduced Instruction Set Computer) machines (with/without hardware multiplier) ♦ 4 to 32 bit CPU and bus • Digital Signal Processors (DSP) ♦ Fixed-point arithmetic ♦ Floating-point arithmetic July/August 2001 Lesson 1 4
  • 5. Introduction General µC features: • specifically designed for control tasks • A/D converters almost always included on chip • capture and compare input pins available • several programmable I/O pins • timers and counters available (PWM) • different kinds of external memory available (ROM, EEPROM, FLASH) • different computational powers available (from 32 bit RISC to simple 8 bit CPU’s and even less) • lots of third party development tools (EV-Boards, in- circuit emulators (ICE’s)) July/August 2001 Lesson 1 5
  • 6. Introduction General DSP features: • not specifically designed for control tasks • A/D converters not always included on chip • useful peripheral units (CapCom, timers, PWM) normally not present on chip • very high computational power available (32 bit RISC CPU’s both fixed and floating point) • relatively few third party development tools (EV- Boards) • DSP solutions for power electronic applications are now available (TMS320F240, ADMC401) July/August 2001 Lesson 1 6
  • 7. Digital Signal Processors [1] First development in the late 70’s (TMS320C10 - 1979). Typically designed for open loop digital signal processing e.g.: • real time FFT calculation; • digital filtering of sampled signals. The market for this kind of applications is enormous and steadily growing, including telecom and consumer electronics. Applications in industrial electronics (control tasks) are rather insignificant in volume. The manifacturers offer very few control oriented solutions. July/August 2001 Lesson 1 7
  • 8. Digital Signal Processors Two types of DSP’s can be found: • fixed point DSP (16, 24 bit); • floating point (typically 32 bit or more). For control applications, fixed point DSP’s are very close to modern top-level µC’s (RISC machines with Harvard architecture and hardware multiplier) in terms of performance. They are normally much less effective in terms of peripherals. Globally, they appear more expensive. Floating point DSP’s are very advantageous, but only for those applications where high cost for the control system can be afforded. The lack of peripheral units is almost total (Þ you must add them). July/August 2001 Lesson 1 8
  • 9. Digital Signal Processors Schematic diagram of a Instruction Data DSP with Harvard Memory Memory architecture. Instruction Parallel processing of Data Stream instructions and data is Stream allowed by multiple bus Instruction architecture. Instruction Stream Processing Processor Unit The instruction processor takes care of address computations. July/August 2001 Lesson 1 9
  • 10. Digital Signal Processors Modern DSP’s normally adopt modified Harvard architectures featuring: • improved instruction processors with more than a single address generator; • improved processing units with multiple independent logic units (ALU, MAC, SHIFT); • application specific hardware modules (e.g. registers, timers etc. ) in the CPU to speed-up typical calculations (e.g. DFT); • different internal memory structures with multiple data memories and buses or mixed program and data memories (useful for filter coefficients). July/August 2001 Lesson 1 10
  • 11. New DSP solutions Recently, new DSP solutions have been proposed by some manufacturers which merge the DSP computational capabilities with some typical µC peripheral units. The idea is to provide the designer with a control oriented DSP, allowing the direct implementation of closed loop digital control of power converters with minimum additional interface circuitry. The main advantage with respect to any µC is in the very high computational capability of the DSP. Since these devices are not very popular, the cost factor may be their weak point. July/August 2001 Lesson 1 11
  • 12. Analog Devices ADMC401 [2] • Fixed-point DSP core features: ♦ 26 MIPS performance; ♦ ADSP 21xx compatible; ♦ Single cycle instruction execution (38.5 ns @ 13 MHz clock frequency); ♦ 16 bit arithmetic and logic unit; ♦ Single Cycle 16 bit X 16 bit MAC. • Built-in peripheral units: ♦ High resolution multi-channel ADC; ♦ Three-phase 16 bit PWM generation unit; ♦ dual channel event timer unit (CAPCOM); ♦ Incremental encoder interface unit. July/August 2001 Lesson 1 12
  • 13. Analog Devices ADMC401 Functional Block Diagram 21xx core µC peripheral units July/August 2001 Lesson 1 13
  • 14. ADMC401: Central Processing Unit July/August 2001 Lesson 1 14
  • 15. ADMC401: Central Processing Unit In one processor cycle the DSP core can: • Generate the next program address. • Fetch the next instruction. • Perform one or two data moves. • Update one or two data address pointers. • Perform a computational operation. At the same time, the ADMC401 continues to: • Receive and transmit through the serial ports. • Decrement the interval timers. • Generate PWM signals. • Convert the ADC input signals. • Operate the encoder interface unit. • Operate all other peripherals. July/August 2001 Lesson 1 15
  • 16. ADMC401: Central Processing Unit • The ALU performs a standard set of arithmetic and logic operations; division primitives are also supported. • The MAC performs single-cycle multiply, multiply/add, multiply/subtract operations with 40 bits of accumulation. • The shifter performs logical and arithmetic shifts, normalization, denormalization and derive exponent operations. The shifter can be used to implement numeric format control efficiently. • The internal result (R) bus directly connects the computational units so that the output of any unit may be the input of any unit on the next cycle. July/August 2001 Lesson 1 16
  • 17. ADMC401: Central Processing Unit The ALU block diagram allows to visualize the function of each ALU register. • AX1 AX2: X operand; • AY1 AY2: Y operand; • AR: result (used also as X operand); • AF: copy of AR (used also as Y operand); July/August 2001 Lesson 1 17
  • 18. ADMC401: Central Processing Unit The MAC block diagram allows to visualize the function of each MAC register. The structure replicates that of the ALU. • MX1 MX2: X operand; • MY1 MY2: Y operand; • MR0 MR1 MR2: result (used also as X operand); • MF: copy of MR (used also as Y operand); July/August 2001 Lesson 1 18
  • 19. ADMC401: Central Processing Unit The Shifter block diagram allows to visualize the function of each register. • SI: input; • SB: block exponent; • SR0 SR1: result; • SE: exponent register. July/August 2001 Lesson 1 19
  • 20. ADMC401: Central Processing Unit The program sequencer pre-fetches the next instruction, generating 3 the address from one of four sources: • PC incrementer • PC stack 1 2 4 • instruction register • interrupt controller July/August 2001 Lesson 1 20
  • 21. ADMC401: Analog to Digital Converter • 8 analog inputs. • 12 bit resolution. • conversion time: 2 µs (all channels thanks to four stage pipeline architecture). • 4 V p-p input voltage range • 2 channels can be simultaneously sampled. • conversion can be synchronized to PWM or externally triggered. July/August 2001 Lesson 1 21
  • 22. ADMC401: PWM Generation Unit • 6 PWM outputs. • 16 bit counter resolution. • programmable output polarity. • static or chopped output signals. • programmable dead-time and minimum pulse width. • single update and double update mode (for asymmetrical PWM patterns). • switching frequency from 198 Hz to 102 kHz. July/August 2001 Lesson 1 22
  • 23. ADMC401: Incremental Encoder Interface • 16 bit up-down counter (frequency and direction of rotation detection). • programmable input noise filter (to avoid spurious triggering). • two additional strobe inputs (to latch the counter contents into registers). • 16 bit loop timer (position and speed loops set point generation). July/August 2001 Lesson 1 23
  • 24. ADMC401: Event Timer Unit • 16 bit dedicated timer with programmable frequency. • 2 independent channels. • 2 programmable (rising edge or falling edge) events for each channel. • single shot and free-running modes of operation. • only capture function, no possibility of compare mode. July/August 2001 Lesson 1 24
  • 25. ADMC401: Other Ancillary Fuctions • 2 auxiliary 8 bit PWM timers • 16 bit watchdog timer • Programmable digital I/O port (12 pin) • 2 synchronous serial ports July/August 2001 Lesson 1 25
  • 26. ADMC401: Software examples (1) Approximation of function y = arcos(x) 1 y = arcos(x) 0.9 y = Σi c i x i 0.8 0.7 c0 5.0004e-001 4000 0.6 0.5 c1 -3.3887e-001 D49F 0.4 c2 -1.3448e-005 0000 0.3 0.2 c3 8.8821e-002 0B5E 0.1 c4 -3.5333e-005 0000 0 -1 -0.5 0 0.5 1 c5 -2.1278e-001 E4C3 July/August 2001 Lesson 1 26
  • 27. ADMC401: Software examples (1) .VAR/DM/RAM/SEG=USER_DM3 ACOS_COEFF[5]; .INIT ACOS_COEFF: 0xD49F, 0x0000, 0x0B5E, 0x0000, 0xE4C3; Arcos: AR=-AR; { invert sign x=-x } ; M0=1; L0=0; I0=^ACOS_COEFF; { pointer to coefficient vector } ; MY1=AR; { writes AR to MY1. Now MY1 = x} ; MF=AR*MY1 (SS), MX1=dm(I0,M0); {MF = x2} MR=MX1*MY1 (RND), MX1=dm(I0,M0); {MR = c1x} July/August 2001 Lesson 1 parallel instructions 27
  • 28. ADMC401: Software examples (1) CNTR=0x0003; { order -2 } DO appr UNTIL CE; { executes Σ } MR=MR+MX1*MF (RND); { MR=c1x+c2x2 } appr: MF=AR*MF (SS), MX1=dm(I0,M0); { MF=MF*x } MR=MR+MX1*MF (RND); AY0=0x4000; { add c0 } AR=MR1+AY0; { AR = y } Complete execution requires less than 1 µs (≈800 ns) July/August 2001 Lesson 1 28
  • 29. ADMC401: Software examples (2) PI controller Equivalent block diagram: kp u + y + k’i + i + z-1 z-1 = unity delay where k’I = ki·T (sampling period). July/August 2001 Lesson 1 29
  • 30. ADMC401: Software examples (2) PI controller implementation: kp = 16·6000h k’i = (1/8)·200h AX0 = dm(Vout); AY0 = dm(Vref); { u(k) = Vout - Vref } AR = AX0 - AY0; { compute error u(k) } dm(u) = AR; { store u(k) in memory } MX0 = AR; { MX0 = u(k) } MY0 = kp; { load kp gain } MR = MX0 * MY0 (SS); { MR = kp*u(k) } IF MV SAT MR; { saturate if necessary } SR = ASHIFT MR1 BY 4 (LO); { multiply proportional } { part p by 16 to scale } { kp gain as required } July/August 2001 Lesson 1 30
  • 31. ADMC401: Software examples (2) dm(p) = SR0; { store result in memory} AF = PASS SR0; { AF = p(k) } AR = dm(u); { AR = u(k) } SR = ASHIFT AR BY -2 (LO); { divide input variable u } { by 4 to scale ki gain } MY0 = ki; { load ki gain } MR1 = dm(i); { load i(k-1) } MR = MR + SR0 * MY0 (SS); { i(k) = i(k-1) + ki/4·u(k) } IF MV SAT MR; { saturate if necessary } AR = MR1; dm(i) = AR; { store integral part } AR = AR + AF; { AR = p(k) + i(k)} Complete execution requires ≈ 700 ns July/August 2001 Lesson 1 31
  • 32. Texas Instruments TMS320F240 [3] • Fixed-point DSP core features: ♦ 20 MIPS performance; ♦ TMS320C25 source code compatible; ♦ Single cycle instruction execution (50 ns @ 20 MHz CPU clock frequency); ♦ 16 bit arithmetic and logic unit; ♦ Single Cycle 16 bit X 16 bit signed product. • Main built-in peripheral units: ♦ 10 bit resolution, 16 channel ADC; ♦ 12 channel 16 bit PWM generation unit; ♦ 3 16 bit general purpose timers; ♦ 4 independent capture circuits. July/August 2001 Lesson 1 32
  • 33. TMS320F240 Functional Block Diagram Central Arithmetic Logic Unit (CALU) Event Manager: Timers Compare Units ... Dual 10 bit ADC July/August 2001 Lesson 1 33
  • 34. TMS320F240 Central Arithmetic and Logic Unit • Advanced Harvard architecture with multiple bus. • 16 bit X 16 bit hardware multiplier with 32 bit accumulator (1 cycle execution). • 16 bit input scaling shifter (used for data alignment before logic or arithmetic operations). July/August 2001 Lesson 1 34
  • 35. TMS320F240 Event Manager • 3 general purpose timers for 16 bit up/down counts and compare functions (including additional PWM generation). • 6 full compare ouputs for PWM applications with dead- time generators (0 to 102µs). • 3 simple compare units. • The 12 available PWM outputs have all 50 ns resolution and 16 bit dynamic range. • 4 channel capture unit operating on GPT1 or GPT2, with 2 level FIFO. July/August 2001 Lesson 1 35
  • 36. TMS320F240 Analog to Digital Converter • 2 10 bit ADC’s with built-in S/H circuits. • 16 input channels available, but only 2 can be sampled simultaneously. • Minimum conversion time 6.1 µs. • Single shot or continuous mode of operation. • 2 level FIFO for result storing. July/August 2001 Lesson 1 36
  • 37. TMS320F240 Ancillary Peripheral Functions • 4 pin serial peripheral interface • watchdog timer • Quadrature - encoder pulse circuit • 28 programmable I/O pins July/August 2001 Lesson 1 37
  • 38. TMS320F240: Comparison with ADMC401 CPU: • TMS has a slightly lower throughput (20 MIPS, 50 ns cycle @ 20 MHz vs 26 MIPS, 38.5 ns cycle @ 13 MHz). • Similar pipelined architecture for single cycle execution of instructions. • The TMS shifter has lower flexibility (only left shift is programmable). • Both allow saturated arithmetic mode of operation. July/August 2001 Lesson 1 38
  • 39. TMS320F240: Comparison with ADMC401 CPU: • Only two registers are associated to the multiplier in the TMS. The ADMC has four. Multiplication by a 13-bit constant is available as a single instruction in the TMS. • TMS allows four different automatic shift strategies after multiplication, ADMC only fractional and integer mode. July/August 2001 Lesson 1 39
  • 40. TMS320F240: Comparison with ADMC401 Timers / Counters: • Both have three timers. TMS has three GP timers with capture and compare functions. ADMC has also three timers, but two of them are dedicated to specific functions (PWM, Event Timing Unit). • Both have 16 bit timer resolution and wide frequency programmability. • The ADMC PWM unit provides double update mode of operation, while TMS doesn’t. July/August 2001 Lesson 1 40
  • 41. TMS320F240: Comparison with ADMC401 Timers / Counters: • TMS offers an embedded SVM hardware module to automatically implement a flat-top type of PWM modulation. This simplifies the software [4] to some extent (T1 and T2 have to be computed). July/August 2001 Lesson 1 41
  • 42. TMS320F240: Comparison with ADMC401 A/D converter: • The TMS provides up to 16 analog inputs thanks to two 8 to 1 multiplexers. ADMC only provides 8 inputs. • Both allow simultaneous sampling of two channels. • The TMS has a minimum conversion time of 6.2 µs per channel. The ADMC converts all the 8 inputs in 2 µs. July/August 2001 Lesson 1 42
  • 43. TMS320F240: Comparison with ADMC401 A/D converter: • The TMS has 10 bit resolution with 5V peak to peak dynamic range, the ADMC has 12 bit resolution with 4V peak to peak dynamic range. July/August 2001 Lesson 1 43
  • 44. TMS320F240: Software example PI controller implementation: voltage reference is #6DD0h LDP #0 ; select memory page CLRC SXM ; disable sign extension LACC Vout ; load voltage sample SFR ; right shift (alignment) SETC SXM ; enable sign extension SUB #6DD0h ; calculate error (Vout - Vref) NEG ; invert sign ACC = u = Vref - Vout LDP #6 ; select memory page SACL u ; save voltage u(k) error in memory July/August 2001 Lesson 1 44
  • 45. TMS320F240: Software example LT u(k) ; load TREG with u(k) MPY ki ; compute ki*u(k) PAC ; ACC = ki*u(k) RPT #15 ; repeat following instruction 15 times SFR ; discard 16 LSB’s ADD i ; ACC = ki*u(k) + i(k-1) SACL i ; store lower ACC into variable i(k) ; MPY kp ; compute kp*u(k), u(k) is in TREG PAC ; ACC = kp*u(k) SACH p ; store higher ACC into variable p July/August 2001 Lesson 1 45
  • 46. TMS320F240: Software example LACC i ; Load ACC with variable i(k) ADD p ; ACC = i(k) + p(k) RPT #4 ; shift to scale the gains SFR ; 4 bits right LDP #0h ; select memory page SACL y ; store higher ACC in y = PI output Complete execution requires ≈ 1.5 µs July/August 2001 Lesson 1 46
  • 47. References [1] P. Pirsch, “Architectures for Digital Signal Processing”, 1998, John Wiley and Sons (ISBN 0-471-97145-6). [2] Analog Devices Winter 1999 Designers’ Reference Manual. [3] Texas Instruments 1999 TMS320 DSP Solutions CD-ROM. [4] Texas Instruments, Application Report SPRA524, ”Space-Vector PWM With TMS320C24x/F24x Using Hardware and Software Determined Switching Patterns”. July/August 2001 Lesson 1 47