Texas Instruments TMS320F20x/F24x DSP Bedienungsanleitung

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108

Zur Seite of

Richtige Gebrauchsanleitung

Die Vorschriften verpflichten den Verkäufer zur Übertragung der Gebrauchsanleitung Texas Instruments TMS320F20x/F24x DSP an den Erwerber, zusammen mit der Ware. Eine fehlende Anleitung oder falsche Informationen, die dem Verbraucher übertragen werden, bilden eine Grundlage für eine Reklamation aufgrund Unstimmigkeit des Geräts mit dem Vertrag. Rechtsmäßig lässt man das Anfügen einer Gebrauchsanleitung in anderer Form als Papierform zu, was letztens sehr oft genutzt wird, indem man eine grafische oder elektronische Anleitung von Texas Instruments TMS320F20x/F24x DSP, sowie Anleitungsvideos für Nutzer beifügt. Die Bedingung ist, dass ihre Form leserlich und verständlich ist.

Was ist eine Gebrauchsanleitung?

Das Wort kommt vom lateinischen „instructio”, d.h. ordnen. Demnach kann man in der Anleitung Texas Instruments TMS320F20x/F24x DSP die Beschreibung der Etappen der Vorgehensweisen finden. Das Ziel der Anleitung ist die Belehrung, Vereinfachung des Starts, der Nutzung des Geräts oder auch der Ausführung bestimmter Tätigkeiten. Die Anleitung ist eine Sammlung von Informationen über ein Gegenstand/eine Dienstleistung, ein Hinweis.

Leider widmen nicht viele Nutzer ihre Zeit der Gebrauchsanleitung Texas Instruments TMS320F20x/F24x DSP. Eine gute Gebrauchsanleitung erlaubt nicht nur eine Reihe zusätzlicher Funktionen des gekauften Geräts kennenzulernen, sondern hilft dabei viele Fehler zu vermeiden.

Was sollte also eine ideale Gebrauchsanleitung beinhalten?

Die Gebrauchsanleitung Texas Instruments TMS320F20x/F24x DSP sollte vor allem folgendes enthalten:
- Informationen über technische Daten des Geräts Texas Instruments TMS320F20x/F24x DSP
- Den Namen des Produzenten und das Produktionsjahr des Geräts Texas Instruments TMS320F20x/F24x DSP
- Grundsätze der Bedienung, Regulierung und Wartung des Geräts Texas Instruments TMS320F20x/F24x DSP
- Sicherheitszeichen und Zertifikate, die die Übereinstimmung mit entsprechenden Normen bestätigen

Warum lesen wir keine Gebrauchsanleitungen?

Der Grund dafür ist die fehlende Zeit und die Sicherheit, was die bestimmten Funktionen der gekauften Geräte angeht. Leider ist das Anschließen und Starten von Texas Instruments TMS320F20x/F24x DSP zu wenig. Eine Anleitung beinhaltet eine Reihe von Hinweisen bezüglich bestimmter Funktionen, Sicherheitsgrundsätze, Wartungsarten (sogar das, welche Mittel man benutzen sollte), eventueller Fehler von Texas Instruments TMS320F20x/F24x DSP und Lösungsarten für Probleme, die während der Nutzung auftreten könnten. Immerhin kann man in der Gebrauchsanleitung die Kontaktnummer zum Service Texas Instruments finden, wenn die vorgeschlagenen Lösungen nicht wirksam sind. Aktuell erfreuen sich Anleitungen in Form von interessanten Animationen oder Videoanleitungen an Popularität, die den Nutzer besser ansprechen als eine Broschüre. Diese Art von Anleitung gibt garantiert, dass der Nutzer sich das ganze Video anschaut, ohne die spezifizierten und komplizierten technischen Beschreibungen von Texas Instruments TMS320F20x/F24x DSP zu überspringen, wie es bei der Papierform passiert.

Warum sollte man Gebrauchsanleitungen lesen?

In der Gebrauchsanleitung finden wir vor allem die Antwort über den Bau sowie die Möglichkeiten des Geräts Texas Instruments TMS320F20x/F24x DSP, über die Nutzung bestimmter Accessoires und eine Reihe von Informationen, die erlauben, jegliche Funktionen und Bequemlichkeiten zu nutzen.

Nach dem gelungenen Kauf des Geräts, sollte man einige Zeit für das Kennenlernen jedes Teils der Anleitung von Texas Instruments TMS320F20x/F24x DSP widmen. Aktuell sind sie genau vorbereitet oder übersetzt, damit sie nicht nur verständlich für die Nutzer sind, aber auch ihre grundliegende Hilfs-Informations-Funktion erfüllen.

Inhaltsverzeichnis der Gebrauchsanleitungen

  • Seite 1

    TMS320F20x/F24x DSP Embedded Flash Memory T echnical Reference This document contains preliminary data current as of publication date and is subject to change without notice. Literature Number: SPRU282 September 1998 Printed on Recycled Paper[...]

  • Seite 2

    IMPORT ANT NOTICE T exas Instruments and its subsidiaries (TI) reserve the right to make changes to their products or to discontinue any product or service without notice, and advise customers to obtain the latest version of relevant information to verify , before placing orders, that information being relied on is current and complete. All product[...]

  • Seite 3

    iii PRELIMINARY Preface Read This First About This Manual This reference guide describes the operation of the embedded flash EEPROM module on the TMS320F20x/F24x digital signal processor (DSP) devices and provides sample code that you can use in developing your own software. The performance specifications of the embedded flash memory have been eval[...]

  • Seite 4

    PRELIMINARY iv PRELIMINARY If you are looking for in- formation about: T urn to these locations: Over-erasure (depletion) and recovery Section 1.1, Basic Concepts of Flash Memory T echnology Section 2.7, Recovering From Over-Erasure (Flash-Write Operation) Section 3.4, Flash-Write Algorithm Programming the flash array Section 1.1, Basic Concepts of[...]

  • Seite 5

    Related Documentation From T exas Instruments PRELIMINARY v Read This First PRELIMINARY Related Documentation From T exas Instruments The following books describe the ’F20x/24x and related support tools. T o ob- tain a copy of any of these TI documents, call the T exas Instruments Literature Response Center at (800) 477–8924. When ordering, ple[...]

  • Seite 6

    Related Documentation From T exas Instruments PRELIMINARY vi PRELIMINARY TMS320C2xx C Source Debugger User ’s Guide (literature number SPRU151) tells you how to invoke the ’C2xx emulator and simulator ver- sions of the C source debugger interface. This book discusses various aspects of the debugger interface, including window management, com- m[...]

  • Seite 7

    If Y ou Need Assistance . . . PRELIMINARY vii Read This First PRELIMINARY If Y ou Need Assistance . . . - World-W ide Web Sites TI Online http://www .ti.com Semiconductor Product Information Center (PIC) http://www .ti.com/sc/docs/pic/home.htm DSP Solutions http://www .ti.com/dsps 320 Hotline On-line t http://www .ti.com/sc/docs/dsps/support.htm - [...]

  • Seite 8

    PRELIMINARY viii PRELIMINARY[...]

  • Seite 9

    Contents ix Contents 1 Introduction 1 Ć 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Discusses basic flash memory technology; summarizes the features and benefits of the TMS320F20x/F24x flash module 1.1 Basic Concepts of Flash Memory T echnology 1 Ć 2 .[...]

  • Seite 10

    Contents x A.1.1 Header File for Constants and V ariables, SV AR20.H A Ć 2 . . . . . . . . . . . . . . . . . . . . . A.1.2 Clear Algorithm, SCLR20.ASM A Ć 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.1.3 Erase Algorithm, SERA20.ASM A Ć 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .[...]

  • Seite 11

    Figures xi Contents Figures 1–1 TMS320F20x/F24x Program Space Memory Maps 1 Ć 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2–1 Flash Memory Logic Levels During Programming and Erasing 2 Ć 4 . . . . . . . . . . . . . . . . . . . . . . 2–2 Memory Maps in Register and Array Access Modes 2 Ć 6 . . . . . . . . . . . . . . .[...]

  • Seite 12

    T ables xii T ables 1–1 TMS320 Devices With On-Chip Flash EEPROM 1 Ć 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2–1 Operations that Modify the Contents of the Flash Array 2 Ć 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2–2 Flash Module Control Registers 2 Ć 8 . . . . . . . . . . . . . . . . . . . . [...]

  • Seite 13

    1-1 Introduction The TMS320F20x/F24x digital signal processors (DSPs) contain on-chip flash EEPROM (electrically-erasable programmable read-only memory). The em- bedded flash memory provides an attractive alternative to masked program ROM. Like ROM, flash memory is nonvolatile, but it has an advantage over ROM: in-system reprogrammability . This ch[...]

  • Seite 14

    Basic Concepts of Flash Memory T echnology PRELIMINARY 1-2 PRELIMINARY 1.1 Basic Concepts of Flash Memory T echnology The term flash in this EEPROM technology refers to the speed of some of the operations performed on the memory (these operations will be described in greater detail later in this document). An entire block of bits is affected simult[...]

  • Seite 15

    TMS320F20x/F24x Flash Module PRELIMINARY 1-3 Introduction PRELIMINARY 1.2 TMS320F20x/F24x Flash Module The ’F20x/F24x flash EEPROM is implemented with one or two independent flash memory modules of 8K or 16K words. Each flash module is composed of a flash memory array , four control registers, and circuitry that produces ana- log voltages for pro[...]

  • Seite 16

    TMS320F20x/F24x Flash Module PRELIMINARY 1-4 PRELIMINARY Simplified memory maps for the program space of the TMS320F20x/F24x de- vices are shown in Figure 1–1 to illustrate the location of the flash modules. Figure 1–1. TMS320F20x/F24x Program Space Memory Maps 0000h 1FFFh FFFFh Flash0 TMS320F241 Flash0 0000h 1FFFh Flash0 4000h 3FFFh 0000h FFFF[...]

  • Seite 17

    Benefits of Embedded Flash Memory in a DSP System PRELIMINARY 1-5 Introduction PRELIMINARY 1.3 Benefits of Embedded Flash Memory in a DSP System The circuitry density of flash memory is about half that of conventional EE- PROM memory , making it possible to approach DRAM densities with flash memory . This increased density allows flash memory to be[...]

  • Seite 18

    PRELIMINARY 1-6 PRELIMINARY[...]

  • Seite 19

    2-1 Flash Operations and Control Registers The operations that modify the contents of the ’F20x/F24x flash array are per- formed in software through the use of dedicated programming algorithms. This chapter introduces the operations performed by these algorithms and explains the role of the control registers in this process. The actual algorithms[...]

  • Seite 20

    Operations that Modify the Contents of the ’F20x/F24x Flash Array PRELIMINARY 2-2 PRELIMINARY 2.1 Operations that Modify the Contents of the ’F20x/F24x Flash Array Operations that modify the contents of the flash array are generically referred to as either “programming,” which drives one or more bits toward the logic zero state, or “erasi[...]

  • Seite 21

    Operations that Modify the Contents of the ’F20x/F24x Flash Array PRELIMINARY 2-3 Flash Operations and Control Registers PRELIMINARY This procedure is discussed in complete detail in Chapter 3. During these operations that are used to modify the contents of the flash array , three special read modes, and a corresponding set of reference voltage l[...]

  • Seite 22

    Operations that Modify the Contents of the ’F20x/F24x Flash Array PRELIMINARY 2-4 PRELIMINARY Figure 2–1. Flash Memory Logic Levels During Programming and Erasing Erase operation Depletion Mode Logic 1 1 Margin 0 Margin Logic 0 VER0 Erase (T owards logic Clear Program Flash Write (T owards logic Reference level Inverse Erase Program operations [...]

  • Seite 23

    Accessing the Flash Module PRELIMINARY 2-5 Flash Operations and Control Registers PRELIMINARY 2.2 Accessing the Flash Module In addition to the flash memory array , each flash module has four registers that control operations on the flash array . These registers are:  Segment control register (SEG_CTR)  T est register (TST)  Write address [...]

  • Seite 24

    Accessing the Flash Module PRELIMINARY 2-6 PRELIMINARY Figure 2–2. Memory Maps in Register and Array Access Modes SEG_CTR register TST register W ADRS register WDA T A register Flash memory array Flash access control register (single bit) MODE = 1: Array-access mode MODE = 0: Register access mode 0100 ... 010 0100 ... 01 1 1 1 10 ...1 10 01 10 ..[...]

  • Seite 25

    Accessing the Flash Module PRELIMINARY 2-7 Flash Operations and Control Registers PRELIMINARY Although the function is the same, the access control registers of the ’F206 de- vice are mapped at different addresses from that of the ’F24x devices, and their values are modified in a different way . 2.2.2 TMS320F24x Flash Access-Control Register Th[...]

  • Seite 26

    Flash Module Control Registers PRELIMINARY 2-8 PRELIMINARY 2.3 Flash Module Control Registers T able 2–2 lists the control registers and their relative addresses within the four locations that repeat throughout the module’s address range. T able 2–2. Flash Module Control Registers Relative Register Described in ... R e l at i ve Address R eg [...]

  • Seite 27

    Flash Module Control Registers PRELIMINARY 2-9 Flash Operations and Control Registers PRELIMINARY T able 2–3. Segment Control Register Field Descriptions Bits Name Description 15–8 SEG7–SEG0 Segment enable bits. Each of these bits protects the specified segment against pro- gramming or enables programming for the specified segment in the arra[...]

  • Seite 28

    Flash Module Control Registers PRELIMINARY 2-10 PRELIMINARY T able 2–4. Flash Array Segments Summary SEG7–SEG0 Bits ’F206/F240 Flash Module † ’F241 / F24 3 Arr ay Seg m e nt 15 14 13 12 11 10 9 8 Flash0 Flash1 F241/F243 Flash Module Array Segment Enabled 0 0 0 0 0 0 0 1 0000–07FFh 4000–47FFh 0000–03FFh 0 00000010 0800–0FFFh 4800?[...]

  • Seite 29

    Flash Module Control Registers PRELIMINARY 2-1 1 Flash Operations and Control Registers PRELIMINARY 2.3.4 Write Data Register (WDA T A) The write data register (WDA T A) is a 16-bit register that contains the latched write data for a programming operation. In array-access mode, this register can be loaded by writing a data value to the flash module[...]

  • Seite 30

    Read Modes PRELIMINARY 2-12 PRELIMINARY 2.4 Read Modes The ’F20x/F24x flash module uses four read modes and corresponding sets of reference levels:  Standard  V erify 0s (VER0)  V erify 1s (VER1)  Inverse-erase Read mode selection is accomplished through the verify bits (bits 3 and 4) in SEG_CTR during execution of the algorithms. In [...]

  • Seite 31

    Program Operation PRELIMINARY 2-13 Flash Operations and Control Registers PRELIMINARY 2.5 Program Operation The program operation of the ’F20x/F24x flash module loads the application- specific data (a pattern of 0s) into the flash array . The basis of the operation is applying a program pulse to a single word of flash memory . The term pro- gram [...]

  • Seite 32

    Erase Operation PRELIMINARY 2-14 PRELIMINARY 2.6 Erase Operation The erase operation of the ’F20x/F24x flash module prepares the flash array for programming and enables reprogrammability of the flash array . Before the array can be erased, all bits must be programmed to 0s. This procedure of pro- gramming all array locations in preparation for th[...]

  • Seite 33

    Recovering From Over-Erasure (Flash-Write Operation) PRELIMINARY 2-15 Flash Operations and Control Registers PRELIMINARY 2.7 Recovering From Over-Erasure (Flash-Write Operation) Generally , not all bits in the flash array have the same amount of charge re- moved with each erase pulse. By the time all bits have reached the VER1 read margin (and eras[...]

  • Seite 34

    Reading From the Flash Array PRELIMINARY 2-16 PRELIMINARY 2.8 Reading From the Flash Array Once the array is programmed, it is read in the same manner as other memory devices on the DSP memory interface. The flash module operates with zero wait states. When you are reading the flash module, the flash segment control register (SEG_CTR) bits should b[...]

  • Seite 35

    3-1 Algorithm Implementations and Software Considerations This chapter discusses the implementations of the algorithms for performing the operations described in the previous chapter . It also discusses items you must consider when incorporating the algorithms into your ’F20x/F24x DSP application code. T opic Page 3.1 How the Algorithms Fit Into [...]

  • Seite 36

    How the Algorithms Fit Into the Program-Erase-Reprogram Flow PRELIMINARY 3-2 PRELIMINARY 3.1 How the Algorithms Fit Into the Program-Erase-Reprogram Flow The algorithms discussed in this chapter can be used to reprogram the ’F20x/F24x flash module multiple times. The clear algorithm, erase algorithm, and flash-write algorithm are used to prepare [...]

  • Seite 37

    How the Algorithms Fit Into the Program-Erase-Reprogram Flow PRELIMINARY 3-3 Algorithm Implementations and Software Considerations PRELIMINARY Figure 3–1. Algorithms in the Overall Flow Flash-write algorithm Erase algorithm Clear algorithm X = X+1 flash-write Recover using Fail Ye s No X < 10 ? array Erase the Clear the array No Ye s Reprogram[...]

  • Seite 38

    Programming (or Clear) Algorithm PRELIMINARY 3-4 PRELIMINARY 3.2 Programming (or Clear) Algorithm The programming algorithm sequentially writes any number of addresses with a specified bit pattern.This algorithm is used to program application code or data into the flash array . With a slight modification, the same algorithm per- forms the clear por[...]

  • Seite 39

    Programming (or Clear) Algorithm PRELIMINARY 3-5 Algorithm Implementations and Software Considerations PRELIMINARY The main feature of the program/clear algorithm is the concept of program- ming an entire row of bits in a group. The ’F20x/F24x flash array is organized in rows of 32 words. That is, addresses 0000h through 001Fh are physically loca[...]

  • Seite 40

    Programming (or Clear) Algorithm PRELIMINARY 3-6 PRELIMINARY Figure 3–3. Programming or Clear Algorithm Flow Same row Device failure Continue Current address > end address? No Ye s Row_done = true? No Ye s No Ye s End of row? No Ye s Pulsecount  =max † ? Apply program pulse; row_done = false Increment address New row V erify con- tents of[...]

  • Seite 41

    Programming (or Clear) Algorithm PRELIMINARY 3-7 Algorithm Implementations and Software Considerations PRELIMINARY Another important consideration is the total amount of time required to do the programming. The number of programming pulses required to completely pro- gram a flash memory cell increases as ambient temperature increases and/or supply [...]

  • Seite 42

    Programming (or Clear) Algorithm PRELIMINARY 3-8 PRELIMINARY T able 3–1. Steps for V erifying Programmed Bits and Applying One Program or Clear Pulse (Continued) Step Description Action 7 Mask the data to program lower byte. Mask any bits in the lower byte that do not require programming (are al- ready read as zero), and mask off upper byte. Reca[...]

  • Seite 43

    Programming (or Clear) Algorithm PRELIMINARY 3-9 Algorithm Implementations and Software Considerations PRELIMINARY Before each program pulse is applied, a read of the byte is performed to deter- mine which bits have reached the programmed level. Any bits that have reached the programmed level are masked (set to 1 in the WDA T A register). This meth[...]

  • Seite 44

    Erase Algorithm PRELIMINARY 3-10 PRELIMINARY 3.3 Erase Algorithm The erase algorithm follows the clear algorithm in executing the entire initial- ization flow . Figure 3–4 highlights the erase algorithm’s place in the overall flow . Figure 3–4. Erase Algorithm in the Overall Flow Flash-write algorithm Erase algorithm Clear algorithm X = X+1 f[...]

  • Seite 45

    Erase Algorithm PRELIMINARY 3-1 1 Algorithm Implementations and Software Considerations PRELIMINARY T able 3–2. Steps for Applying One Erase Pulse Step Action Description 1 Power up the V CCP pin. Set V CCP pin to V DD. If the V CCP pin for the flash module to be erased is not set to V DD , then the array will not be erased properly . 2 Load WDA [...]

  • Seite 46

    Erase Algorithm PRELIMINARY 3-12 PRELIMINARY 4) The actual address is restored. 5) The contents of the restored address are read. The advantage of this approach is that it forces the worst-case switching condi- tion on the flash addressing logic during the reads, thus improving the margin of the erase. Address complementing on the ’F20x/F24x can [...]

  • Seite 47

    Erase Algorithm PRELIMINARY 3-13 Algorithm Implementations and Software Considerations PRELIMINARY Figure 3–5. Erase Algorithm Flow Program array check Depletion Ye s No All 32 words = 0000h? Read first 32 words W ait for t d(BUSY -INVERSE) Set VER0 and VER1 bits in SEG_CTR Clear all bits in SEG_CTR Start (all words=0000h) erase V erify No Ye s N[...]

  • Seite 48

    Flash-Write Algorithm PRELIMINARY 3-14 PRELIMINARY 3.4 Flash-W rite Algorithm The flash-write operation recovers bits in depletion mode, which can be caused by over-erasure. The flash-write algorithm’s place in the overall flow is highlighted in Figure 3–6. Figure 3–6. Flash-Write Algorithm in the Overall Flow Flash-write algorithm Erase algo[...]

  • Seite 49

    Flash-Write Algorithm PRELIMINARY 3-15 Algorithm Implementations and Software Considerations PRELIMINARY T able 3–3. Steps for Applying One Flash-Write Pulse Steps Action Description 1 Power up the V CCP pin. Set the V CCP pin to V DD . If the V CCP pin for the flash module to be re- covered is not set to V DD , then the flash-write operation wil[...]

  • Seite 50

    Flash-Write Algorithm PRELIMINARY 3-16 PRELIMINARY Figure 3–7. Flash-Write Algorithm Flow Start Depletion check No Ye s No Ye s Flash-write pulse count ≥ Max † ? Device failure Apply one flash-write pulse to flash array (see T able 3–3) All 32 words = 0000h? Read first 32 words W ait for t d(RD-VERIFY) Set VER0 and VER1 bits in SEG_CTR Go t[...]

  • Seite 51

    Flash-Write Algorithm PRELIMINARY 3-17 Algorithm Implementations and Software Considerations PRELIMINARY The CPU frequency range for the application is an important consideration for the depletion test, as well as for the program and erase operations. Because of the actual implementation of the flash memory circuitry , a bit in depletion mode is mo[...]

  • Seite 52

    PRELIMINARY 3-18 PRELIMINARY[...]

  • Seite 53

    A-1 Appendix A Assembly Source Listings and Program Examples The flash array is erased and programmed by code running on the DSP core. This code can originate from off-chip memory or can be loaded into on-chip RAM. The available flash programming tools for the ’F20x/F24x allow you to program the on-chip flash module without having knowledge or vi[...]

  • Seite 54

    Assembly Source for Algorithms PRELIMINARY A-2 PRELIMINARY A.1 Assembly Source for Algorithms The algorithm source files implement the flows given in Chapter 3. Each algo- rithm is written as an assembly language subroutine, beginning with a label at an entry point and ending with a return instruction. The algorithms share a set of 16 relocatable v[...]

  • Seite 55

    Assembly Source for Algorithms PRELIMINARY A-3 Assembly Source Listings and Program Examples PRELIMINARY ************************************************************** ** Variable declaration file ** * ** * TMS320F2XX Flash Utilities. ** * Revision: 2.0, 9/10/97 ** * Revision: 2.1, 1/31/98 ** * ** * Filename: svar20.asm ** * ** *Note: ** *DLOOP is [...]

  • Seite 56

    Assembly Source for Algorithms PRELIMINARY A-4 PRELIMINARY *CONSTANTS * ********************************************************* *Conditional assembly variable for F24X vs F206. * *If F24X = 1, then assemble for F24X; otherwise, * *assemble for F206. * ********************************************************* F24X .set 0 ;Assemble for F206 ;F24X .[...]

  • Seite 57

    Assembly Source for Algorithms PRELIMINARY A-5 Assembly Source Listings and Program Examples PRELIMINARY A.1.2 Clear Algorithm, SCLR20.ASM This code is an implementation of the clear (programming) algorithm de- scribed in section 3.2 on page 3-4. Recall that the clear algorithm is identical to the programming algorithm with the data forced to 0000h[...]

  • Seite 58

    Assembly Source for Algorithms PRELIMINARY A-6 PRELIMINARY * programmed bits. For example, if the flash is programmed * * using a CLKOUT period of 50 ns, the flash can be read back * reliably over the CLKOUT period range of 50 ns to 150 ns * * (6.67 MHz–20 MHz). The programming pulse-duration is * * 100 us, and a maximum of 150 pulses is applied [...]

  • Seite 59

    Assembly Source for Algorithms PRELIMINARY A-7 Assembly Source Listings and Program Examples PRELIMINARY SACL FL_ST ;Save array start address. LACL FL_ADRS ;Get segment start address. NEWROW ;********Begin a new row.* SACL BASE_1 ;Save row start address. LAR AR1,#0 ;Init pulse count to zero. SAMEROW ;********Same row, next pulse.* SPLK #1,BASE_0 ;S[...]

  • Seite 60

    Assembly Source for Algorithms PRELIMINARY A-8 PRELIMINARY * SPAD2 Flash program + EXE command. * ************************************************************* EXE_PGM ;* CALL ARRAY ;ACCESS ARRAY * *LOAD WADRS AND WDATA ** LACL FL_ADRS ;ACC => PROGRAM ADRS * TBLW FL_DATA ;LOAD WADRS AND WDATA * CALL REGS ;ACCESS FLASH REGS * *SET UP WRITE COMMAN[...]

  • Seite 61

    Assembly Source for Algorithms PRELIMINARY A-9 Assembly Source Listings and Program Examples PRELIMINARY TBLW SPAD1 ;EXECUTE COMMAND * LAR AR6,#D10 ;SET DELAY * CALL DELAY,*,AR6 ;WAIT * CALL ARRAY ;ACCESS FLASH ARRAY * RET ;RETURN TO CALLING SEQUENCE* ************************************************************* ************************************[...]

  • Seite 62

    Assembly Source for Algorithms PRELIMINARY A-10 PRELIMINARY A.1.3 Erase Algorithm, SERA20.ASM This code is an implementation of the erase algorithm described in section 3.3 on page 3-10. Memory section: fl_ers Entry point: GERS Parameters to be declared and initialized by the calling code are:  PROTECT defines the values of bits 8–15 of SEG_CT[...]

  • Seite 63

    Assembly Source for Algorithms PRELIMINARY A-1 1 Assembly Source Listings and Program Examples PRELIMINARY * The erase pulse duration is 7ms, and a maximum of ** * 1000 pulses is applied to the array. ** * ** * The following resources are used for temporary storage: ** * AR0 Used for comparisons ** * AR1 Used for erase pulse count ** * AR2 Used for[...]

  • Seite 64

    Assembly Source for Algorithms PRELIMINARY A-12 PRELIMINARY CLRC OVM ;Disable overflow mode. LACL SEG_ST ;Get segment start address. AND #04000h ;Get array start address. SACL FL_ST ;Save array start address. OR #03FFFh ;Get array end address. SACL FL_END ;Save array end address. SPLK #0,ERROR ;Reset error flag LAR AR1,#0 ;Set erase count to 0. SPL[...]

  • Seite 65

    Assembly Source for Algorithms PRELIMINARY A-13 Assembly Source Listings and Program Examples PRELIMINARY ***** If here, then an error has occurred. EXIT SPLK #1,ERROR ;Update error flag SPLK #STOP,BASE_0 ;Stop command. CALL SET_MODE ;Disable any flash cmds. B DONE ;Get outa here. ************************************************************ .page *[...]

  • Seite 66

    Assembly Source for Algorithms PRELIMINARY A-14 PRELIMINARY * * * The following resources are used for temporary storage: * * BASE_0 Flash STOP command, and FFFF for WDATA. * * BASE_5 Flash erase command. * * BASE_6 Flash erase + EXE command. * ************************************************************* ERASE_A * SET UP FLASH ERASE COMMANDS FOR P[...]

  • Seite 67

    Assembly Source for Algorithms PRELIMINARY A-15 Assembly Source Listings and Program Examples PRELIMINARY A.1.4 Flash-Write Algorithm, SFL W20.ASM This code is an implementation of the flash-write algorithm described in sec- tion 3.4 on page 3-14. Memory section: fl_wrt Entry point: FL WS Parameters to be declared and initialized by the calling cod[...]

  • Seite 68

    Assembly Source for Algorithms PRELIMINARY A-16 PRELIMINARY * BASE_3 Used for EXE + flw cmd * ************************************************************** .include ”svar20.h” ;defines variables for flash0 ;or for flash1 array * MAX_FLW .set 10000 ;Allow only 10000 flw pulses. INV_ER .set 018h ;INVERSE ERASE COMMAND WORD FLWR .set 6 ;FLASH WRI[...]

  • Seite 69

    Assembly Source for Algorithms PRELIMINARY A-17 Assembly Source Listings and Program Examples PRELIMINARY BCND FL_WRITE, NEQ ;If ACC<>0, then flwrite. *Else, continue until until done with row. BANZ NEXT_IVERS ;Loop 32 times. SPLK #STOP,BASE_0 ;Flash STOP command. CALL SET_MODE ;Disable flash commands. ;If here then test passed. DONE RET ;Ret[...]

  • Seite 70

    Assembly Source for Algorithms PRELIMINARY A-18 PRELIMINARY LAR AR0,#MAX_FLW CMPR 2 ;If AR1>MAX_FLW then BCND EXIT,TC ;Fail, don’t continue recovery. B INV_ERASE ;Else, perform iverase again. ************************************************** * SET_MODE: This routine sets the flash in the * * mode specified by the contents of BASE_0. This * * [...]

  • Seite 71

    Assembly Source for Algorithms PRELIMINARY A-19 Assembly Source Listings and Program Examples PRELIMINARY A.1.5 Programming Algorithm, SPGM20.ASM This code is an implementation of the program algorithm described in section 3.2 on page 3-4. Memory section: fl_prg Entry point: GPGMJ Parameters to be declared and initialized by the calling code are: ?[...]

  • Seite 72

    Assembly Source for Algorithms PRELIMINARY A-20 PRELIMINARY * bits. For example, if the flash is programmed using a * * CLKOUT period of 50 ns, the flash can be reliably read * * back over the CLKOUT period range of 50 ns to 150 ns * * (6.67MHz–20 MHz). The programming pulse duration is * * 100 us, and a maximum of 150 pulses is applied per row. [...]

  • Seite 73

    Assembly Source for Algorithms PRELIMINARY A-21 Assembly Source Listings and Program Examples PRELIMINARY * BASE_3 Used for buffer/row start addr * * BASE_4 Used for destination end addr * * BASE_5 Used for byte mask * ****************************************************** GPGMJ: SPLK #0,IMR ;MASK ALL INTERRUPTS SETC INTM ;GLOBALLY MASK ALL INTERRU[...]

  • Seite 74

    Assembly Source for Algorithms PRELIMINARY A-22 PRELIMINARY BCND EXIT,TC ;fail, don’t continue. B SAMEROW ;else, go to beginning ;of same row. ** If row done, then check if Array done. * ROW_DONE LACL FL_ADRS ;Check if end of array. SUB BASE_4 ;Subtract end addr. BCND DONE, GT ;If >0 then done. ** Else, go to next row. * LACL FL_ADRS B NEWROW [...]

  • Seite 75

    Assembly Source for Algorithms PRELIMINARY A-23 Assembly Source Listings and Program Examples PRELIMINARY SPLK #04000h,FL_ST ;FL_ST = FLASH1 CTRL REGS FL0 RET ************************************************************* .page ************************************************************* * THIS SECTION PROGRAMS THE VALUE STORED IN FL_DATA INTO * * [...]

  • Seite 76

    Assembly Source for Algorithms PRELIMINARY A-24 PRELIMINARY LACL FL_ST ;ACC => FLASH * SPLK #VER0,SPAD1 ;ACTIVATE VER0 * TBLW SPAD1 ;EXECUTE COMMAND * LAR AR6,#D10 ;SET DELAY * CALL DELAY,*,AR6 ;WAIT * CALL ARRAY ;ACCESS FLASH ARRAY * LACL FL_ADRS ;POINT TO ADRS * TBLR FL_DATA ;GET FLASH WORD 1x read * TBLR FL_DATA ; 2x read * TBLR FL_DATA ; 3x [...]

  • Seite 77

    Assembly Source for Algorithms PRELIMINARY A-25 Assembly Source Listings and Program Examples PRELIMINARY A.1.6 Subroutines Used By All Four Algorithms, SUTILS20.ASM This assembly file includes two subroutines that change the flash module ac- cess mode and one subroutine that performs software delays. More details on the individual functions are gi[...]

  • Seite 78

    Assembly Source for Algorithms PRELIMINARY A-26 PRELIMINARY SPLK #0000h,SPAD2 ***********The next instruction is for F240 only************* .if F24X = 1 ;Assemble for F24X only. OUT SPAD2,F24X_ACCS ;Enable F240 flash reg mode. ;SPAD1 is dummy value. .endif ************************************************************* .if F24X = 0 ;Assemble for F206[...]

  • Seite 79

    C-Callable Interface to Flash Algorithms PRELIMINARY A-27 Assembly Source Listings and Program Examples PRELIMINARY A.2 C-Callable Interface to Flash Algorithms The two functions erase() and program() are intended for in-application pro- gramming of the ’F20x/F24x flash module. These functions were written to be C callable, but they can also be c[...]

  • Seite 80

    C-Callable Interface to Flash Algorithms PRELIMINARY A-28 PRELIMINARY ;**Variables included from flash algorithms. .include ”svar20.h” ;Variable declarations .ref GCLR ;References clear algo. .ref GPGMJ ;References program algo. .ref GERS ;References erase algo. .ref FLWS ;References flash–write algo. ;**Parameters used by flash algorithms. .[...]

  • Seite 81

    C-Callable Interface to Flash Algorithms PRELIMINARY A-29 Assembly Source Listings and Program Examples PRELIMINARY * passes, the flash is ready to be reprogrammed. The * * operations are performed on the segments of the flash * * module described by the parameter list: * * 1)PROTECT–defines which flash segments to protect.* * 2)SEG_ST –start a[...]

  • Seite 82

    C-Callable Interface to Flash Algorithms PRELIMINARY A-30 PRELIMINARY ADD #1 ;Increment fail count. SACL ERS_COUNT ;Save new count. SUB #10 ;CHECK for max of 10. BCND ers_error,GT ;If ers_cout>10 then hard fail. CALL FLWS ;Else, try to recover from depletion. LACL ERROR ;Check for FLASH–WRITE error. BCND ers_error,neq ;If couldn’t recover, t[...]

  • Seite 83

    C-Callable Interface to Flash Algorithms PRELIMINARY A-31 Assembly Source Listings and Program Examples PRELIMINARY ;Begin C Preprocessing POPD *+ ; pop return address, push on s/w stack sar ar0,*+ ; save FP sar ar6,* ; save ar6 sbrk #3 ; Local variables (and parameters) are set up as follows: ; ;get arguments and place them properly – take them [...]

  • Seite 84

    Sample Assembly Code to Erase and Reprogram the TMS320F206 PRELIMINARY A-32 PRELIMINARY A.3 Sample Assembly Code to Erase and Reprogram the TMS320F206 The algorithm files can be used from assembly in a straightforward manner . In general, the algorithms can reside anywhere in program space. However , the algorithms cannot be executed from the flash[...]

  • Seite 85

    Sample Assembly Code to Erase and Reprogram the TMS320F206 PRELIMINARY A-33 Assembly Source Listings and Program Examples PRELIMINARY ;data section used for * ;temporary variables, and * ;for passing parameters * ;to the flash algorithms. * ********************************************************* PROTECT .set PARMS ;Segment enable bits. * ********[...]

  • Seite 86

    Sample Assembly Code to Erase and Reprogram the TMS320F206 PRELIMINARY A-34 PRELIMINARY SUB #10 ;CHECK for max of 10. BCND ers_error,GT ;If ers_cout>10 then hard ;fail. CALL FLWS ;Else, try to recover from ;depletion. LACL ERROR ;Check for FLASH–WRITE error. BCND ers_error,neq ;If couldn’t recover, then ;hard fail. B ers_loop ;Else, try eras[...]

  • Seite 87

    Sample Assembly Code to Erase and Reprogram the TMS320F206 PRELIMINARY A-35 Assembly Source Listings and Program Examples PRELIMINARY prg_error: ******************************************************** ** If here, then an error has occurred during ** ** programming. In an actual application, the system ** ** takes some action to indicate that servi[...]

  • Seite 88

    Sample Assembly Code to Erase and Reprogram the TMS320F206 PRELIMINARY A-36 PRELIMINARY PAGE 1: /* DM – Data memory */ BLK_B2: origin = 0x60,length = 0x20 /*BLOCK B2 */ DSARAM: origin = 0xc00, length = 0xC00 /*Use 3K of SARAM for data DON=1 */ EX1_DM: origin = 0x4000, length = 0x4000 /*External data RAM */ B1: origin = 0x300, length = 0x1ff /*B1 [...]

  • Seite 89

    Sample C Code to Erase and Reprogram the TMS320F206 PRELIMINARY A-37 Assembly Source Listings and Program Examples PRELIMINARY A.4 Sample C Code to Erase and Reprogram the TMS320F206 Because the algorithm implementations do not follow the C-calling convention of the ’C2000 C environment, they cannot be used directly from C. The assem- bly code of[...]

  • Seite 90

    Sample C Code to Erase and Reprogram the TMS320F206 PRELIMINARY A-38 PRELIMINARY { /*Flash fails programming, EXIT*/ while(1){} /*Spin here forever*/ } } else { /*Flash fails erase, EXIT*/ while(1){} /*Spin here forever*/ } } A.4.2 Linker Command File for TMS320F206 Sample C Code /********************************************************************[...]

  • Seite 91

    Sample C Code to Erase and Reprogram the TMS320F206 PRELIMINARY A-39 Assembly Source Listings and Program Examples PRELIMINARY FLASH0: origin = 0x0000, length = 0x3fff FLASH1: origin = 0x4000, length = 0x3fff PSARAM: origin = 0x8000, length = 0x400 /*Use 1K of SARAM for PROGRAM*/ B0: origin = 0xff00, length = 0x1ff PAGE 1: /* DM – Data memory */ [...]

  • Seite 92

    Sample Assembly Code to Erase and Reprogram the TMS320F240 PRELIMINARY A-40 PRELIMINARY A.5 Sample Assembly Code to Erase and Reprogram the TMS320F240 The algorithm files can be used from assembly in a straightforward manner . In general, the algorithms can reside anywhere in program space. However , the algorithms cannot be executed from the flash[...]

  • Seite 93

    Sample Assembly Code to Erase and Reprogram the TMS320F240 PRELIMINARY A-41 Assembly Source Listings and Program Examples PRELIMINARY ;**Variables included from flash algorithms. .include ”svar20.h” ;Variable declarations .ref GCLR ;References clear algo. .ref GPGMJ ;References program algo. .ref GERS ;References erase algo. .ref FLWS ;Referenc[...]

  • Seite 94

    Sample Assembly Code to Erase and Reprogram the TMS320F240 PRELIMINARY A-42 PRELIMINARY F240INIT: ;Set Data Page pointer to page 1 of the ;peripheral frame LDP #DP_PF1 ;Page DP_PF1 includes WET through * ;EINT frames ;initialize WDT registers SPLK #06Fh, WDCR ;clear WDFLAG, Disable WDT ;(if Vpp=5V), set WDT ;for 1 second overflow (max) SPLK #07h, R[...]

  • Seite 95

    Sample Assembly Code to Erase and Reprogram the TMS320F240 PRELIMINARY A-43 Assembly Source Listings and Program Examples PRELIMINARY depletion: LACL ERS_COUNT ;Get erase fail count. ADD #1 ;Increment fail count. SACL ERS_COUNT ;Save new count. SUB #10 ;CHECK for max of 10. BCND ers_error,GT ;If ers_cout>10 then hard fail. CALL FLWS ;Else, try t[...]

  • Seite 96

    Sample Assembly Code to Erase and Reprogram the TMS320F240 PRELIMINARY A-44 PRELIMINARY ************************************************************** ** Now that the data to be programmed is ready, the ** ** programming algorithm is invoked. Note: Four parameters ** ** must be initialized before calling the algorithm. ** **************************[...]

  • Seite 97

    Sample Assembly Code to Erase and Reprogram the TMS320F240 PRELIMINARY A-45 Assembly Source Listings and Program Examples PRELIMINARY A.5.2 Linker Command File for TMS320F240 Sample Assembly Code /************************************************************/ /* Filename: ASMEXA24.CMD */ /* Description: Linker command file for ’F240 example of */ [...]

  • Seite 98

    Sample Assembly Code to Erase and Reprogram the TMS320F240 PRELIMINARY A-46 PRELIMINARY /*All these sections are for flash programming.*/ fl_prg : {} > EXTRAM PAGE 0 /**Programming Algorithm*****/ fl_clr : {} > EXTRAM PAGE 0 /******Clear Algorithm*******/ fl_ers : {} > EXTRAM PAGE 0 /******Erase Algorithm*******/ fl_wrt : {} > EXTRAM PA[...]

  • Seite 99

    Using the Algorithms With C Code to Erase and Reprogram the ’F240 PRELIMINARY A-47 Assembly Source Listings and Program Examples PRELIMINARY A.6 Using the Algorithms With C Code to Erase and Reprogram the ’F240 Because the algorithm implementations do not follow the C-calling convention of the ’C2000 C environment, they cannot be used directl[...]

  • Seite 100

    Using the Algorithms With C Code to Erase and Reprogram the ’F240 PRELIMINARY A-48 PRELIMINARY extern int erase(); /* Declare external func for flash erase. */ extern int program(); /* Declare external func for flash programming */ extern c240init(); /* Declare external func for C240 register init’l’n */ extern wdtoff(); /* Declare external f[...]

  • Seite 101

    Using the Algorithms With C Code to Erase and Reprogram the ’F240 PRELIMINARY A-49 Assembly Source Listings and Program Examples PRELIMINARY /************************Command Line Options**************************/ –cr /*Use Ram init model. */ –heap 0x0 /*No heap needed for this example. */ –stack 0x96 /*150 word stack is enough for this exa[...]

  • Seite 102

    Using the Algorithms With C Code to Erase and Reprogram the ’F240 PRELIMINARY A-50 PRELIMINARY .bss :{} > B1 PAGE 1 .cinit :{} > B1 PAGE 1 .const : load = EXTRAM PAGE 0, run = DSRAM PAGE 1 { /* GET RUN ADDRESS */ __const_run = .; /* MARK LOAD ADDRESS */ *(.c_mark) /* ALLOCATE .const */ *(.const) /* COMPUTE LENGTH */ __const_length = .– __[...]

  • Seite 103

    Using the Algorithms With C Code to Erase and Reprogram the ’F240 PRELIMINARY A-51 Assembly Source Listings and Program Examples PRELIMINARY OR #06fh ; set WDDIS bit and WDCHK2:0 bits, WDCLK to max. SACL WDCR ; write ACC out to WDTCR ***************************************************************************** * Step 9. Deallocate the local frame[...]

  • Seite 104

    Using the Algorithms With C Code to Erase and Reprogram the ’F240 PRELIMINARY A-52 PRELIMINARY * Step 5. begin code that will initialize the ’240 registers * ***************************************************************************** CLRC SXM ; Clear Sign Extension Mode CLRC OVM ; Reset Overflow Mode * Set Data Page pointer to page 1 of the p[...]

  • Seite 105

    Index PRELIMINARY Index-1 PRELIMINARY Index A access modes code for changing A-25 array access 2-5, 2-10, 2-1 1, 2-16, 3-8 register access 2-5, 2-10, 2-1 1, 3-1 1 access–control register 2-5 to 2-7 modifying in TMS320F206 2-6 modifying in TMS320F24x 2-7 reading in TMS320F206 2-6 accessing the flash module 2-5 address complementing 3-1 1 algorithm[...]

  • Seite 106

    Index PRELIMINARY Index-2 PRELIMINARY erase algorithm assembly code (SERA2x.ASM) A-10 described 3-10 to 3-13 flow diagram 3-13 in overall flow 3-10 erase() function (C code listing) A-27 erase operation described 2-14 following flash–write operation 2-15 frequency range 3-12 logic levels 2-4 role of WDA T A 2-1 1 VER1 read mode 2-12 verification [...]

  • Seite 107

    Index PRELIMINARY Index-3 PRELIMINARY M margin determining 3-5, 3-1 1 ensuring data retention 1-2 improving 3-12 in programming 2-13 restoring after flash–write operation 2-15 special read modes for ensuring 2-12 masking data in program operation 3-8 memory maps 1-4 MODE bit 2-6 See also flash access–control register mode selection for access 2[...]

  • Seite 108

    Index PRELIMINARY Index-4 PRELIMINARY subroutines used by all algorithms (SU- TILS2x.ASM) A-25 SUTILS2x.ASM file (code for subroutines) A-25 SV AR2x.H file (header file for constants and vari- ables) A-2 T test register (TST) 2-6, 2-8, 2-10 U uniformity of charge 3-5, 3-9 unintentional erasure, protection 2-16 using the algorithms with assembly cod[...]