AnsweredAssumed Answered

HCS08 TCL Script - Flash not blank (and still secured)

Question asked by Sven Hensel on Feb 12, 2019
Latest reply on Feb 20, 2019 by Sven Hensel

Hello,

 

I wanted to flash the HCS08 (LL-MC9S08LL16) under Linux (Raspbian running on Raspberry Pi 3 B+) with the USBDM-JS16-0001.
This works with the UsbdmFlashProgrammer when called as GUI program, and also via shell with the parameters:   

/usr/bin/UsbdmFlashProgrammer -verbose -target=HCS08 -device=MC9S08LL16 -security=image -masserase -secure -program -execute /mypath/FlashImage.s19

 

Unfortunately it does not work with the TCL script.
Here are the steps:

settarget HCS08
openbdm
reset A
connect
setdevice MC9S08LL16

source /usr/share/usbdm/DeviceData/HCS08/HCS08-default-flash-scripts.tcl
massEraseTarget

load /mypath/FlashImage.s19
program

closebdm

 

massEraseTarget returns the following output:

initFlash {}
initFlash() - Measuring bus frequency
Speed = 4.613 MHz
initFlash {} busSpeedkHz = 4612
calculateFlashDivider {}
cfmclkd = 23, flashClk = 192
:wb 0x00001820 <= 0x17 ...
:rb =>
  0x00001820 : AA
:wb 0x00001824 <= 0xFF ...
isUnsecure{} - Checking FOPT security
:rb =>
  0x00001821 : C3
isUnsecure{} - FOPT security check failed - doing blank check!
initFlash {}
initFlash() - Measuring bus frequency
Speed = 4.621 MHz
initFlash {} busSpeedkHz = 4620
calculateFlashDivider {}
cfmclkd = 23, flashClk = 192
:wb 0x00001820 <= 0x17 ...
:rb =>
  0x00001820 : AA
:wb 0x00001824 <= 0xFF ...
isUnsecure{} - Flash is blank and temporarily unsecured

 

But apparently the flash is still secured, because when program is called, the following appears:

Creating programmer
Setting programmer device data 'MC9S08LL16'
bytesex => Big-endian
Initialising BDM interface
Programming
initTarget {}
:halt
:wb 0x00001802 <= 0x22 ...
:rb =>
  0x00001802 : 22
initFlash {}
initFlash {} busSpeedkHz = 4613
calculateFlashDivider {}
cfmclkd = 23, flashClk = 192
:wb 0x00001820 <= 0x17 ...
:rb =>
  0x00001820 : 97
:wb 0x00001824 <= 0xFF ...
isUnsecure{} - Checking FOPT security
:rb =>
  0x00001821 : C3
isUnsecure{} - FOPT security check failed - doing blank check!
initFlash {}
initFlash() - Measuring bus frequency
Speed = 4.621 MHz
initFlash {} busSpeedkHz = 4620
calculateFlashDivider {}
cfmclkd = 23, flashClk = 192
:wb 0x00001820 <= 0x17 ...
:rb =>
  0x00001820 : 97
:wb 0x00001824 <= 0xFF ...
:wb 0x00001825 <= 0x30 ...
:wb 0x0000FFF0 <= 0xFF ...
:wb 0x00001826 <= 0x05 ...
:wb 0x00001825 <= 0x80 ...
:rb =>
  0x00001825 : C0
:rb =>
  0x00001825 : C0
isUnsecure{} - Flash not blank (and still secured)
Failed, rc = Target is secured

 

Do I have to set additional parameters? Or what could be the reason?

 

Edit: same behaviour under windows.

 

Thanks and greetings

Outcomes