Part Number Hot Search : 
2SA720A F0810MH TMP47C TMP47C MA100RW N452000 ATMEGA32 EL817B
Product Description
Full Text Search
 

To Download AN4429 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  january 2015 docid025710 rev 2 1/14 AN4429 application note rpc56xx and spc56xx c90fl flash recovery in case of brownout during flash erase operation introduction the rpc56xx and spc56xx families of devices have internal flash used for code and data. the following rpc56xx and spc56xx devices use c90fl technology they are for internal flash: ? rpc56elxx ? rpc564axx ? spc56xlxx ? spc564axx if, on c90fl flash, there is an accidental power loss or supply voltage drop or unexpected reset (in general called brownout) that happens during a flash erase operation, the flash blocks erased are left a not deterministic state. this application note describes how to recover the c90fl flash block(s) interrupted during an erase operation in case of such brownouts. www.st.com
contents AN4429 2/14 docid025710 rev 2 contents 1 c90fl flash erase operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 issue caused by brownout during flash erase . . . . . . . . . . . . . . . . . . . 4 2.1 recover from non-correctable ecc errors . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.2 recover from depleted bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3 conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 appendix a example script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 appendix b example code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
docid025710 rev 2 3/14 AN4429 c90fl flash erase operation 13 1 c90fl flash erase operation c90fl flash erase operation consists of multiple steps as shown in figure 1 which is implemented by the c90fl flash memory controller hardware. first, all bits in the selected flash block(s) are programmed in order to verify the level that allows the erase function to start at consistent state. then the erase step deletes all bits. since the erase is a bulk operation in which an erase pulse moves all the bits in a flash block, some bits are over- erased, for example, under the compaction of check up or under a software program of verify level. at the compaction step the over-erased columns are compacted back to reduce column leakage. and finally all the bits below software program verify level are reprogrammed with very low gate, in order to avoid overshoot of erase verify level for any bits. as a result, when an erase operation is completed, all the bits in the selected blocks have their threshold voltage within a pre-defined window, between erase verify level and software program verify level. figure 1. c90fl flash erase operation flow
issue caused by brownout during flash erase AN4429 4/14 docid025710 rev 2 2 issue caused by brownout during flash erase if there is an accidental power loss or supply voltage drop or unexpected reset on c90fl flash, (i.e., brownout) that occurs during a flash erase operation, the flash blocks that are erased are left a not deterministic state, but it depends on the step where the erase operation has been interrupted. typically to recover the flash block(s) that are interrupted to a working state again, users can simply perform an erase operation on the flash block(s). however, there are two cases that require special attention. 2.1 recover from non-correctable ecc errors if a brownout occurs during flash erase operation the bits in the block(s) remain and non- correctable ecc (error correcting code) errors appear. note that in c90fl flash, a single- bit error correction and double-bit error detection (sec-ded) ecc code are used. for example, if the brownout occurs during the program step in the erase operation, many flash pages, including the corresponding ecc bits, are left programmed. note that all zeros are not a valid ecc codeword, and hence this causes non-correctable ecc errors when they are reading those flash block(s). similarly the brownout can occur after the program step but in the middle of the erase step. even at this state, the flash block(s) can still be erased to recover it. however, some flash programmer tools (e.g. lauterbach) may read flash while executing a code from ram before performing an erase operation. as a result, it generates ecc error and hence an exception, and if the flash programmer tool does not have proper exception handler implemented, it may cause the code execution to hang in the flash programmer tool and thus cause the erase operation to fail. so to recover from this state, users need to be aware of possible flash programmer tool failure for erase operation caused by flash ecc exception. users can either use the flasherase function provided in the rpc56xx/spc56xx c90fl flash standard software driver to erase the interrupted flash block(s), or use nexus/jtag debugger script to simply toggle the low-level flash register bits to perform the erase operation. please refer to appendix a for an example lauterbach trace32 script for erasing c90fl flash. 2.2 recover from depleted bits it is also possible that a brownout during flash erase operation leave the bits in the flash block(s) erased at an over-erased or depleted state. for instance, if the brownout occurs after the erase step but before the compaction and software program step to complete, it is possible to be left in that state. depending on how much depleted the bits are, the excessive column leakage caused by the bits might cause the following program operation to fail due to suppressed drain bias. note that the first step in an erase operation is a program step, and thus for this case, the erase operation to recover the interrupted flash block(s) might fail. this appears to users as if the flash block(s) cannot be erased and recovered.
docid025710 rev 2 5/14 AN4429 issue caused by brownout during flash erase 13 to recover the depleted flash block(s) for this case, users need to use the binary c-array flashdepletionrecover function provided in rpc56xx/spc56xx c90fl flash standard software driver to recover the depleted bits in the flash block(s) first, and then re-start an erase operation to recover the block(s). the flashdepletionrecover is called in the similar way as any other binary c-array flash driver function. please refer to appendix b for an example code of calling this function to recover the depleted blocks.
conclusion AN4429 6/14 docid025710 rev 2 3 conclusion the flash erase operation can be used to recover the flash block(s) being interrupted due to brownout during erase operation. however, it is considered for cases with non- correctable ecc error and bits left at a depleted state. a new flashdepletionrecover function has been developed to enable users to recover flash block(s) left in a depleted state due to brownout.
docid025710 rev 2 7/14 AN4429 example script 13 appendix a example script example lauterbach trace32 script for erasing c90fl flash on spc564lxx: ;lblk and hblk are inputs (corresponding to lms and hbs registers) to select which block(s) to be erased local &mcr &peg &lblk &hblk &mcr &fdone entry &lblk &hblk ;reset mcr d.s ea:0xc3f88000 %long 0 d.s ea:0xc3f88000 %long 0 ;enable block d.s ea:0xc3f88010 %long &lblk d.s ea:0xc3f88014 %long &hblk &fdone=0 ;set ers d.s ea:0xc3f88000 %long 0x4 ;interlock write d.s ea:0x00000000 %long 0xffffffff ;set ehv d.s ea:0xc3f88000 %long 0x5 ;wait for done while &fdone==0 ( &mcr=d.l(ea:0xc3f88000) &fdone=&mcr&0x0400 ) ;clear ehv d.s ea:0xc3f88000 %long 0x4
example script AN4429 8/14 docid025710 rev 2 &mcr=d.l(ea:0xc3f88000) &peg=&mcr&0x0200 if &peg==0 print "fail" else print "pass" ;clear ers d.s ea:0xc3f88000 %long 0
docid025710 rev 2 9/14 AN4429 example code 13 appendix b example code example code of calling the flashdepletionrecover function to recover depleted blocks. #include "ssd_types.h" #include "ssd_c90fl.h" #include "normaldemo.h" extern const unsigned int flashinit_c[]; extern const unsigned int flashdepletionrecover_c[]; extern const unsigned int setlock_c[]; /* assign function pointers */ pflashinit pflashinit = (pflashinit) flashinit_c; psetlock psetlock = (psetlock) setlock_c; pflashdepletionrecover pflashdepletionrecover = (pflashdepletionrecover) flashdepletionrecover_c; ssd_config ssdconfig = { c90fl_reg_base, /* c90fl control register base */ main_array_base, /* base of main array */ 0, /* size of main array */ shadow_row_base, /* base of shadow row */ shadow_row_size, /* size of shadow row */ 0, /* block number in low address space */ 0, /* block number in middle address space */ 0, /* block number in high address space */ 0x10, /* page size */ false /* debug mode selection */ }; uint32 main(void) { uint32 returncode; /* return code from each ssd function. */
example code AN4429 10/14 docid025710 rev 2 bool shadowflag; /* shadow select flag */ uint32 lowenabledblocks; /* selected blocks in low space */ uint32 midenabledblocks; /* selected blocks in middle space */ uint32 highenabledblocks; /* selected blocks in high space */ /*========================= initialize part==================*/ returncode = pflashinit( &ssdconfig ); if ( c90fl_ok != returncode ) { errortrap(returncode); } /* unlock all main array blocks */ returncode = psetlock( &ssdconfig, lock_low_primary, 0, flash_lmlr_password); if ( c90fl_ok != returncode ) { errortrap(returncode); } returncode = psetlock( &ssdconfig, lock_low_secondary, 0, flash_slmlr_password); if ( c90fl_ok != returncode ) { errortrap(returncode); } returncode = psetlock( &ssdconfig, lock_mid_primary, 0, flash_lmlr_password); if ( c90fl_ok != returncode ) { errortrap(returncode); } returncode = psetlock( &ssdconfig, lock_mid_secondary, 0, flash_slmlr_password); if ( c90fl_ok != returncode ) { errortrap(returncode); }
docid025710 rev 2 11/14 AN4429 example code 13 returncode = psetlock( &ssdconfig, lock_high, 0, flash_hlr_password); if ( c90fl_ok != returncode ) { errortrap(returncode); } /*=============== deletion recover main array space =========*/ shadowflag = false; /* select the all main array blocks */ lowenabledblocks = 0xffffffff; midenabledblocks = 0xffffffff; highenabledblocks = 0xffffffff; returncode = pflashdepletionrecover( &ssdconfig, shadowflag, lowenabledblocks, midenabledblocks, highenabledblocks, null_callback ); if ( c90fl_ok != returncode ) { errortrap(returncode); } /*=================== demo finished =======================*/ /* demo passed */ return ((uint32)demo_pass); } /****************************************************************** | function implementations (scope: module-local) |----------------------------------------------------------------*/ /* error trap function */ void errortrap(uint32 returncode) { vuint32 failedreason; failedreason = returncode; while(1)
example code AN4429 12/14 docid025710 rev 2 { ; } } the function pointers for the driver functions are defined in ?ssd_c90fl.h? as below: typedef uint32 (*pflashinit) ( pssd_config pssdconfig ); typedef uint32 (*pflashdepletionrecover) ( pssd_config pssdconfig, bool shadowflag, uint32 lowenabledblocks, uint32 midenabledblocks, uint32 highenabledblocks, void (*callback)(void) ); typedef uint32 (*psetlock) ( pssd_config pssdconfig, uint8 blklockindicator, uint32 blklockstate, uint32 password );
docid025710 rev 2 13/14 AN4429 revision history 13 revision history table 1. document revision history date revision changes 13-jan-2014 1 initial release. 23-jan-2015 2 added rpc56xx rpns and new disclaimer.
d r a ft AN4429 14/14 docid025710 rev 2 important notice ? please read carefully stmicroelectronics nv and its subsidiaries (?st?) reserve the right to make changes, corrections, enhancements, modifications, and improvements to st products and/or to this document at any time without notice. purchasers should obtain the latest relevant in formation on st products before placing orders. st products are sold pursuant to st?s terms and conditions of sale in place at the time of o rder acknowledgement. purchasers are solely responsible for the choice, selection, and use of st products and st assumes no liability for application assistance or the design of purchasers? products. no license, express or implied, to any intellectual property right is granted by st herein. resale of st products with provisions different from the information set forth herein shall void any warranty granted by st for such product. st and the st logo are trademarks of st. all other product or service names are the property of their respective owners. information in this document supersedes and replaces information previously supplied in any prior versions of this document. ? 2015 stmicroelectronics ? all rights reserved


▲Up To Search▲   

 
Price & Availability of AN4429

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X