| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
INTRODUCTION This application note provides library source code M59BW1
Top Searches for this datasheetSoftware Drivers M59BW102 Flash Memory INTRODUCTION This application note provides library source code M59BW102 Flash Memory. M59BW102 Flash Memory includes Synchronous Burst interface, allowing very high data throughput from small, low-cost device. code drivers fully compatible with either Synchronous Asynchronous modes operation. Listings source code found this document. source code also available file form from internet site http://www.st.com from your STMicroelectronics distributor. c1202_16.c c1202_16.h files contain libraries accessing M59BW102. Also included this application note overview programming model M59BW102. This will familiarize reader with operation memory devices provide basis understanding modifying accompanying source code. source code written platform independent possible requires minimal changes user order compile run. application note explains user should modify source code their individual target hardware. source code backed comments explaining used been written has. This application note does replace M59BW102 Data Sheet. refers Data Sheet throughout necessary have copy order follow some explanations. software accompanying documentation been fully tested target platform. small size applied target hardware. M59BW102 PROGRAMMING MODEL M59BW102 Mbit (64Kb x16) Flash Memory which electrically erased programmed through special coded command sequences most standard microprocessor buses. M59BW102 single voltage device. differs from first generation devices which require supply program erase. M59BW102 therefore easier since hardware does need cater special signal levels. INTRODUCTION M59BW102 PROGRAMMING MODEL WRITING CODE M59BW102 LIBRARY FUNCTIONS PROVIDED PORTING DRIVERS TARGET SYSTEM LIMITATIONS SOFTWARE CONCLUSION c1202_16.h LISTING c1202_16.c LISTING December 2000 1/18 AN1202 APPLICATION NOTE voltages needed erase device generated charge pumps inside device. Included device Program/Erase Controller. With first generation Flash Memory devices software manually program bytes before erasing using special programming sequences. Program/Erase Controller M59BW102 allows simpler programming model used, taking care necessary steps required erase program memory. This improved reliability that excess 100,000 program/erase cycles guaranteed device. Operations Commands Most functionality M59BW102 available standard operations: read write. Read operations retrieve data status information from device. Write operations interpreted device commands, which modify data stored behavior device. Only certain special sequences write operations recognized commands M59BW102. various commands recognized M59BW102 listed Commands Table datasheet grouped follows: Read/Reset Auto Select Erase Program Read/Reset command returns M59BW102 reset state where behaves ROM. this state, read operation outputs onto data data stored specified address device. Auto Select command places device Auto Select mode, which allows user read Electronic Signature device. These (the Manufacturer Device Codes) accessed reading different addresses whilst Auto Select mode. Chip Erase command used bits every memory location whole chip. data previously stored memory will lost. Chip Erase command typically takes 1.5s complete M59BW102. This longer than other commands because whole device erased once. Program command used modify data stored specified address device. Note that programming cannot change bits from '1'. therefore necessary erase device before programming Programming modifies single word time. Programming larger amounts data must done word time, issuing Program command, waiting command complete, then issuing next Program command, Each Program command requires write operations issue. Status Register While M59BW102 programming erasing, read from device will output Status Register Program/Erase Controller. This provides valuable information about current Program Erase command. Status Register bits described Status Register Bits Table M59BW102 Data Sheet. Their main determine when programming erasing complete whether successful not. Completion Program Erase operation determined either from polling (Status Register DQ7) from toggle (Status Register DQ6), following Data Polling Flow Chart Figure Data Toggle Flow Chart Figure datasheet. library routines described this application note Data Toggle Flow Chart. However, function based Data Polling Flow Chart also provided illustration. Programming erasing errors indicated error (Status Register DQ5) becoming before command completed. failure occurs, command will complete read operations will continue output Status Register bits until Read/Reset command issued device. 2/18 AN1202 APPLICATION NOTE Detailed Example Commands Table M59BW102 Data Sheet describes sequences write operations that will recognized Program/Erase Controller valid commands. example programming address 03E2h requires user write following sequence *(unsigned *(unsigned *(unsigned *(unsigned int*)(0x0555) int*)(0x02AA) int*)(0x0555) int*)(0x03E2) 0x00AA; 0x0055; 0x00A0; 0x9465; This example assumes that address 0000h M59BW102 mapped address 0000h microprocessor address space. practice likely that Flash will have base offset which needs added address. While device programming specified address, read operations will access Status Register bits. Status Register will error occurred. will toggle while programming on-going. will complement data being programmed. There only possible outcomes this programming command: success failure. Success will indicated toggle longer toggling being constant programmed value example) polling also being programmed value example). Failure will indicated error becoming while toggle still toggles polling remains complement ('1' example) data being programmed. Note that failure device itself extremely unlikely. command fails will normally because user attempting change programming. only possible change erasing. WRITING CODE M59BW102 low-level functions (drivers) described this application note have been provided simplify process developing application code STMicroelectronics Flash Memories. This enables users concentrate writing high level functions required their particular applications. These high level functions access Flash Memories calling level drivers, hence keeping details special command sequences away from users' high level code: this will result source code both simpler easier maintain. Code developed using drivers provided decomposed into three layers: hardware specific operations low-level drivers high level functions written user implementation hardware specific read write operations required lowlevel drivers order communicate with M59BW102. This implementation hardware platform dependent affected which microprocessor code runs where microprocessor's address space memory device located. user will have write functions appropriate hardware platform (see FlashRead() FlashWrite() next section). low-level drivers take care issuing correct sequences write operations each command interpreting information received from device during programming erasing. These drivers encode specific details issue commands interpret Status Register bits. high level functions written user will access memory device calling low-level functions. keeping specific details access M59BW102 away from high level functions, user left with code which simple easier maintain. also makes user's high level functions easier apply other STMIcroelectronics Flash Memories. When developing application, user advised proceed follows: first write simple program test level drivers provided verify that these operate expected user's target hardware software environments. 3/18 AN1202 APPLICATION NOTE then user should write high level code application, which will access Flash Memories calling level drivers provided. finally test complete application source code thoroughly. LIBRARY FUNCTIONS PROVIDED software library provided with this application note provides user with source code following functions: FlashReadReset() used reset device into Read mode. Note that there should need call this function under normal operation other software library functions leave device this mode. FlashAutoSelect() used identify Manufacturer Code Device Code device. FlashChipErase() used erase entire chip. FlashProgram() used program data arrays into Flash. Only previously erased words programmed reliably. functions provided software library rely user implementing hardware specific operations well suitable timing function. This done writing three functions follows: FlashRead() must written read value from Flash. FlashWrite() must written write value Flash. FlashPause() must written provide timer with microsecond resolution. This used wait while Flash recovers from some conditions. example these functions provided source code. many instances these functions written macros therefore will incur function call time overhead. functions which perform basic device have been provided users have awkward systems. example where addressing system peculiar data D0.D7 device D8.D15 microprocessor. They allow user quickly adapt code virtually target system. Throughout functions assumptions have been made data types. These are: char bits byte). This case microcontrollers. Where will necessary mask unused bits word (particularly user's FlashRead() function). bits bytes). Again, like char, this case will necessary variable type which bits longer mask bits above bits. long bits bytes). necessary have arithmetic greater than bits order address entire device. approaches addressing available: desired address Flash specified linear pointer offset into device could provided user. FlashRead() functions each case would declared unsigned char FlashRead( unsigned char *Addr); unsigned char FlashRead( unsigned long ulOff); pointer option advantage that runs faster. offset needs changed address each access this involves arithmetic. Using offset however, more portable since resulting software easily changed microprocessors with segmented memory spaces (such 8086). maximum portability functions this application note unsigned long offset, rather than pointer. 4/18 AN1202 APPLICATION NOTE PORTING DRIVERS TARGET SYSTEM Before using software Target System user needs write FlashRead(), FlashWrite() FlashPause() functions appropriate Target Hardware. example FlashRead() FlashWrite() functions provided source code should give user good idea what required used many instances without much modification. test source code Target System start simply reading from M59BW102. erased then only data should read. Next read Manufacturer Device codes check they correct. these functions work then likely that functions will work they should tested thoroughly. programmer needs take extra care when device accessed during interrupt service routine. situations exist which must considered: When device Read mode interrupts freely read from device. Interrupts which access device used during Program, Autoselect Chip Erase functions. programmer should also take care when Reset applied during Program Erase operations. Flash will left indeterminate state data could lost. LIMITATIONS SOFTWARE Care should taken some while() loops. time-outs have been implemented. Software execution stop loops hardware error. TimeOut! comment been these places user timer them prevent software failing. software only caters device system. software more devices mechanism selecting devices will required. When error occurs software simply returns error message. left user decide what Either command tried again necessary device need replaced. CONCLUSION M59BW102 single voltage Flash Memory ideal product embedded other computer systems, able easily interfaced microprocessors driven with simple software drivers written language. 5/18 AN1202 APPLICATION NOTE /**** c1202_16.h Header File c1202_16.c Filename: c1202_16.h Description: Header file c1202_16.c. Consult file details Version: V1.00 with file V1.00 Copyright 2000 STMicroelectronics. THIS PROGRAM PROVIDED WITHOUT WARRANTY KIND,EITHER EXPRESSED IMPLIED, INCLUDING LIMITED IMPLIED WARRANTY MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM WITH YOU. SHOULD PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION. Commands various functions #define FLASH_READ_MANUFACTURER #define FLASH_READ_DEVICE_CODE (-2) (-1) Error Conditions return values. file explanations help #define #define #define #define #define #define #define #define #define #define #define #define FLASH_SUCCESS FLASH_POLL_FAIL FLASH_TOO_MANY_BLOCKS FLASH_MPU_TOO_SLOW FLASH_BLOCK_INVALID FLASH_PROGRAM_FAIL FLASH_OFFSET_OUT_OF_RANGE FLASH_WRONG_TYPE FLASH_BLOCK_FAILED_ERASE FLASH_FUNCTION_NOT_SUPPORTED FLASH_ERASE_FAIL FLASH_TOGGLE_FAIL (-1) (-2) (-3) (-4) (-5) (-6) (-7) (-8) (-9) (-12) (-14) (-15) Function Prototypes extern unsigned FlashWrite( unsigned long ulOff, unsigned uVal extern unsigned FlashRead( unsigned long ulOff extern void FlashReadReset( void extern FlashAutoSelect( iFunc extern FlashErase( void extern FlashProgram( unsigned long ulOff, size_t NumBytes, void *Array extern FlashDataToggle( void static FlashDataPoll( unsigned long ulOff, unsigned uVal extern char *FlashErrorStr( iErrNum 6/18 AN1202 APPLICATION NOTE /**** 1202_16.c Flash Memory Filename: 1202_16.c Description: Library routines M59BW102 Flash Memory. Version: Date: Author: 1.00 Initial release, fully tested target platform. 14/09/2000 Webster, Oxford Technical Solutions (www.ots.ndirect.co.uk) Copyright 1999 STMicroelectronics. THIS PROGRAM PROVIDED WITHOUT WARRANTY KIND, EITHER EXPRESSED IMPLIED, INCLUDING LIMITED IMPLIED WARRANTY MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM WITH YOU. SHOULD PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION. Version History. Ver. 0.00 1.00 Date Comments 14/09/2000 Initial creation 15/09/2000 First release after testing This source file provides library code using M59BW102 device. following devices supported code: M59BW102 following functions available this library: FlashReadReset() FlashAutoSelect() FlashErase() FlashProgram() FlashErrorStr() reset flash normal memory access information about device Erase flash program word array return error string error further information consult Data Sheet Application Note. Application Note gives information about modify this code specific application. hardware specific functions which need modified user are: FlashWrite() writing word flash FlashRead() reading word from flash list error conditions code. There timeouts implemented loops code. each point where infinite loop implemented comment TimeOut! been placed. user implement these avoid code hanging instead timing out. source code assumes that compiler implements numerical types unsigned char bits 7/18 AN1202 APPLICATION NOTE unsigned unsigned long bits bits Additional changes code will necessary these correct. #include <stdlib.h> #include "1202_16.h" #define USE_M59BW102 Constants #define MANUFACTURER_ST (0x0020) #define BASE_ADDR ((volatile unsigned int*)0x0000) BASE_ADDR base address flash, functions FlashRead FlashWrite(). Some applications which require more complicated FlashRead() FlashWrite() BASE_ADDR #define ANY_ADDR (0x0000L) address offset within Flash Memory will Bulk #ifdef #define #define #endif device block USE_M59BW102 EXPECTED_DEVICE (0x00C1) Device code M59BW102 FLASH_SIZE (0x10000) Header file with global prototypes Static Prototypes following function only needed this module. static unsigned FlashWrite( unsigned long ulOff, unsigned uVal Function: unsigned FlashWrite( unsigned long ulOff, unsigned uVal Arguments: ulOff word offset flash write uVal value written Returns: uVal Description: This function used write word flash. many microprocessor systems macro used instead, increasing speed flash routines. example: #define FlashWrite( ulOff, uVal BASE_ADDR[ulOff] (unsigned int) uVal function used here instead allow user expand necessary. function made return uVal that compatible with macro. Pseudo Code: Step Write uVal word offset flash Step return uVal static unsigned FlashWrite( unsigned long ulOff, unsigned uVal Step1, Write uVal word offset flash return 8/18 AN1202 APPLICATION NOTE return BASE_ADDR[ulOff] uVal; Function: unsigned FlashRead( unsigned long ulOff Arguments: ulOff word offset into flash read from. Returns: unsigned word offset. Description: This function used read word from flash. many microprocessor systems macro used instead, increasing speed flash routines. example: #define FlashRead( ulOff BASE_ADDR[ulOff] function used here instead allow user expand necessary. Pseudo Code: Step Return value word offset ulOff unsigned FlashRead( unsigned long ulOff Step Return value word offset ulOff return BASE_ADDR[ulOff]; Function: void FlashReadReset( void Arguments: none Return Value: none Description: This function places flash Read Array mode described Data Sheet. this mode flash read normal memory. other functions leave flash Read Array mode this strictly necessary.It provided completeness. Pseudo Code: Step write command sequence void FlashReadReset( void Step write command sequence FlashWrite( 0x0555L, 0x00AA Cycle FlashWrite( 0x02AAL, 0x0055 Cycle FlashWrite( ANY_ADDR, 0x00F0 Cycle Function: FlashAutoSelect( iFunc Arguments: iFunc should Read Signature values. header file defines values reading Signature. Return Value: When iFunc FLASH_READ_MANUFACTURER (-2) function returns manufacturer's code. Manufacturer code 0020h. When iFunc FLASH_READ_DEVICE_CODE (-1) function returns Device Code. device codes parts are: M59BW102 00C1h When iFunc invalid function returns FLASH_FUNCTION_NOT_SUPPORTED (-12) 9/18 AN1202 APPLICATION NOTE Description: This function used read electronic signature device manufacturer code. Pseudo Code: Step Send Auto Select Instruction device instruction Step Read required function from device Step Return device Read Array mode FlashAutoSelect( iFunc iRetVal; Holds return value Step Send Read Electronic Signature instruction FlashWrite( 0x5555L, 0x00AA Cycle FlashWrite( 0x2AAAL, 0x0055 Cycle FlashWrite( 0x5555L, 0x0090 Cycle Step Read required function iFunc FLASH_READ_MANUFACTURER iRetVal FlashRead( 0x0000L else iFunc FLASH_READ_DEVICE_CODE iRetVal FlashRead( 0x0001L else iRetVal FLASH_FUNCTION_NOT_SUPPORTED; Step Return Read Array mode FlashReadReset(); return iRetVal; Function: FlashErase(void) Arguments: Void Return Value: function returns following conditions: FLASH_SUCCESS (-1) FLASH_WRONG_TYPE (-8) FLASH_ERASE_FAIL (-14) Description: This function erases entire flash memory. During Erase Cycle Data Toggle Flow Chart Data Sheet followed. polling bit, DQ7, used. Pseudo Code: Step Check correct flash type Step Write Flash Erase command Step Follow Data Toggle Flow Chart until Program/Erase Controller completed Step Return Read mode error occurs) FlashErase( void iRetVal FLASH_SUCCESS; Holds return value: optimistic initially! Step Check correct flash type !(FlashAutoSelect( FLASH_READ_MANUFACTURER MANUFACTURER_ST) !(FlashAutoSelect( FLASH_READ_DEVICE_CODE EXPECTED_DEVICE 10/18 AN1202 APPLICATION NOTE return FLASH_WRONG_TYPE; Step Write Flash Erase command FlashWrite( 0x0555L, 0xAA FlashWrite( 0x02AAL, 0x55 FlashWrite( 0x0555L, 0x80 FlashWrite( 0x0555L, 0xAA FlashWrite( 0x02AAL, 0x55 FlashWrite( 0x0555L, 0x10 Step Follow Data Toggle Flow Chart until Program/Erase Controller completes FlashDataToggle() FLASH_SUCCESS iRetVal FLASH_ERASE_FAIL; Step Return Read mode FlashReadReset(); return iRetVal; Function: FlashProgram( unsigned long ulOff, size_t NumBytes, void *Array Arguments: ulOff byte offset into flash programmed NumBytes holds number bytes array. Array pointer array programmed. Return Value: function returns following conditions: FLASH_SUCCESS (-1) FLASH_PROGRAM_FAIL (-6) FLASH_OFFSET_OUT_OF_RANGE (-7) FLASH_WRONG_TYPE (-8) success function returns FLASH_SUCCESS (-1). function returns FLASH_PROGRAM_FAIL (-6) programming failure occurs. address range programmed exceeds address range Flash device function returns FLASH_OFFSET_OUT_OF_RANGE (-7) nothing programmed. wrong type flash detected then FLASH_WRONG_TYPE (-8) returned nothing programmed. Description: This function used program array into flash. does erase flash first. Pseudo Code: Step Check correct flash type Step Check offset range valid Step While more words programed Step Check changes from Step Program next word Step Follow Data Toggle Flow Chart until Program/Erase Controller completed Step Return Read Mode Step Update pointers FlashProgram( unsigned long ulOff, size_t NumBytes, void *Array unsigned *uArrayPointer; unsigned char access array unsigned long ulLastOff; Holds last offset programmed 11/18 AN1202 APPLICATION NOTE Step Check correct flash type !(FlashAutoSelect( FLASH_READ_MANUFACTURER MANUFACTURER_ST) !(FlashAutoSelect( FLASH_READ_DEVICE_CODE EXPECTED_DEVICE return FLASH_WRONG_TYPE; Step Check offset range valid ulLastOff ulOff+NumBytes-1; ulLastOff FLASH_SIZE return FLASH_OFFSET_OUT_OF_RANGE; Step While there more programmed uArrayPointer (unsigned *)Array; while( ulOff ulLastOff Step Check changes from ~FlashRead( ulOff *uArrayPointer Indicate failure possible change using Program command. This must done using Erase command return FLASH_PROGRAM_FAIL; Step Program next word FlashWrite( 0x0555L, 0xAA cycle FlashWrite( 0x02AAL, 0x55 cycle FlashWrite( 0x0555L, 0xA0 Program command FlashWrite( ulOff, *uArrayPointer Program value Step Follow Data Toggle Flow Chart until Program/Erase Controller completed Data Toggle Flow Chart Data Sheet FlashDataToggle() FLASH_TOGGLE_FAIL Step Return Read Mode error occurred) FlashReadReset(); return FLASH_PROGRAM_FAIL; Step Update pointers ulOff++; uArrayPointer++; return FLASH_SUCCESS; Function: static FlashDataToggle( void Arguments: none Return Value: function returns FLASH_SUCCESS Program/Erase Controller successful FLASH_TOGGLE_FAIL there problem. Description: function used monitor Program/Erase Controller during erase program operations. returns when Program/Erase Controller completed. theM59BW102 Data Sheet Data Toggle Flow Chart shows operation function. Pseudo Code: Step Read (into byte) Step Read (into another byte) Step toggle between reads then 12/18 AN1202 APPLICATION NOTE return FLASH_SUCCESS Step Else zero then operation complete, goto Step Else (DQ5 read again Step toggle between last reads then return FLASH_SUCCESS Step Else return FLASH_TOGGLE_FAIL static FlashDataToggle( void unsigned hold values read from address offset within Flash Memory while( TimeOut!: some reason, hardware fails then this loop exit. timer function implement timeout from loop. Step Read (into word) FlashRead( ANY_ADDR Read from Flash (any address) Step Read (into another word) FlashRead( ANY_ADDR Read from Flash (any address) Step toggle between reads then return FLASH_SUCCESS (u1&0x0040) (u2&0x0040) Toggle return FLASH_SUCCESS; Step Else zero then operation complete (u2&0x0020) 0x0000 continue; Step Else (DQ5 read again FlashRead( ANY_ADDR Read from Flash (any address) Step toggle between last reads then return FLASH_SUCCESS (u2&0x0040) (u1&0x0040) Toggle return FLASH_SUCCESS; Step Else return FLASH_TOGGLE_FAIL else Toggle here means fail return FLASH_TOGGLE_FAIL; while loop #ifndef ILLUSTRATION_ONLY Function: static FlashDataPoll( unsigned long ulOff, unsigned uVal Arguments: ulOff should hold valid offset polled. programming this will offset word being programmed. erasing this offset block(s) being erased. uVal should hold value being programmed. value should used when erasing. Return Value: function returns FLASH_SUCCESS Program/Erase Controller successful FLASH_POLL_FAIL there problem. Description: function used monitor Program/Erase Controller during erase program operations. returns when Program/Erase Controller 13/18 AN1202 APPLICATION NOTE completed. M59BW102 Data Sheet Data Polling Flow Chart shows operation function. Note: This library does Data Polling Flow Chart assess correct operation Program/Erase Controller, uses Data Toggle Flow Chart instead. FlashDataPoll() function only provided here illustration Data Polling Flow Chart Data Sheet. code uses function FlashDataToggle() instead. Pseudo Code: Step Read (into word) Step same uVal(bit then return FLASH_SUCCESS Step Else zero then operation complete, goto Step Else (DQ5 Read Step same uVal(bit then return FLASH_SUCCESS Step Else return FLASH_POLL_FAIL static FlashDataPoll( unsigned long ulOff, unsigned uVal unsigned holds value read from valid address while( TimeOut!: some reason, hardware fails then this loop exit. timer function implement timeout from loop. Step Read (into word) FlashRead( ulOff Read DQ5, valid addr Step same Value(bit then return FLASH_SUCCESS (u&0x0080) (uVal&0x0080) DATA return FLASH_SUCCESS; Step Else zero then operation complete (u&0x0020) 0x0000 continue; Step Else (DQ5 FlashRead( ulOff Read valid addr Step same uVal(bit then return FLASH_SUCCESS (u&0x0080) (uVal&0x0080) DATA return FLASH_SUCCESS; Step Else return FLASH_POLL_FAIL else DATA here means fail return FLASH_POLL_FAIL; while loop #endif !ILLUSTRATION_ONLY Function: char *FlashErrorStr( iErrNum Arguments: iErrNum error number returned from another Flash Routine Return Value: pointer string with error message Description: This function used generate text string describing error from flash. Call with return value from another 14/18 AN1202 APPLICATION NOTE flash routine. Pseudo Code: Step Check error message range. Step Return correct string. char *FlashErrorStr( iErrNum static char *str[] "Flash Success", "Flash Poll Failure", "Flash Many Blocks", "MPU slow erase blocks", "Flash Block selected invalid", "Flash Program Failure", "Flash Address Offset Range", "Flash Wrong Type", "Flash Block Failed Erase", "Flash Unprotected", "Flash Protected", "Flash function supported", "Flash Invalid", "Flash Erase Fail", "Flash Toggle Flow Chart Failure"}; Step Check error message range iErrNum -iErrNum errors negative: make adjust iErrNum iErrNum sizeof(str)/sizeof(str[0])) Check range return "Unknown Error\n"; Step Return correct string else return str[iErrNum]; List Errors Return values, Explanations Help. Return Name: Flash_SUCCESS Return Value: Description: This value indicates that flash command executed correctly. Error Name: Flash_POLL_FAIL Notes: Data Polling Flow Chart, which applies series Flash only, used this library. function FlashDataPoll() only provided illustration Data Polling Flow Chart. This error condition should occur when using this library. Return Value: Description: Program/Erase Controller algorithm managed complete command operation successfully. This because device damaged Solution: command again. fails second time then likely that device will need replaced. Error Name: Flash_TOO_MANY_BLOCKS Notes: Applies series Flash only. Return Value: 15/18 AN1202 APPLICATION NOTE Description: user chosen erase more blocks than device has. This because array blocks erase contains same block more than once. Solutions: Check that program trying erase valid blocks. device will only have NUM_BLOCKS blocks (defined file). Also check that same block been added twice more array. Error Name: Flash_MPU_TOO_SLOW Notes: Applies series Flash only. Return Value: Description: managed write selected blocks device before timeout period expired. BLOCK ERASE COMMAND section Data Sheet details. Solutions: this occurs occasionally then because interrupt occuring between writing blocks erased. Search "DSI!" code disable interrupts during time critical sections. this error condition always occurs then time faster microprocessor, better optimising compiler worse still, learn assembly. immediate solution only erase block time. Disable test #define'ing code) always call function with block time. Error Name: Flash_BLOCK_INVALID Notes: Does apply M59BW102 Return Value: Description: request invalid block been made. Valid blocks number from NUM_BLOCKS-1. Solution: Check that block valid range. Error Name: Flash_PROGRAM_FAIL Return Value: Description: programmed value been programmed correctly. Solutions: Make sure that block containing value erased before programming. erasing block re-programming value. fails again then device need changed. Error Name: Flash_OFFSET_OUT_OF_RANGE Return Value: Description: address offset given range device. Solution: Check that address offset valid range. Error Name: Flash_WRONG_TYPE Return Value: Description: source code been used access wrong type flash. Solutions: different flash chip with target hardware contact STMicroelectronics different source code library. Error Name: Flash_BLOCK_FAILED_ERASE Notes: Does apply M59BW102 Return Value: Description: previous erase this block managed successfully erase block. Solution: Sadly flash needs replacing. 16/18 AN1202 APPLICATION NOTE Return Name: Flash_UNPROTECTED Notes: Applies some series Flash only. This condition should occur when using this library. Return Value: Description: user requested unprotect flash that already unprotected user requested re-protect flash that protected blocks. This just warning user that their operation make changes necessary. Return Name: Flash_PROTECTED Notes: This condition should occur when using this library. Return Value: Description: user requested protect flash that already protected. This just warning user that their operation make changes necessary. Return Name: Flash_FUNCTION_NOT_SUPPORTED Notes: This condition should occur when using this library. Return Value: Description: user attempted make functionality available this flash device (and thus provided software drivers). This simply warning user. Error Name: Flash_VPP_INVALID Notes: Applies series Flash only. This error condition should occur when using this library. Return Value: Description: Program Block Erase been attempted with supply voltage outside allowed ranges. This command effect since invalid effect protecting whole flash device. Solution: (hardware) configuration will need modified make programming erasing device possible. Error Name: Flash_ERASE_FAIL Return Value: Description: This indicates that previous erasure block, many blocks whole device failed. Solution: Investigate this failure further attempting erase each block individually. erasing single block still causes failure, then Flash sadly needs replacing. Error Name: Flash_TOGGLE_FAIL Return Value: Notes: This applies series Flash only. Description: Program/Erase Controller algorithm managed complete command operation successfully. This because device damaged. Solution: command again. fails second time then likely that device will need replaced. 17/18 AN1202 APPLICATION NOTE have questions suggestion concerning matters raised this document please send them following electronic mail address: ask.memory@st.com (for general enquiries) Please remember include your name, company, location, telephone number number. Information furnished believed accurate reliable. However, STMicroelectronics assumes responsibility consequences such information infringement patents other rights third parties which result from use. license granted implication otherwise under patent patent rights STMicroelectronics. Specifications mentioned this publication subject change without notice. This publication supersedes replaces information previously supplied. STMicroelectronics products authorized critical components life support devices systems without express written approval STMicroelectronics. logo registered trademark STMicroelectronics other names property their respective owners 2000 STMicroelectronics Rights Reserved STMicroelectronics GROUP COMPANIES Australia Brazil China Finland France Germany Hong Kong India Italy Japan Malaysia Malta Morocco Singapore Spain Sweden Switzerland United Kingdom U.S.A. www.st.com 18/18 Other recent searchesWE05D02B2 - WE05D02B2 WE05D02B2 Datasheet SiA811ADJ - SiA811ADJ SiA811ADJ Datasheet Si9803DY - Si9803DY Si9803DY Datasheet S6X2R - S6X2R S6X2R Datasheet F1779 - F1779 F1779 Datasheet BVL-501H3D - BVL-501H3D BVL-501H3D Datasheet AN2963 - AN2963 AN2963 Datasheet MC33695 - MC33695 MC33695 Datasheet AM2520SRC09 - AM2520SRC09 AM2520SRC09 Datasheet
Privacy Policy | Disclaimer |