EmbeddedRelated.com
Forums
Memfault Beyond the Launch

EEPROM setup/erase/program for HC912D60

Started by Wade A Smith January 16, 2004
I'm having a real challenge trying to sort out the
code for EEPROM setup and programming for the
HC912D60.

I know how the HC11E20 is set up, but I see conflicting
methods for the HC912D60 and no example code.
In some examples (B32, A4) they set it up like the HC11
(sorta), but then along comes the ref manual for the
D60 and in appendix C it talks about setting the
EEDIV. Huh? It aint even defined in any definition
files I have for the D60.

Any code samples out there for either method
(using EEDIV or using the HC11_wait_10ms)?

wade




Wade,

Don't confuse the D60 and D60A. They have very different Flash Programming
algorithms.

The D60A has the newer SST flash which is also more reliable and has longer
life. It also does not require an external 12V programing voltage, and
generate the Flash Erase/Programming voltage from its 5V.

Hope this helps,
Doron
Nohau Corporation
HC12 In-Circuit Emulators
www.nohau.com/emul12pc.html

At 10:57 16/01/2004 -0500, you wrote:
>I'm having a real challenge trying to sort out the
>code for EEPROM setup and programming for the
>HC912D60.
>
>I know how the HC11E20 is set up, but I see conflicting
>methods for the HC912D60 and no example code.
>In some examples (B32, A4) they set it up like the HC11
>(sorta), but then along comes the ref manual for the
>D60 and in appendix C it talks about setting the
>EEDIV. Huh? It aint even defined in any definition
>files I have for the D60.
>
>Any code samples out there for either method
>(using EEDIV or using the HC11_wait_10ms)?
>
>wade





On 17 Jan 2004 14:49:37 -0000 writes:
> Date: Fri, 16 Jan 2004 18:54:55 +0200
> From: Doron Fael <>
> Subject: Re: EEPROM setup/erase/program for HC912D60
>
> Wade,
>
> Don't confuse the D60 and D60A. They have very different Flash
> Programming
> algorithms.
>
> The D60A has the newer SST flash which is also more reliable and has
> longer
> life. It also does not require an external 12V programing voltage,
> and
> generate the Flash Erase/Programming voltage from its 5V.

OK. So, I still would like some init/erase/pgm code for the
"original" method. AND since/if the D60A will become the
version available in the future when that happens we'll need the
code for that too, but I can ignore that for now.

That leaves me asking for some EEPROM init/erase/pgm code
for the D60. Trial and error consumes too much time to tweak
each and every register that MIGHT have something to do with
the EEPROM init/erase/program. So if anyone has a code
snippet for EEPROM init/erase/program, I would appreciate
it, since Motorola does not have an example that I could find
on their website. (or does someone know the URL for the
AppNote that does?) > Hope this helps,

It does make life a little simpler for now. Thanks.

> Doron
> Nohau Corporation
> HC12 In-Circuit Emulators
> www.nohau.com/emul12pc.html
>
> At 10:57 16/01/2004 -0500, you wrote:
> >I'm having a real challenge trying to sort out the
> >code for EEPROM setup and programming for the
> >HC912D60.
> >
> >I know how the HC11E20 is set up, but I see conflicting
> >methods for the HC912D60 and no example code.
> >In some examples (B32, A4) they set it up like the HC11
> >(sorta), but then along comes the ref manual for the
> >D60 and in appendix C it talks about setting the
> >EEDIV. Huh? It aint even defined in any definition
> >files I have for the D60.
> >
> >Any code samples out there for either method
> >(using EEDIV or using the HC11_wait_10ms)?
> >
> >wade
>




Here it is.

;---------------------------------
---------
PROTLCK equ $02
BPROT1 equ $02

EELAT equ $02
EEPGM equ $01

ms100 equ $9C6
ms10 equ $10E
ms1 equ $1B
ms8 equ $CC

us100 equ 176
us30 equ 58
us22 equ 39
us11 equ 19
us10 equ 18
us5 equ 9
us1 equ 2

TEN equ $80
eeprom equ $f80

go_SaveData
bclr EEMCR,PROTLCK
bclr EEPROT,BPROT1 ;unprotect block 1

jsr EraseEEPROM

ldx #DropStatus ;Beginning of RAM to write to
EEPROM
ldy #eeprom ;Beginning of EEPROM to write
to

movb #4,byte_count

jsr PgmEEPROM

bset EEMCR,PROTLCK
bset EEPROT,BPROT1 ;unprotect block 1
rts ;---------------------------------
---------
EraseDATA
bclr EEMCR,PROTLCK
bclr EEPROT,BPROT1 ;unprotect block 1

bsr EraseEEPROM

bset EEMCR,PROTLCK
bset EEPROT,BPROT1 ;unprotect block 1

rts

EraseEEPROM
movb #%00001110,EEPROG
movb #$FF,eeprom ;write any data to erase
nop
bset EEPROG,EEPGM

movw #1,wait_timer
movw #1,wait_timer
movw #1,wait_timer
movw #1,wait_timer

loop1
ldx wait_timer
bne loop1

movb #$80,EEPROG

; bclr EEPROG,EEPGM
; bclr EEPROG,EELAT

rts

;---------------------------------
---------
PgmEEPROM
movb #%10000010,EEPROG

PgmEEPROM10
movw 2,x+,2,y+
bset EEPROG,EEPGM

movw #1,wait_timer
movw #1,wait_timer
movw #1,wait_timer
movw #1,wait_timer

pshx

loop2
ldx wait_timer
bne loop2
pulx

bclr EEPROG,EEPGM
dec byte_count
bne PgmEEPROM10

bclr EEPROG,EELAT
movb #$80,EEPROG

rts



At 08:09 AM 1/18/04 -0500, you wrote:
>
>"original" method. AND since/if the D60A will become the
>version available in the future when that happens we'll need the
>code for that too, but I can ignore that for now.
>
The 912D60A has been the only version available for more than a year (more
like two). The D60 is only available as a mask ROM.

Gary Olmstead
Toucan Technology
Ventura CA



Memfault Beyond the Launch