![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
june 2013 docid15687 rev 5 1/29 PM0059 programming manual stm32f205/215, stm32f207/21 7 flash programming manual intr oduct i on th is p r o g r a mm ing ma nu al de scr i bes ho w to p r o g r a m the f l ash me mor y o f st m32 f 20 5/215 and stm32f207/217 microcontro llers. for convenienc e, thes e will be referred to as stm 32f 20x and st m32 f 21 x in the r e st o f this docum ent un less othe rwise specified . th e stm3 2f2 0 x a n d s t m 32f 21xem bed de d flash me mor y can b e pr ogr am med u s in g in- circu i t pr og ra mming or in -ap p lication p r o g r a mm ing. th e in-c ir cuit pr ogra m ming ( i cp) me thod is used to up da te the entir e co nten t s of th e f l ash me m o r y , us ing t h e jt ag , swd pr ot oc ol or the bo ot lo a d e r to lo a d th e u s er a p p lic at ion int o the microcontroller . ic p of fers quick an d ef ficie n t d e sign iter ation s a nd elim inate s u nne ce ssa r y p a ckag e ha ndlin g or so cketin g of d e vices. in contrast to the ic p met h od, in-a pplicat ion progr amming (iap) ca n use an y com m un ica t io n inter f ace su pp or te d by th e mi croc ontroller (i/os , us b, ca n, u a r t , i 2 c, spi, e t c.) to down l oad p r o g r a mmin g da t a into me mor y . with iap , the fla s h memo ry ca n be r e - p r o g ra mme d wh ile the ap plication is ru nn ing. ne ver t h e less, p a r t o f the ap plication h a s to h a ve be en pr eviou s ly pr og ram m ed in th e flash me mor y u s in g icp . t h e f l as h int e r fa c e im ple m en t s in st ru ctio n ac ce ss an d da t a ac ce ss ba se d on th e ahb p r o t o c o l . it imp l eme n t s a pr efetch buf fer tha t spe eds up cpu cod e execution . it a l so im ple m e n t s t h e lo gic n e ce ss ar y t o ca rry o u t f l as h me m o r y o p e r a t i on s ( p ro gr am /e r a se ) . pr ogr am /e ra se o per ation s can b e pe rfor med o v er the who l e pr od uct volt ag e ra ng e. rea d /write pr otections an d opt ion byte s a r e also imp l em ented. www.s t.c om http://
contents PM0059 2/29 docid15687 rev 5 co nten t s 1 g lossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2 f la sh memory interfa ce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2. 1 introdu ction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2. 2 m ain feat ures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2. 3 f lash memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2. 4 r e ad in terface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.4.1 r elatio n betwee n cpu clo ck fre que nc y a nd fla s h m e mo ry rea d time . . 8 2.4.2 a da ptive r e a l -time m e mo ry acce ler a tor (ar t accelerator? ) . . . . . . . . . 9 2. 5 e rase a nd pro g ram o perations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 2.5.1 u nlocking the flash control regist er . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 2.5.2 p ro gr am/er a se p a r a lleli sm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.5.3 e ras e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.5.4 p rogramming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.5.5 i nterrupt s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2. 6 o ption bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.6.1 d esc r iption of us er opt i on bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.6.2 p rogramming user option byt e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.6.3 r ead protect i on (rdp) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.6.4 w rite protections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2. 7 o ne -time progra m mable bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2. 8 f lash in terface registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.8.1 f las h ac ces s c o ntrol regis t er (flash _ac r ) . . . . . . . . . . . . . . . . . . . . 20 2.8.2 f lash key register (flash_keyr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.8.3 f las h option key regist er (flash_op t k eyr) . . . . . . . . . . . . . . . . . . . 21 2.8.4 f las h st atus register (flash_sr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.8.5 f la sh con t rol r egister ( f l a sh_cr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.8.6 f las h option cont rol register (fla sh_optcr ) . . . . . . . . . . . . . . . . . . . 24 2.8.7 f las h int e rface regis t er map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3 r evision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 docid15687 rev 5 3/29 list of t a bles 3 list of t a bles table 1. applicable produc ts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 table 2. flash module organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 t a b l e 3. nu mb e r o f wa it st at es a cco rd ing t o cpu cloc k (hclk) frequency . . . . . . . . . . . . . . . . . . . . 8 table 4. program/ e ras e parallelism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 table 5. flash interrupt requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 table 6. option by te organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 table 7. descript i on of t h e opt i on byt e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 t a b l e 8. acce ss ve rs us re a d p r ot ect i on le vel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 table 9. otp part organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 ta ble 1 0 . f la sh re giste r ma p and r e set valu es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 table 11. document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 list of figures 4/29 docid15687 rev 5 list of figures fig u r e 1. fla s h memo ry inter f a c e co nne ctio n inside syste m architec ture . . . . . . . . . . . . . . . . . . . . . . 6 fig u r e 2. se que ntial 32 -bi t instru ction e x ecution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 figure 3. rdp levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 docid15687 rev 5 5/29 pm0 059 gl oss a ry 28 1 glossary t h is se ctio n giv e s a br ie f d e f i nit i on o f a c r o n y m s an d ab b r e v ia tio n s us ed in th is do cu m e n t: ? the cpu co re in te gr ates two de bu g por t s : ? j t a g de bug p o r t ( j t a g- dp) p r o v id es a 5- pin stan dar d inter f ace ba se d on the j o in t t e s t a ctio n gr ou p (j t a g ) pr ot oc ol. ? s wd d e b u g po r t ( s wd- d p) pr o vide s a 2- pin ( clo ck an d da t a ) in te rf ac e b a se d on th e seri al wir e d ebu g (swd) pr otocol. for b o th the jt ag a nd swd p r oto c o l s, pl ea se re fe r to th e co rtex m3 t e chn i ca l re fe re nce man u a l ? w o rd : da t a /ins tr uct i on o f 32 -b it le n g t h . ? half wo rd: da t a /instr uction o f 16 -b it len g th. ? byte : da t a of 8-b i t le ngth. ? double word: dat a of 64 -b it len g th. ? ia p (in-applic ation programmin g): iap is the ability to repr ogram the flash memory of a microc ontroller while the user pro g r a m is r u n n in g. ? ic p (in-circ uit programming): ic p is the ability to program the flash memory of a m i cr oc on tr olle r usin g th e jt ag pr ot oc ol, th e swd pr ot oco l o r th e bo o t loa d e r wh ile th e de vice is mou n ted on th e user a p p lica t io n bo ard . ? i-cod e : this bu s conn ect s the instr u ctio n bu s of th e cpu core to the f l ash instru ction inter f ace. pr efetch is p e rfo rme d on this bus. ? d-cod e : this bu s co nne ct s th e d-co de bus ( lite r a l loa d a nd deb ug access) o f th e cpu to th e flash d a t a inte rface. ? o p t i on b yte s: p r o d u ct co nf igu r a t io n bit s st or ed in th e f l as h me m o r y . ? obl : optio n byte load er . ? ahb: ad va nced h i gh- pe rfor man c e bus. ? cpu: re fe rs to the co rtex-m 3 co re . flash memory interface PM0059 6/29 docid15687 rev 5 2 flash memory interface 2.1 introduction t h e f l as h me m o r y inte r f ac e ma n a g e s cp u ah b i-cod e an d d- code acce sses to th e 1 m byte ( 6 4 kb it 1 2 8 b i t s ) flash me mor y . it im plem ent s th e er ase an d pr ogr am f l ash m e m o ry op er a t ion s an d th e re ad a n d writ e p r ot ect i on m e ch an ism s . the f l as h me m o r y inte r f ac e ac ce le r a t e s co de e x e c u t io n w i th a sys te m of in str u c t ion p r e f e t ch an d cache lin es. 2.2 main features ? f l as h me m o r y re ad o p e r atio n s ? fla s h m e mo ry p r o g r a m/er ase op er ation s ? read / write pr otections ? pr ef et ch on i - co d e ? 64 cach e lines of 128 b i t s o n i- code ? 8 cache lin es o f 1 28 bit s on d- co de fig u r e 1 shows th e flash me mor y in te rface con nection in sid e the system ar chitectu re . figure 1 . flas h memory int e rf ac e con n ect ion inside sy st em arc h ite c tu re # o r t e x c o r e % t h e r n e t 5 3 " ( 3 $ - ! $ - ! $ c o d e b u s ) # o d e b u s # o r t e x - ) # o d e $ # o d e 3 b u s p e r i p h & |