TMS470 Family – F05 Flash Module
Software Peripheral Driver User’s
Specification
User's Guide
December 2005 TMS470 Catalog
SPNU257
IMPORTANT NOTICE
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications,
enhancements, improvements, and other changes to its products and services at any time and to discontinue
any product or service without notice. Customers should obtain the latest relevant information before placing
orders and should verify that such information is current and complete. All products are sold subject to TI’s terms
and conditions of sale supplied at the time of order acknowledgment.
TI warrants performance of its hardware products to the specifications applicable at the time of sale in
accordance with TI’s standard warranty. Testing and other quality control techniques are used to the extent TI
deems necessary to support this warranty. Except where mandated by government requirements, testing of all
parameters of each product is not necessarily performed.
TI assumes no liability for applications assistance or customer product design. Customers are responsible for
their products and applications using TI components. To minimize the risks associated with customer products
and applications, customers should provide adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right,
copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process
in which TI products or services are used. Information published by TI regarding third-party products or services
does not constitute a license from TI to use such products or services or a warranty or endorsement thereof.
Use of such information may require a license from a third party under the patents or other intellectual property
of the third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of information in TI data books or data sheets is permissible only if reproduction is without
alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction
of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for
such altered documentation.
Resale of TI products or services with statements different from or beyond the parameters stated by TI for that
product or service voids all express and any implied warranties for the associated TI product or service and
is an unfair and deceptive business practice. TI is not responsible or liable for any such statements.
Following are URLs where you can obtain information on other Texas Instruments products and application
solutions:
Products Applications
Amplifiers amplifier.ti.com Audio www.ti.com/audio
Data Converters dataconverter.ti.com Automotive www.ti.com/automotive
DSP dsp.ti.com Broadband www.ti.com/broadband
Interface interface.ti.com Digital Control www.ti.com/digitalcontrol
Logic logic.ti.com Military www.ti.com/military
Power Mgmt power.ti.com Optical Networking www.ti.com/opticalnetwork
Microcontrollers microcontroller.ti.com Security www.ti.com/security
Telephony www.ti.com/telephony
Video & Imaging www.ti.com/video
Wireless www.ti.com/wireless
Mailing Address: Texas Instruments
Post Office Box 655303 Dallas, Texas 75265
Copyright 2005, Texas Instruments Incorporated
Contents
1 Objectives .................................................................................................................. 4
2 Predefined User Types and Names................................................................................ 4
2.1 UINT32, UINT16, UBYTE, and BOOL ........................................................................... 4
2.2 FLASH_ARRAY_ST ................................................................................................ 4
2.3 FLASH_STATUS_ST .............................................................................................. 4
2.4 FLASH_CORE ...................................................................................................... 5
2.5 FLASH_SECT ....................................................................................................... 5
3 API Description ........................................................................................................... 5
3.1 Pulse Size and Limits .............................................................................................. 5
3.2 Build Environment .................................................................................................. 5
3.3 Interrupts ............................................................................................................. 6
3.4 Function Size ........................................................................................................ 6
4 API Functions ............................................................................................................. 7
4.1 Feed_Watchdog_V ................................................................................................. 7
4.2 Flash_API_Version_U16 ........................................................................................... 8
4.3 Flash_Blank_B ...................................................................................................... 9
4.4 Flash_Compact_B ................................................................................................. 11
4.5 Flash_Erase_B .................................................................................................... 13
4.6 Flash_Erase_Sector_B ........................................................................................... 15
4.7 Flash_Match_Key_B .............................................................................................. 17
4.8 Flash_Prog_B ...................................................................................................... 18
4.9 Flash_PSA_Calc_U32 ............................................................................................ 20
4.10 Flash_PSA_Verify_B .............................................................................................. 22
4.11 Flash_Sector_Select_V ........................................................................................... 24
4.12 Flash_Track_Pulses_V ........................................................................................... 25
4.13 Flash_Verify_B .................................................................................................... 27
4.14 init_state_machine ................................................................................................ 29
4.15 PSA_U32 ........................................................................................................... 30
5 Flash Delay Parameter Values ..................................................................................... 31
6 Recommended Flow Guidelines .................................................................................. 31
6.1 6.1. Reasoning Behind Fow Guidelines ........................................................................ 31
6.2 Recommended Erase Flows ..................................................................................... 32
6.3 Recommended Programming Fow .............................................................................. 35
7 Related Documentation .............................................................................................. 36
7.1 Hardware Module Reference .................................................................................... 36
7.2 Software Module Reference ..................................................................................... 36
Appendix A Header Files ................................................................................................... 37
A.0.3 fapiver.h ............................................................................................................ 37
A.0.4 Flash470.h ......................................................................................................... 37
A.0.5 F05.h................................................................................................................ 42
SPNU257 – December 2005 Table of Contents 3
1 Objectives
2 Predefined User Types and Names
2.1 UINT32, UINT16, UBYTE, and BOOL
2.2 FLASH_ARRAY_ST
2.3 FLASH_STATUS_ST
User's Guide
SPNU257 – December 2005
TMS470 Family – F05 Flash Module Software Peripheral
Driver User’s Specification
The objective of this document is to define a set of software peripheral functions intended to
program/erase a TMS470R1x Flash module.
This document is the specification of the User interface.
The above types are defined in the Flash470.h header file as follows :
typedef int BOOL;
typedef unsigned char UBYTE;
typedef unsigned short int UINT16;
typedef unsigned long int UINT32;
The purpose of each type is as follows:
BOOL Boolean variable (i.e. 1=TRUE, 0=FALSE)
UBYTE Unsigned byte (8 bits wide)
UINT16 Unsigned 16 bit integer
UINT32 Unsigned 32 bit integer
This chapter summarizes the list of parameter types and names, i.e. enumerations used to define function
parameters and their elements.
The above type is defined as follows in flash470.h:
typedef volatile UINT32 * FLASH_ARRAY_ST;
Thus a FLASH_ARRAY_ST is a volatile unsigned 32 bit integer array pointer. The control base address of
the Flash module is declared as a FLASH_ARRAY_ST so that writing to and reading from registers is
done in a volatile manner and all Flash control register offsets are defined as 32 bit offsets from this base
address in the f05.h header file.
The FLASH_STATUS_ST is used as a repository of information (pulse counts, PSA values, failing
addresses and data, etc.) generated by a function in addition to the return value. A pointer to this type of
structure is passed to most functions, and the contents of each element of the structure are dependent on
the purpose of the function.
The FLASH_STATUS_ST structure is declared as follows in the flash470.h
typedef struct {
UINT32 stat1;
UINT32 stat2;
UINT32 stat3;
UINT32 stat4;
TMS470 Family – F05 Flash Module Software Peripheral Driver User’s Specification4 SPNU257 – December 2005
www.ti.com
2.4 FLASH_CORE
2.5 FLASH_SECT
3 API Description
3.1 Pulse Size and Limits
3.2 Build Environment
API Description
} FLASH_STATUS_ST;
The purpose of each element is as follows:
stat1 Statistic 1: Meaning depends upon function.
stat2 Statistic 2: Collects statistics on flash
stat3 Statistic 3: operations such as the number of
stat4 Statistic 4: pulses applied, the worst case
number of pulses, address, etc.
This type is an enumeration of the banks that can be use in the Flash module. Up to eight banks are
supported.
FLASH_CORE0 Bank 0 selected
FLASH_CORE1 Bank 1 selected
FLASH_CORE2 Bank 2 selected
FLASH_CORE3 Bank 3 selected
FLASH_CORE4 Bank 4 selected
FLASH_CORE5 Bank 5 selected
FLASH_CORE6 Bank 6 selected
FLASH_CORE7 Bank 7 selected
This type is an enumeration of the sector that can be chosen in a specified bank of the Flash module. In
R1x F05, thirty-two sectors are supported
FLASH_SECT0 Sector 0 selected
FLASH_SECT1 Sector 1 selected
.
.
.
FLASH_SECT31 Sector 31 selected
The Flash API is a library of routines which when called with the proper parameters in the proper
sequence will erase, program or verify flash memory on the TMS470 family of Texas Instruments
microcontrollers. These routines must be run in a privileged mode (mode other than user) to allow access
to the flash control registers and to the interrupt disable bits. Most of the routines enter Flash
Configuration Mode and therefore the system clock should not exceed 24MHz.
Pulse Length Maximum Number of Pulses
Program 4 µ S 50
Erase 2700 µ S 4095
Compact 500 µ s 2000
The current version of the Flash API library was built with version 4.30 of the IAR Workbench C compiler.
Most of the functions are written in C with some critical functions coded in assembly language. Most of the
code is in 32-bit instruction mode. The following compiler options were used to create the Flash API
library:
Generate Interwork Code, Optimize for size (Maximum Optimization)
SPNU257 – December 2005 TMS470 Family – F05 Flash Module Software Peripheral Driver User’s Specification 5