EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

MC9S12DP256 Security Bit

Started by Bill April 8, 2004
I keep inadvertantly setting the security bit on the 9S12. How can I
avoid this? Unsecure software puts it back right again, but I must
be loading something into flash memory that says "Secure" this MCU.
Any tips or suggestions?
--- In , "Bill" <shaggers3@y...> wrote:
> I keep inadvertantly setting the security bit on the 9S12. How can I
> avoid this? Unsecure software puts it back right again, but I must
> be loading something into flash memory that says "Secure" this MCU.
> Any tips or suggestions?

Hi Bill,

I had the same problem when I first started, can be a bit of a puzzle when all is new, I had the added problem the unlock program didn't unlock either, there are still some wads of hair on the floor.

Anyway, here is a slice of my code dealing with this.
It gives the byte involved and the codes, if in doubt inspect the S record for what actually gets programmed there.
I think I posted the whole thing in the files area at the YAHOO group as well.

Hope this helps,

Regards,

Theo

*--------------------------
* $FF0F SECURITY SETUP
* Security info, this is read out of reset from $FF0F to FPROT Register
* be sure to give it the right value!!!
* KEYEN bit 7, ;Enable backdoor =1, disable =0
* SEC00 bit 0, ;when secured bit 0 and 1 must be 0
* SEC01 bit 1, ;when unsecured bit 0 must be 0 and bit 1 set to 1
* Rest don't care

* VALUES Defined here

SECNOBCK EQU %00000000 ;$00 ;secured, no backdoor
SECBCK EQU %10000000 ;$80 ;secured, with backdoor access
UNSEC EQU %10000010 ;$82 ;unsecured with BD, tbstbs

* Init our Value at $FF0F
FLSECRT FCB UNSEC ;size 1 Security Byte
Thanks Theo...this info helped me a lot. I have examined the S
record just like you said and the Security Bit is located in memory
at location 0xFF0F. This byte should be 0xFE in order to be
unsecured. If the byte is 0xFD, 0xFC or 0xFF the MCU will be Secured
and will not accept a new download to flash. Codewarrior gives you a
nice memory window in the Real-Time Debugger to examine this
location. Hope this info helps someone else.
Bill...

The 2024 Embedded Online Conference