The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers.    


Datasheet Search Engine   
 
Part # or Description: • 5V RS232 Driver • 2SC5066* • "Real Time Clock" • "USB connector" • "blue led" 5mm • 10 watt zener diode • 2N3055* motorola
 
Search Tip: Try entering the part number only. Include a wildcard (eg. lm317* or 1n4148*)

 

 

AN97019 Using Flash memory with Application Note AN97019


Datasheet Thumbnail

  

Download PDF



Top Searches for this datasheet



Using Flash memory with
AN97019
Using Flash memory with
Application Note AN97019
Abstract This note examines various options involved connecting Flash memories Special attention payed possibility dynamic software updating (re-loading Flash).
Philips Electronics N.V. 1997 rights reserved. Reproduction whole part prohibited without prior written consent copyright owner. information presented this document does form part quotation contract, believed accurate reliable changed without notice. liability will accepted publisher consequence use. Publication thereof does convey imply license under patent- other industrial intellectual property rights.
Using Flash memory with
Application Note AN97019
Using Flash memory with
AN97019
Author: Paul Seerden Systems Laboratory Eindhoven, Netherlands
Keywords Microcontrollers bit, Flash Memory
Number pages:
Date: 97-03-14
Using Flash memory with
Application Note AN97019
Summary
This report guide designers consider design with external Flash memory. Most problems aspects that they meet brought light. Pro's cont's different design choises dealt with. Hardware interface examples well software routines illustrated. focus applications with possibility dynamicly updating software (re-loading flash).
Using Flash memory with
Application Note AN97019
CONTENTS
INTRODUCTION
What Flash memory again take into consideration
SYSTEM WITHOUT XRAM.9
Boot from on-chip Boot from external Flash. Boot from external
SYSTEM WITH XRAM FLASH LOADER SOFTWARE.16 REFERENCES TOOLS.17 APPENDIX BOOT.C.18 APPENDIX LOADER.C.19 APPENDIX FLASH.C.21 APPENDIX SERIAL.C.23 APPENDIX FLASH.H.24
Using Flash memory with
Application Note AN97019
Using Flash memory with
Application Note AN97019
INTRODUCTION
Philips Semiconductors "P51XA" (Extended Architecture) 16-bit microcontroller family designed applications needing high performance high integration. typical system built using external Flash memory program storage. Using Flash memory provides advantage over traditional non-volatile memories. Unlike EPROMs, Flash devices programmed in-system However, connection Flash device microcontroller like straightforward. This application note will discuss achieve efficient Flash memory interface. Chapter describes hardware interfacing examples systems without external data memory (so, they only internal on-chip data memory). Chapter describes application example system with additional external data memory. Chapter describes software driver (re)load Flash memory contents. driver written loading Flash memory Intel-hex file format used. Serial downloading file done using UART0 XA-G3.
What Flash memory again
write-enable input Flash parts left consideration, then this type memory fact same normal EPROM. real difference simplicity data storage erasure memory. Unlike EPROM's Flash parts erased programmed in-system. Flash devices able receive commands, like chip erase program, exact defined sequence instructions. That makes accidentally erasing Flash almost impossible. different instruction command codes shown below table
TABLE Flash instructions (AMD 29F010)
Command Read Reset Autoselect Byte Program Chip Erase Sector Erase
Notes: Addressbits A15.A18 don't care address commands except Program Address (PA) Sector Address (SA) Address memory location read Address memory location program falling edge input) Address sector erase Contents memory location Contents memory location falling edge input)
First Cycle
Addr Data
Second cycle
Addr Data
Third cycle
Addr Data
Fourth cycle
Addr Data
Fifth cycle
Addr Data
Sixth cycle
Addr Data
5555 5555 5555 5555 5555
2AAA 2AAA 2AAA 2AAA 2AAA
5555 5555 5555 5555 5555
5555 5555
2AAA 2AAA
5555
Read Reset Autoselect Byte Program Chip Erase Sector Erase
This command puts Flash read/reset state, enables Flash data reads. Used device type manufacturer code. Used write bytes flash. Will program verify entire memory zero pattern. Flash memory divided into sectors. This command erases multiple sectors concurrently.
Using Flash memory with
Application Note AN97019
take into consideration
Please realize that impossible execute code from normal Flash memory part while programming program code that reloads Flash needs located separate memory area/component. Flash interface timing versus frequency. design examples chapters possible need wait states taken into account. software example tested 20Mhz XA-G3 system (slowest cycle 100ns) with 90ns Flash parts. software (chapter serially download (UART0 used) Intel-hex file does flowcontrol (like RTS/CTS xon/xoff). host (sending Intel-hex file) needs send data rate software handle. given design examples this report with XA-G3 8-bit wide databus mode. Please realize that 16-bit systems line becomes signal. This means that addresses, used driver software, which commands written must changed (see chapter Also, this case, words stead bytes must written both all) Flash parts. Flash memory mapped address data memory space enable writing realize that instruction MOVX needed write (and read) lower bytes flash. MOVX used internal addressed. examples kBytes Flash parts (29F010), only address lines connected. system needs prepared larger flash memory parts then address lines connected 29F010 part.
This application note (with source files) available downloading from Philips Bulletin Board Systems from world wide web. packed self extracting file: XAFLASH.EXE.
North American Bulletin Board, telephone number: (800) 6644 (408) 2406 European Bulletin Board, telephone number: 1102 Philips Semiconductors WWW:
Using Flash memory with
Application Note AN97019
SYSTEM WITHOUT XRAM
Applications requiring additional external data memory (only internal on-chip RAM) have three options locating Flash loader software part. These three options explained detail next paragraphs. Loader on-chip (EPROM boot from on-chip Loader on-chip (EPROM XA), boot from external Flash memory Romless loader separate external
Boot from on-chip
Figure Boot from on-chip
system shown figure always boots from internal high). internal contains start-up code, vector table Flash loader program. After start-up initialization application program inside external Flash memory called. However, before executes external cycle WAITDisable register must set. This causes ignore status WAIT input allows tying WAIT input high applications that internal code need WAIT function.
Using Flash memory with
Application Note AN97019
Besides start-up initialization code internal also contains Flash (re)loader program. After receiving request reload Flash (for example UART) application calls loader software inside internal (see chapter After updating Flash memory contents `new' application program called software reset generated). interrupt vectors located fixed addresses from address 120h thus also part onchip ROM. Interrupt vectors pointers interrupt routines. These routines part application program located inside Flash memory. Therefore, vectors should some re-directed fixed address pointers inside Flash memory, interrupt routines must fixed addresses. Advantages: Simple cheap design extra external hardware needed) Start-up with empty Flash easy test. This convenient production diagnostic purposes.
Disadvantages: flexible (fixed addresses routines vectors pointers) Start-address application must fixed Price against Romless Need kind `secondary vector table' with fixed addresses When mapped address first Kbyte Flash memory useless, because overlap with on-chip easy software emulation, because located address
Boot from external Flash
external Flash memory system shown figure contains start-up code, vector table application program. on-chip contains Flash reloader software. intention system boot power-up always from code inside external Flash memory. This means that needs `low' during power-up, when sampled take care this output flip-flop `reset' state resistor capacitor). However, Flash reloader software inside on-chip ROM. Flash reload requested re-start, from internal high), needed. achieve this, external data memory write cycle flip-flop address $80000) with (databus line high performed. After that, system re-started using external reset circuit (MAX311). internal on-chip code running Flash memory re-loaded. Again, running internally (EA/WAIT high), before external cycle performed WAITDisable must register (see previous paragraph). address ($80000) used flip-flop must outside Flash memory range, because otherwise write operation into Flash executed. generate external system reset written port P3.3 (manual reset input MAX811).
Using Flash memory with
Application Note AN97019
Figure with on-chip code, always boot from external flash
After updating Flash contents again system needs re-started, from newly loaded code external Flash memory. This means that `zero' needs written flip-flop low), then again external system `reset' must performed (write P3.3). external reset circuitry used because doesn't (re)sample BUSW pins after internal reset (software RESET instruction watchdog). port P3.3 other) problem, could consider connect line manual reset (MR) input MAX811. that case, generate hardware reset, external data memory read needs performed. Advantages: Flexible design Interrupt vector table inside Flash Easy emulation code, because Flash mapped address Linking loading address
Disadvantages: Extra glue logic needed (reset circuitry, flip-flop) Price against Romless Extra measures take first time power-up with empty flash (force high
Using Flash memory with
Application Note AN97019
Boot from external
system figure shows Romless system with external Flash memory, containing application program, address separate Flash loader PROM mapped above Flash memory space ($20000). power-up after reset system boots application from Flash memory low). request reload Flash received (for example UART) application `jumps' reload routine (see chapter external PROM. After reloading Flash software reset must generated restart application. example figure Kbyte PROM selected. This because chip size price reasons. course also possible `normal' EPROM type 27C. When more Flash memory needed, both chip enable inputs Flash PROM connected address line instead A17. Writing into Flash address first bytes (1Kbyte XA-S3) only possible using MOVX instruction.
Figure Romless external Flash
Using Flash memory with
Application Note AN97019
Advantages: Flexible design Interrupt vector table inside Flash Easy emulation code Linking loading address ROMless external PROM cheaper than on-chip ROM/OTP
Disadvantages: Extra external (E)PROM needed More space needed Extra measures take first time power-up with empty flash (force boot from PROM)
Using Flash memory with
Application Note AN97019
SYSTEM WITH XRAM
Figure Romless external SRAM Flash
system shown figure Kbytes necessary more) external data memory available. this case OTP/Eprom superfluous, therefore ROMless selected. power-up system always boots from code inside external Flash memory low). Flash device also contains reloader software. SRAM device mapped both data program memory space address $20000. Flash reload requested re-loader software part copied from flash into static then executed. After updating Flash contents system needs re-boot, from re-loaded code external Flash. This simply done executing RESET instruction. larger amount Flash memory needed, both chip enable inputs Flash SRAM connected address line instead (SRAM space moved $80000).
Using Flash memory with
Application Note AN97019
Writing into Flash address first bytes (1Kbyte XA-S3) only possible when using MOVX instruction. Advantages: Simple design Interrupt vector table inside Flash Easy emulation code Linking loading address Lower cost (Romless SRAM device needed)
Disadvantages: mapped usable system stack space (extra external SRAM) Extra measures take first time power-up with empty flash (insert programmed Flash
Using Flash memory with
Application Note AN97019
FLASH LOADER SOFTWARE
This chapter describes tested driver software 8-bit XA-G3 system with external 29F010 (128 Kbytes) Flash part, without external data memory (SRAM). driver software provides source code necessary erase re-program 29F010 Flash part. code (contents) Flash memory re-loading obtained from Intel-hex file that serially downloaded using UART0. example application base address Flash memory mapped $40000h data memory space. change this adjust include file flash.h recompile modules. compiler used: compiler V1.1 from TASKING. Overview modules: BOOT.C Contains main routine called after power-up initialization. First flash memory erased. Next, Intel-hex file uploaded flash re-programmed. And, finally RESET instruction executed re-boot system. Handles reading Intel-hex file. Checksum each record checked needed error message generated. Data bytes passed embedded program function write into flash device. Contains 29F010 Flash embedded program chip-erase functions: EmbeddedProgram() Performs actual byte program Flash device. After variable setup, unlock sequences sent, with final unlock cycle being byte program appropriate address. ChipErase() Performs chip erase Flash device, clearing data returning locations value hexadecimal. Protected sectors checked. return status flagged successful chip erase). SERIAL.C FLASH.H Handles serial communication part using UART0. Contains hardware initialization, send byte, receive byte send ASCII string routines. Include file that contains local definitions Flash driver software package.
LOADER.C
FLASH.C
Note systems using 16-bit databus width module flash.c needs adjusted. addresses used unlock sequences need incremented This because 16-bit system address line used signal connected Flash device.
Using Flash memory with
Application Note AN97019
REFERENCES TOOLS
Used references development tools:
Flash development Flash memory products 1994/1995 data book MAXIM Integrated products data book HI-Tech compiler (version 7.60) Tasking compiler (version 1.1) XTEND board (rev. Philips 16-bit 80C51XA data handbook IC25
http://www.amd.com http://www.amd.com http://www.maxim.com http://www.htsoft.com http://www.tasking.com XTEND-G3 9397 00733
Using Flash memory with
Application Note AN97019
APPENDIX
BOOT.C
Name module BOOT.C Creation date 1997-04-21 Program language Name P.H. Seerden Copyright 1997 Philips Semiconductors B.V. History: 97-04-21 P.H. Seerden Initial version #include "flash.h"
void main(void) ua_init();
initialise UART0 console-in/console-out
PrintString("\n\n\n29F010 Flash loader Program V1.0\n\n" "Step Erase Flash memory\n" "Step Upload Intel-hex file\n" "Step Execute software RESET\n\n" "Hit continue !!"); ci(); wait character
PrintString("\nErasing chip ."); (ChipErase()) PrintString("\nChip erase error !!\n"); else PrintString("\nSuccessfully erased 29F010 !\n"); PrintString("\n downloading *\n"); switch (Download()) case PrintString("\nready ok\n"); case PrintString("\nChecksum Error\n"); case PrintString("\nBad record type\n"); case PrintString("\nFlash program Error\n"); default: PrintString("\nUnknown Error\n"); #pragma RESET #pragma endasm
break; break; break; break; break;
execute software reset instruction
Using Flash memory with
Application Note AN97019
APPENDIX
LOADER.C
Name module LOADER.C Creation date 1997-04-21 Program language Name P.H. Seerden Description Handles downloading Intel Hex-32 files. Copyright 1997 Philips Semiconductors B.V. #include "flash.h" _rom char ascii[] "0123456789ABCDEF"; static BYTE checkSum; Load2Hex() purpose: This routine reads bytes returns their binary byte value. read bytes routine ci() (console called. static BYTE Load2Hex(void) BYTE t,i,s; ci(); t++) (ascii[t] break; ci(); s++) (ascii[s] break; (t<<4) checkSum checkSum return Load4Hex() purpose: This routine reads four bytes returns their binary word value. static WORD Load4Hex(void) WORD Load2Hex(); return (t<<8) Load2Hex(); first byte high byte merge read byte from UART convert byte binary nibble
read second byte convert binary high nibble
merge high nibble update checksum this record
Using Flash memory with
Application Note AN97019
Download() purpose: Download Intel-hex file. EmbeddedProgram() write bytes flash. BYTE Download(void) BYTE length; LONG addr,segm,address; segm while while (ci() ':') checkSum length Load2Hex(); addr Load4Hex(); start downloading Intel file wait (start record)
read record length read address read record type read data record read record fetch last checksum checksum error download read esar record
switch (Load2Hex()) case address base segm addr; break; case Load2Hex(); (checkSum return return case segm Load4Hex(); segm segm<<4; length break; case break; case segm Load4Hex(); segm segm<<16; length break; default: return while (length return address length Load2Hex(); (checkSum return
read start address read elar record
record type read data bytes byte program error
fetch checksum checksum error
Using Flash memory with
Application Note AN97019
APPENDIX
FLASH.C
Name module FLASH.C Creation date 1997-04-21 Program language Name P.H. Seerden Copyright 1997 Philips Semiconductors B.V. Description: Source code programming 29F010 Flash components. #include "flash.h"
EmbeddedProgram() purpose: Performs Embedded Programming algorithm. device 29F010, checked protected sectors. polling address setup, address started, 4-cycle unlock sequence initiated device polled using poll programming. parameters: LONG address address program BYTE byte program return value: successful unsuccessful BYTE EmbeddedProgram(LONG address, BYTE val) _far BYTE BYTE (_far BYTE *)(base 0x5555); 0xAA; (_far BYTE *)(base 0x2AAA); 0x55; (_far BYTE *)(base 0x5555); 0xA0; (_far BYTE *)address; val; (;;) ((val 0x80) 0x80)) return first cycle second cycle third cycle output byte device
read data true data Embedded program
Using Flash memory with
Application Note AN97019
0x20) *(_far BYTE *)address; both changed 0x80) (val 0x80)) return device passed DATA POLL else return true, while DQ5=1
ChipErase() purpose: Performs Embedded Erase algorithm. device 29F010 device, checked protected sectors. 6-cycle unlock sequence initiated, device polled using poll. return value: successful unsuccessful BYTE ChipErase(void) _far BYTE *address; BYTE temp; address (_far BYTE *)(base 0x5555); *address 0xAA; address (_far BYTE *)(base 0x2AAA); *address 0x55; address (_far BYTE *)(base 0x5555); *address 0x80; address (_far BYTE *)(base 0x5555); *address 0xAA; address (_far BYTE *)(base 0x2AAA); *address 0x55; address (_far BYTE *)(base 0x5555); *address 0x10; (;;) temp *address; (temp 0x80) return (temp 0x20) temp *address; (temp 0x80) return else return first cycle second cycle third cycle fourth cycle fifth cycle sixth cycle
polling algorithm read data from unprotected address We're done, DATA POLL changed simultaneously device passed DATA POLL algorithm true, even after
Using Flash memory with
Application Note AN97019
APPENDIX
SERIAL.C
Name module SERIAL.C Creation date 1997-04-21 Program language Name P.H. Seerden Description Console P51XA UART Copyright 1997 Philips Semiconductors B.V. #include <regxag3.sfr> #define BAUD_RATE #define #define DIVIDER 19200 20000000L (OSC/(64L*BAUD_RATE)) Xtal frequency
void ua_init(void) RTL1 -DIVIDER; RTH1 -DIVIDER S0CON 0x52; void co(char '\n') while (!TI_0) S0BUF '\r'; TI_0 while (!TI_0) S0BUF TI_0 char ci(void) char while (!RI_0) S0BUF 0x7F; RI_0 return void PrintString(const char _rom char (_rom char *)p; while '\0') '\n') co('\r'); co(*s); s++;
enable timer mode receiver enable
output '\r' first
Using Flash memory with
Application Note AN97019
APPENDIX
FLASH.H
Name module FLASH.H Creation date 1997-04-21 Program language Name P.H. Seerden Copyright 1997 Philips Semiconductors B.V. Description: Local declarations flash driver package. History: 97-04-21 P.H. Seerden Initial version typedef unsigned char typedef unsigned short typedef unsigned long #define base extern extern extern extern extern extern extern void char void void BYTE BYTE BYTE 0x40000 BYTE; WORD; LONG; base address flash memory
co(char ch); ci(void); ua_init(void); PrintString(const char *s); Download(void); EmbeddedProgram(LONG address, BYTE val); ChipErase(void);

Other recent searches


SK-A2980 - SK-A2980   SK-A2980 Datasheet
ISO13849-1 - ISO13849-1   ISO13849-1 Datasheet
ISO14119 - ISO14119   ISO14119 Datasheet
DB3X313J - DB3X313J   DB3X313J Datasheet
CNV-28CSP-COP8Sxx - CNV-28CSP-COP8Sxx   CNV-28CSP-COP8Sxx Datasheet
2SB1189 - 2SB1189   2SB1189 Datasheet
1760050000 - 1760050000   1760050000 Datasheet

 

Privacy Policy | Disclaimer
© 2012 Datasheet Archive