AnsweredAssumed Answered

COPCTL loading problem at start from flash

Question asked by xak on Jan 18, 2013
Latest reply on Jan 19, 2013 by xak

I use the microcontroller S12XET256 with codewarrior 5.0.

My application run in a noised environment so I must enable the COP at start by loading the COPCTL from flash at reset.

As recommended, I use this 4 instructions to program flash NV registers:


const byte NVFPROT_INIT @0x0000FF0C = 0x7F; //FULL PFLASH SECURED

const byte NVEPROT_INIT @0x0000FF0D = 0xFF;

const byte NVFOPT_INIT @0x0000FF0E   = 0xF9; //COP CR[2:0]=6

const byte NVFSEC_INIT @0x0000FF0F   = 0x7D //SECURED, KEY DISABLED


But after start I read this by respective register and the COP, obviously, don't run:

FPROT=0x7F  (OK)

EPROT=0x7F  (wrong, should be 0x7F)

FOPT=0xFF    (wrong, should be 0xF9)

FSEC=0xFF    (wrong, should be 0x7D)


I try also with this settings:


const byte NVFPROT_INIT @0x0000FF0C = 0xFF;

const byte NVEPROT_INIT @0x0000FF0D = 0xFF;

const byte NVFOPT_INIT @0x0000FF0E   = 0xF9;

const byte NVFSEC_INIT @0x0000FF0F   = 0xFF


And I read this:



FOPT=0xFE  (wrong, should be 0xF9)

FSEC=0xFE  (wrong, should be 0xFF)


I use this funcion for another microcontroller (S12P128) without problems.

I wondering if someone has used this function with success or know the cause of problem.

Thanks in advance and best regards