Texas Instruments TMS320F20x/F24x DSP manual

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

Ir para a página of

Bom manual de uso

As regras impõem ao revendedor a obrigação de fornecer ao comprador o manual com o produto Texas Instruments TMS320F20x/F24x DSP. A falta de manual ou informações incorretas fornecidas ao consumidor são a base de uma queixa por não conformidade do produto com o contrato. De acordo com a lei, pode anexar o manual em uma outra forma de que em papel, o que é frequentemente utilizado, anexando uma forma gráfica ou manual electrónicoTexas Instruments TMS320F20x/F24x DSP vídeos instrutivos para os usuários. A condição é uma forma legível e compreensível.

O que é a instrução?

A palavra vem do latim "Instructio" ou instruir. Portanto, no manual Texas Instruments TMS320F20x/F24x DSP você pode encontrar uma descrição das fases do processo. O objetivo do manual é instruir, facilitar o arranque, a utilização do equipamento ou a execução de determinadas tarefas. O manual é uma coleção de informações sobre o objeto / serviço, um guia.

Infelizmente, pequenos usuários tomam o tempo para ler o manual Texas Instruments TMS320F20x/F24x DSP, e um bom manual não só permite conhecer uma série de funcionalidades adicionais do dispositivo, mas evita a formação da maioria das falhas.

Então, o que deve conter o manual perfeito?

Primeiro, o manual Texas Instruments TMS320F20x/F24x DSP deve conte:
- dados técnicos do dispositivo Texas Instruments TMS320F20x/F24x DSP
- nome do fabricante e ano de fabricação do dispositivo Texas Instruments TMS320F20x/F24x DSP
- instruções de utilização, regulação e manutenção do dispositivo Texas Instruments TMS320F20x/F24x DSP
- sinais de segurança e certificados que comprovam a conformidade com as normas pertinentes

Por que você não ler manuais?

Normalmente, isso é devido à falta de tempo e à certeza quanto à funcionalidade específica do dispositivo adquirido. Infelizmente, a mesma ligação e o arranque Texas Instruments TMS320F20x/F24x DSP não são suficientes. O manual contém uma série de orientações sobre funcionalidades específicas, a segurança, os métodos de manutenção (mesmo sobre produtos que devem ser usados), possíveis defeitos Texas Instruments TMS320F20x/F24x DSP e formas de resolver problemas comuns durante o uso. No final, no manual podemos encontrar as coordenadas do serviço Texas Instruments na ausência da eficácia das soluções propostas. Atualmente, muito apreciados são manuais na forma de animações interessantes e vídeos de instrução que de uma forma melhor do que o o folheto falam ao usuário. Este tipo de manual é a chance que o usuário percorrer todo o vídeo instrutivo, sem ignorar especificações e descrições técnicas complicadas Texas Instruments TMS320F20x/F24x DSP, como para a versão papel.

Por que ler manuais?

Primeiro de tudo, contem a resposta sobre a construção, as possibilidades do dispositivo Texas Instruments TMS320F20x/F24x DSP, uso dos acessórios individuais e uma gama de informações para desfrutar plenamente todos os recursos e facilidades.

Após a compra bem sucedida de um equipamento / dispositivo, é bom ter um momento para se familiarizar com cada parte do manual Texas Instruments TMS320F20x/F24x DSP. Atualmente, são cuidadosamente preparados e traduzidos para sejam não só compreensíveis para os usuários, mas para cumprir a sua função básica de informação

Índice do manual

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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 - [...]

  • Página 8

    PRELIMINARY viii PRELIMINARY[...]

  • Página 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 .[...]

  • Página 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .[...]

  • Página 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 . . . . . . . . . . . . . . .[...]

  • Página 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 . . . . . . . . . . . . . . . . . . . . [...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 18

    PRELIMINARY 1-6 PRELIMINARY[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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 [...]

  • Página 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 [...]

  • Página 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 ..[...]

  • Página 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[...]

  • Página 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 [...]

  • Página 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[...]

  • Página 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?[...]

  • Página 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[...]

  • Página 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 [...]

  • Página 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 [...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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 [...]

  • Página 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 [...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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 [...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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 [...]

  • Página 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 [...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 52

    PRELIMINARY 3-18 PRELIMINARY[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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 [...]

  • Página 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 .[...]

  • Página 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[...]

  • Página 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 [...]

  • Página 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[...]

  • Página 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[...]

  • Página 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* ************************************************************* ************************************[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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 *[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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 * * [...]

  • Página 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: ?[...]

  • Página 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. [...]

  • Página 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[...]

  • Página 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 [...]

  • Página 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 * * [...]

  • Página 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 [...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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. .[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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 [...]

  • Página 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[...]

  • Página 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. * ********[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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 [...]

  • Página 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[...]

  • Página 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 /********************************************************************[...]

  • Página 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 */ [...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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. ** **************************[...]

  • Página 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 */ [...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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 = .– __[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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[...]

  • Página 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 [...]

  • Página 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[...]

  • Página 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[...]