Forums

programming the CONFIG register

Started by Steve Tabler January 30, 2005

I am attempting to program the CONFIG register in order to enable
COP. My initial attempts I discovered were wrong because I was
attempting to follow a procedure for the wrong version of 68HC11,
namely an A-series part. What I have is an E-series part:
MC68HC11E1CFN2.

I discovered my mistake when I read EB193 from Freescale which
describes the "correct" procedure. I haven't been able to make any
progress using the sample code provided. I HAVE been "successful" in
making one cpu non-functional, and I'd rather not do that again. I
have a limited supply of cpu's at the moment :)

I would appreciate any assistance I can get.
Thank you!



Re: programming the CONFIG register
Re: programming the CONFIG register
Re: programming the CONFIG register
Re: programming the CONFIG register
Re: programming the CONFIG register
Re: programming the CONFIG register
Steve,
Before yo move any further, I would suggest that you take a look at the MC68HC11E reference guide and read it throughly. I have uploaded this file to this groups "files" section of this group. Reading over this guide, for myself, I was able to better understand the innerworkings of the 68HC11. As for your problem, if you could be a bit more specific on what section of the CONFIG register you are trying to manipulate, then we would posses the tools to better help you. Remember, you must write to the CONFIG register within the first 64 clock cycles or the MCU will disregard you instructions, and you can only write to it once in your program (I think). Also, make sure that your connection between you computer and the MCU is OK. Are you by chance using the Technological Arts board? If so, then load the DEMO program that came with the board--if you don't have it, then you can download it from their website--to ensure that the MCU is properly configured to be programed. If you
are not using the Technological Arts board, then write a simple routine that will blink a light, or something, in order to let you know that your connection, and your programming configuration is operating properly. Take a step back for a bit and think it through, you may be missing something so simple--I think we have all done this a time or two. Anyhow, do this stuff and see how it works out, check back here because there are some real experts here that may have further suggestions for you. If what I mention does not work for you, then, as I mentioned before, be specific in your question (i.e. I am trying to initialize the A/D converter and it is not working). I hope this helps you a bit.

LF

Steve Tabler <> wrote:

I am attempting to program the CONFIG register in order to enable
COP. My initial attempts I discovered were wrong because I was
attempting to follow a procedure for the wrong version of 68HC11,
namely an A-series part. What I have is an E-series part:
MC68HC11E1CFN2.

I discovered my mistake when I read EB193 from Freescale which
describes the "correct" procedure. I haven't been able to make any
progress using the sample code provided. I HAVE been "successful" in
making one cpu non-functional, and I'd rather not do that again. I
have a limited supply of cpu's at the moment :)

I would appreciate any assistance I can get.
Thank you!
---------------------------------
Yahoo! Groups Links

To
---------------------------------


Steve --

A couple of things to keep in mind ---

1. The "CONFIG" register is a complex structure consisting of a
non-volatile register (actually an EEPROM cell), a "working" register (a RAM
cell) and a RESET mechanism that copies the non-volatile register into the
working register at RESET time.

2. To update the CONFIG register you must use EEPROM programming
techniques. There is no way to confirm that your update was successful
until _after_ you initiate a RESET because all attempts to read-back the
change will simply read back the contents of the working register which will
continue to hold the _old_ contents of CONFIG until the next RESET. You should consider obtaining a copy of John Beattie's Jbug11 debugger for
the HC11. It contains a mechanism for maintaining CONFIG that understands
the above considerations. It is also an excellent replacement for PCBUG11
without the built in CPU speed limitation problems.

See --

http://freespace.virgin.net/john.beatty/index.html

Finally, for definitive information on using the 'E' family parts, you
should obtain a copy of the MC68HC11 Technical Data Manual for the E series.

Best wishes,

Bob Smith
--- Avoid computer viruses, Practice safe hex ---

-- Specializing in small, cost effective
embedded control systems --

http://www.smithmachineworks.com/embedprod.html Robert L. (Bob) Smith
Smith Machine Works, Inc.
9900 Lumlay Road
Richmond, VA 23236 804/745-2608
----- Original Message -----
From: "Steve Tabler" <>
To: <>
Sent: Sunday, January 30, 2005 12:39 AM
Subject: [m68HC11] programming the CONFIG register >
> I am attempting to program the CONFIG register in order to enable
> COP. My initial attempts I discovered were wrong because I was
> attempting to follow a procedure for the wrong version of 68HC11,
> namely an A-series part. What I have is an E-series part:
> MC68HC11E1CFN2.
>
> I discovered my mistake when I read EB193 from Freescale which
> describes the "correct" procedure. I haven't been able to make any
> progress using the sample code provided. I HAVE been "successful" in
> making one cpu non-functional, and I'd rather not do that again. I
> have a limited supply of cpu's at the moment :)
>
> I would appreciate any assistance I can get.
> Thank you! >
> --
------
> Yahoo! Groups Links
>
> a.. To


Here's an example taken from an actual program (used on an E0 and E1). It
enables COP only if it finds it disabled.

First time your power up with this code, it will enable the COP in the
CONFIG register. Then you must cycle power and from then on it will work
correctly with COP enabled.

(I had hoped for a method to automatically reset after programming but the
usual CMF reset method wouldn't work immediately after this. Not even a
press of the reset button would work. Only power cycling did. Haven't
figured out exactly what causes this undocumented behavior.)

Look up the symbols in your E reference.

------------

Reset clr XINIT ;REGS and RAM at zero page
lds #STACKTOP

brclr CONFIG,#NOCOP.,Start ;COP already enabled, skip

;enable COP first time this runs

bclr BPROT,#PTCON. ;enable CONFIG programming

;first, erase CONFIG register
lda #$16 ;BYTE = 1, ERASE = 1, EELAT =
sta PPROG
sta CONFIG ;any data to this address will erase
it
inc PPROG ;Turn on programming voltage
ldx #10
os fDelayMS ;Delay 10 msec
clr PPROG ;Turn off programming voltage

;next, rewrite CONFIG register with required value
lda #$02 ;EELAT = 1
sta PPROG ;Set EELAT bit
lda #NOSEC.|EEON. ;value to program CONFIG with
sta CONFIG ;save data to address
inc PPROG ;Turn on programming voltage
ldx #10
os fDelayMS ;Delay 10 msec
clr PPROG ;Turn off programming voltage

bra * ;just hang, wait for manual power-on
reset

Start ... ;normal beginning of your code
------------

Hope it helps.
----- Original Message -----
From: "Steve Tabler" <>
To: < > I am attempting to program the CONFIG register in order to enable
> COP. My initial attempts I discovered were wrong because I was
> attempting to follow a procedure for the wrong version of 68HC11,
> namely an A-series part. What I have is an E-series part:
> MC68HC11E1CFN2.

> I would appreciate any assistance I can get.





Re: programming the CONFIG register
Thanks, Tony! This looks like what I'm looking for.

To Bob and Bart: Thank you for your suggestions, too. I'll post some more
specifics in a
few days. What I CAN tell you for now, though, is that the board I am
using is an old-model
board from New Micros, an NMIX-0020 (I think). Much of the programming is
being done
with the ICC V6 compiler. I have had to edit and reassemble the default
start-up file to
handle the programming of the BPROT register during the first 64 clock cycles.

Steve

At 06:24 PM 1/30/2005 +0200, you wrote:

>Here's an example taken from an actual program (used on an E0 and E1). It
>enables COP only if it finds it disabled.
>
>First time your power up with this code, it will enable the COP in the
>CONFIG register. Then you must cycle power and from then on it will work
>correctly with COP enabled.
>
>(I had hoped for a method to automatically reset after programming but the
>usual CMF reset method wouldn't work immediately after this. Not even a
>press of the reset button would work. Only power cycling did. Haven't
>figured out exactly what causes this undocumented behavior.)
>
>Look up the symbols in your E reference.



Thanks, Tony! This looks like what I'm looking for. I'll let you
know how I come out with things in a few days.

To Bob and Bart: Thank you for your suggestions, too. I'll post
some more specifics in a few days. What I CAN tell you for now,
though, is that the board I am using is an old-model board from New
Micros, an NMIX-0020 (I think). Much of the programming is being done
with the ICC V6 compiler. I have had to edit and reassemble the
default start-up file to handle the programming of the BPROT register
during the first 64 clock cycles.

Also, I DID consult the MC68HC11E reference guide. I hesitated to
post the programming code I was using, mostly because it is in C. I
may give JBUG11 a try, I have obtained it. Support over at New
Micros point me to something called HCLOAD, but it didn't work, and
there's no way to email the author. I think it may be for the A-
series parts, which have a differnet procedure from the E-series.

Steve

At 06:24 PM 1/30/2005 +0200, you wrote:

Here's an example taken from an actual program (used on an E0 and
E1). It
enables COP only if it finds it disabled.

First time your power up with this code, it will enable the COP in the
CONFIG register. Then you must cycle power and from then on it will
work
correctly with COP enabled.

(I had hoped for a method to automatically reset after programming
but the
usual CMF reset method wouldn't work immediately after this. Not
even a
press of the reset button would work. Only power cycling did.
Haven't
figured out exactly what causes this undocumented behavior.)

Look up the symbols in your E reference.


Steve: I will try to attach a small 'bootable' prog I wrote for a 9.8304MHz
hc11f1 that assembles with icc11v6 and makes an s19 file. I then run the s19
file thru srecconvert.exe (I think this is on simtel.com) to get a .bin file,
then I use bedit.exe (from simtel.com) to inset 1 byte of FF in the front of
the bin file... this makes the boot program in the hc11 switch to 9600 baud
(assuming the 9.834 xtal) If you dont put the FF there, you need to put a 00
there... the appnote on the bootloader prog will tell you what the default
baud rate to dl is... something like 1200 baud... This program can be downloaded
('booted') into the hc11 by a batch file that says
mode com1:9600,n,8,1
copy thing.bin com1:

If the file doesn't makeit, email me, and I'll email it to you.