cancel
Showing results for 
Search instead for 
Did you mean: 

Program internal flash with program stop inside the internal flashed

jkscheng
Associate II
Posted on November 24, 2004 at 11:51

Program internal flash with program stop inside the internal flashed

5 REPLIES 5
jkscheng
Associate II
Posted on November 23, 2004 at 12:47

I have try to erease the Block 4 of internal flash of ST10F269 with software stored inside the First Block of internal Fast. I have follow the programming example , data sheet. And Both have the same result is that, The CPU erase the flashed to 0x00 and stop there. According to the Data sheet should be come 0xFF after BE command.

Any body have any idea of this problem? Any body have some workable Assembly routine? Or where can i download the Monitor022 source file.

Thnak and Regards.

Joseph Cheng 8-)

Thanks to all who have helping me to solve this problem, And I just find out that why the CPU just erase it 0x0000 because of the reset by watchdog inside the CPU which I have forgot to service it during the erasing process.

Thank you very much.

Joseph Cheng

😉

[ This message was edited by: JosephCheng on 01-12-2004 01:14 ]

najoua
Associate II
Posted on November 24, 2004 at 04:47

Hello,

Erase commands perform two operations : first, they individually program each word to 0000h, then they use the tunnelling to set all bits to ''1'' at the same time. ( Erasing Operation: outputs a ‘0’ during erasing, and ‘1’ after erasing completion). Given that the erase operation takes a long time ( seconds), an erase polling (let's say verification) should be done after the erase command has been sended (during erase operation) in order to verify the completion of the erase operation.

Refer to the example in the attached application note (pages 9 & 10).

I hope this wil help you and let me know if your pb persists.

Najoua.

________________

Attachments :

st10F269flashprogramming.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hzwm&d=%2Fa%2F0X0000000bYE%2F5_u.obLL6rwvEu_uJO4jhakz5vce1Qa2wGHaAN5mEU0&asPdf=false
najoua
Associate II
Posted on November 24, 2004 at 05:44

I think I have understood your pb which becomes from the fact that the code is run from one sector while erasing the other: It is possible to run code from one sector whilst erasing/programming another one.

The only constraint is that the code to be executed should be xecuted for erasing/programming out of the falsh itself:The solution is to copy the erasing/programming routine code in internal RAM, and then jump to it to execute it. At the end of the operation, a jump back to the flash could complete the program execution.

[ This message was edited by: Najoua on 24-11-2004 10:15 ]

jkscheng
Associate II
Posted on November 24, 2004 at 11:10

Good Morning, Najoua!

I have already download the AN1469 and try to testing the program example on my system. And I can sucuessfully write 2 data word to the internal with Flash Block is erased by ST-Utility. But I have a problem to erase a Blank of Flash Memory by the program inside the flash form Segment 0. I have try to erase the Bank4, and Bank 2 internal flash. And both have the same result that the CPU erase the Flash Bank to be 0x00 and then Stop and the Erasing process can not completed successfully.

And following is the Code which Program to Erase Flash at Segment 0 Bank 2.

Source Code Listing:

MOV R1,6000H

MOV R2,0

MOV R7,0

MOV R8,01554H

MOV R9,02AA8H

MOV R10,0A8H

EXTS R7,1

MOV [R8],R10

MOV R10,54H

EXTS R7,1

MOV [R9],R10

MOV R10,080H

EXTS R7,1

MOV [R8],R10

MOV R10,0A8H

EXTS R7,1

MOV [R8],R10

MOV R10,54H

EXTS R7,1

MOV [R9],R10

MOV R10,080H

MOV R10,030H

EXTS R2,1

MOV [R1],R10

nop

nop

nop

nop

nop

nop

nop

nop

nop

nop

pps21:

EXTS R2,1

MOV R10,[R1]

MOV R9,R10

XOR R10,R0

JNB R7,pps22

JNB R9.5,pps21

EXTS R2,1

MOV R10,[R1]

MOV R9,R10

XOR R10,R0

JNB R7,pps22

MOV R5,FCI1

MOV R6,FCI2

%WRFCI (RR)

ppserr:

BFLDH P2,0FEH,10001110B

IDLE

pps22:

bfldh P2,0FEH,10011110b

jmpr cc_uc,pps22

And I also check this code is the same as the one provide in the Application Note. What I do not understand is why the CPU erase the internal flash to 0x0000 and why the tunnelling feacture to convert the 0x0000 to 0xFFFF is not preformed. Is there any other setting I have to enable?

Thanks and Regards.

Joseph Cheng

:o

najoua
Associate II
Posted on November 24, 2004 at 11:51

Hello Joseph,

As I said, the erase operation pb comes from the fact that your erase command is run from Flash so to succeed to erase, you should run the erase command from RAM.

B.R

Najoua.

[ This message was edited by: Najoua on 24-11-2004 16:22 ]