cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with CTU flash command

mvan.os9
Associate II
Posted on February 10, 2006 at 04:13

Trouble with CTU flash command

2 REPLIES 2
mvan.os9
Associate II
Posted on January 31, 2006 at 09:27

Trouble with CTU flash command

Hi,

I am using the ST10F269 processor and have trouble with unprotecting my flash, so my boot

software/monitor is not working.

First of all: The flash/erase software works fine without codeprotection. No problems with it.

But when I enable the codeprotection (bit15 of PR), erasing and programming won't work anymore.

At this point I only use code protection and NO block protection. Here is my routine. It is

executed from RAM. According to the lost devices.. this is working fine.

void _dFlash_SetProtection(void)

{

uint *pAddr1,*pAddr2,*pAddr3;

pAddr1 = (uint *)_FLASHADDR_CI3;

pAddr2 = (uint *)_FLASHADDR_CI4;

pAddr3 = (uint *)_FLASHADDR_ODD;

*pAddr1=_FLASHCMD_CI1;

*pAddr2=_FLASHCMD_CI2;

*pAddr1=_FLASHCMD_SP;

*pAddr3= 0x7FFF;

}

Here is the code I use for the CTU command. The code is executed from FLASH.

#pragma asm

PUSH R8

MOV R8,#0FFFFh

EXTP #PAG 0,#1

MOV 03FF0h,R8

POP R8

#pragma endasm

Can someone see some errors here?

A few questions/notes:

- Code is executed before execution of EINIT. Is this allowed?

- I am using ST10F269-Q3 samples

najoua
Associate II
Posted on February 10, 2006 at 04:13

Hello,

The fact that ''when enabling the code protection , erasing and programming won't work anymore'' is normal because Code protection allows to disable any read or jump to the ST10 embedded Flash from another memory AND also acts as a global write protection and prevents subsequent block erase or programming. (Please refer to the attached AN for more details, section 2.6, page 13).

Your CTU code seems to be ok!

Regarding your question about code executed before execution of EINIT: this is not allowed because all configurations regarding register SYSCON (enable FLASH, enable CLKOUT, stacksize, etc...) must be selected before the execution of EINIT(End of Initialization).

I hope this helps you,

Best regards,

Najoua.

[ This message was edited by: Najoua on 13-02-2006 17:13 ]

[ This message was edited by: Najoua on 14-02-2006 08:28 ]

________________

Attachments :

AN1496_ST10F269_flash_programming.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0GH&d=%2Fa%2F0X0000000bXT%2F0Br0_3iTiQaw0bpnTQS028.p5XuTcwcDNy_hY5RuiK0&asPdf=false