Author Topic: 68HC11F1 setup questions  (Read 5623 times)

0 Members and 1 Guest are viewing this topic.

Offline metertech58761Topic starter

  • Regular Contributor
  • *
  • Posts: 154
  • Country: us
68HC11F1 setup questions
« on: July 28, 2022, 12:21:12 pm »
I would like to hear from those who have used the 68HC11F1 (PLCC68 package), as it seems there are still some erroneous assumptions in my design.

First of all, on the hardware side, I currently have the 1MHz oscillator fed into pin 6 (EXTAL) and connected to the other chips needing a clock signal as well; pin 7 (XTAL) has a 10K pull-down; and pin 4 (E) is currently not connected.

I see the documentation says that I should be using a crystal 4x the desired frequency?

Was I supposed to feed 4MHz into EXTAL and then take the system clock from E?

Then going over the internal registers used, it seems that I need to add a few initialization instructions to the startup code.

I don't understand what the IRV bit in the HPRIO register does. Do I need to set this or not? (I have the HC11 set to Expanded mode).

Also, should I enable the COP watchdog?
 

Online newbrain

  • Super Contributor
  • ***
  • Posts: 1714
  • Country: se
Re: 68HC11F1 setup questions
« Reply #1 on: July 28, 2022, 01:20:12 pm »
Note that I only used a 68HC11A8, and many years ago.

As you suspect, the quartz/oscillator frequency is internally divided to generate an 4 phase clock for internal needs (e.g. fetch decode execute etc. - though I don't have details).
One of  these phases is brought out as E.
So, with a 1 MHz external clock the actual system/memory clock (E) is 250 kHz.

Depending on your needs, this might be what you wanted or not; still, it's E that must be used to e.g. gate memory control signals.

Unless you need it for debugging and trouble shooting, I would not set the Internal Read Visibility bit: in Expanded mode there might be bus contentions.
What the bit does is driving data read from registers or internal addresses on the data bus - useful with a logic analyser, but otherwise not needed.

Having or not an active watchdog is your design choice: if active, it must be periodically kicked by the FW; since you are asking, I suppose you don't need it and would leave it disabled.
Nandemo wa shiranai wa yo, shitteru koto dake.
 
The following users thanked this post: metertech58761

Offline metertech58761Topic starter

  • Regular Contributor
  • *
  • Posts: 154
  • Country: us
Re: 68HC11F1 setup questions
« Reply #2 on: July 28, 2022, 03:51:23 pm »
Okay. Oversight on my part then... definitely different than the arrangement on the original CPU.
.I'll fix the design docs and I will need to do a bit of cut and jumper to mod the current board.

So I can just ignore the IRV bit part and go without the COP.

Two other questions -

I won't be using the 4XOUT pin. Is there any benefit to turning off the pin in software?

Last but not least, I don't need the on-board EEPROM, so I would prefer to set it to $Dxxx and turn it off (so it's not in the way of the firmware ROM I plan to locate at $E000).

This involves changing the CONFIG register. Can it be done through firmware or do I need something special to change it?
 

Offline coromonadalix

  • Super Contributor
  • ***
  • Posts: 5795
  • Country: ca
« Last Edit: July 28, 2022, 04:45:06 pm by coromonadalix »
 

Offline metertech58761Topic starter

  • Regular Contributor
  • *
  • Posts: 154
  • Country: us
Re: 68HC11F1 setup questions
« Reply #4 on: July 28, 2022, 05:26:06 pm »
I have the manuals already. Was hoping for input from someone who has real-world experience with this relatively obsolete chip...
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 3796
  • Country: gb
Re: 68HC11F1 setup questions
« Reply #5 on: July 28, 2022, 05:58:06 pm »
Code: [Select]
#define HPRIO                   $3C                     ; Highest Priority Interrupt and misc

BCLR    HPRIO,X %00100000       ; put into single chip mode
...
BSET    HPRIO,X %00100000       ; put into expanded chip mode

The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 3796
  • Country: gb
Re: 68HC11F1 setup questions
« Reply #6 on: July 28, 2022, 05:59:30 pm »
should I enable the COP watchdog?

only after setting the interrupt table
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 3796
  • Country: gb
Re: 68HC11F1 setup questions
« Reply #7 on: July 28, 2022, 06:17:57 pm »
my setup for expanded mode is

Code: [Select]
HPRIO=  0x103c          ; Highest Priority I Bit interrupt and misc register
Code: [Select]
               .section   .text
               .text
my_start:
reset:
                sei                     ; disable interrupt
                lds     #stack          ; initialize the stack pointer
                ldx     #base_io        ; load the register base address
;; -------------------------------------------------------------------------------
start:
;; -------------------------------------------------------------------------------
                ;; Put the 'HC11 into expanded mode!
                ldaa    #0x66
                staa    HPRIO
;; -------------------------------------------------------------------------------

you can look at the source of BUFALO.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 3796
  • Country: gb
Re: 68HC11F1 setup questions
« Reply #8 on: July 28, 2022, 06:19:04 pm »
I don't need the on-board EEPROM, so I would prefer to set it to $Dxxx and turn it off (so it's not in the way of the firmware ROM I plan to locate at $E000).
This involves changing the CONFIG register. Can it be done through firmware or do I need something special to change it?

You can configure it with the firmware, and you can program it. There is a special register, that stores the configuration.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 3796
  • Country: gb
Re: 68HC11F1 setup questions
« Reply #9 on: July 28, 2022, 06:20:10 pm »
Did you design your board?
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 3796
  • Country: gb
Re: 68HC11F1 setup questions
« Reply #10 on: July 28, 2022, 06:26:55 pm »
I don't understand what the IRV bit in the HPRIO register does. Do I need to set this or not?

On the F1 EVB board made by Motorola in 1995, there is an hardware debugger and it's the only setup I have ever seen with the IRV bit set to 1.

Don't set it, because, without the Motorola hw debugger circuit, internal registers and memory locations could be randomly driven out on the data bus, making it a mess.

If you need a debugger but you don't have the Motorola debugger, use a software talker in "special serial boot mode".
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline metertech58761Topic starter

  • Regular Contributor
  • *
  • Posts: 154
  • Country: us
Re: 68HC11F1 setup questions
« Reply #11 on: July 28, 2022, 08:36:25 pm »
To respond to the previous posts -

There is already an interrupt in the firmware (NMI driven by a pulse train from the 6840 PTM), which handles the I/O, so I won't monkey around with that part too much.

This HC11 is put in expanded mode by pulling both MODA / MODB pins high.

This is a project where I reverse-engineered a piece of equipment then updated it with more modern parts.

The original equipment uses a MPU that was a bespoke part developed for industrial applications, and the HC11 is the closest match.
 

Online Benta

  • Super Contributor
  • ***
  • Posts: 5840
  • Country: de
Re: 68HC11F1 setup questions
« Reply #12 on: July 28, 2022, 10:51:05 pm »
There is already an interrupt in the firmware (NMI driven by a pulse train from the 6840 PTM)

NMI for I/O? Seriously? Also, the 'HC11 doesn't have an NMI. It has an XIRQ, which solves the problems of a traditional NMI.

« Last Edit: July 28, 2022, 10:53:12 pm by Benta »
 

Offline metertech58761Topic starter

  • Regular Contributor
  • *
  • Posts: 154
  • Country: us
Re: 68HC11F1 setup questions
« Reply #13 on: July 29, 2022, 07:02:13 am »
If it helps, here's a copy of the schematic of the board with the HC11. The 2732 serves as a chip select for the PTM and PIA, the 2764 has the firmware.
 

Online newbrain

  • Super Contributor
  • ***
  • Posts: 1714
  • Country: se
Re: 68HC11F1 setup questions
« Reply #14 on: July 29, 2022, 02:21:04 pm »
The 2732 serves as a chip select for the PTM and PIA, the 2764 has the firmware.
Make sure the total access time of two cascaded EPROM is quick enough; they are not the fastest memories, and there are setup and hold times to abide by.
Though probably, as the address and data buses are not shared, you have a good margin.
I used a couple of flash to run a a 68HC11 at 2 MHz (8 MHz/4), one for address decoding and some other glue logic functions, the other for FW.
Nandemo wa shiranai wa yo, shitteru koto dake.
 

Offline metertech58761Topic starter

  • Regular Contributor
  • *
  • Posts: 154
  • Country: us
Re: 68HC11F1 setup questions
« Reply #15 on: July 29, 2022, 02:55:29 pm »
The 2764 holds the actual firmware, while the 2732 handles the chip select (D0 = 2764, D1 = 6840 / 6821, D2 = 8279 on display board)

A GAL would be the preferred solution, sure, but I figure that a 1MHz clock should be slow enough that an EPROM would be an acceptable substitute?
 

Online newbrain

  • Super Contributor
  • ***
  • Posts: 1714
  • Country: se
Re: 68HC11F1 setup questions
« Reply #16 on: July 29, 2022, 05:17:13 pm »
A GAL would be the preferred solution, sure, but I figure that a 1MHz clock should be slow enough that an EPROM would be an acceptable substitute?
As said, it's probably OK, depending on the EPROMs (and other peripherals) access times.
Checking the datasheets and the needed bus timing will make sure it actually is.

In my case, with a multiplexed bus and a 2 MHz clock, it definitely wasn't.

EtA: Looks fine, unless you have ultra slow EPROMS. BUT:
  • I do not like the 2764 to have outputs permanently enabled.
    This can cause bus contention if a write is issued to an EPROM address, and possibly to some other address while the address bus and the 2732 decoder stabilize. Since you already have a /RD signal, you could use it for the 2764 /OE
  • The schematic uses 74LS series ICs, as the 68HC11 is a CMOS processor, you could safely use HC (or HCT) series logic.
« Last Edit: July 29, 2022, 05:45:42 pm by newbrain »
Nandemo wa shiranai wa yo, shitteru koto dake.
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 3796
  • Country: gb
Re: 68HC11F1 setup questions
« Reply #17 on: July 29, 2022, 05:41:12 pm »
The Motorola M68hc11EVB board (68hc11A or 68hc11E) uses a 27xxx 16Kbyte UV EPROM.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online newbrain

  • Super Contributor
  • ***
  • Posts: 1714
  • Country: se
Re: 68HC11F1 setup questions
« Reply #18 on: July 29, 2022, 05:54:51 pm »
The Motorola M68hc11EVB board (68hc11A or 68hc11E) uses a 27xxx 16Kbyte UV EPROM.
As decoding logic (poor man PLA)? I'd be surprised!
Nandemo wa shiranai wa yo, shitteru koto dake.
 

Offline metertech58761Topic starter

  • Regular Contributor
  • *
  • Posts: 154
  • Country: us
Re: 68HC11F1 setup questions
« Reply #19 on: July 29, 2022, 06:53:39 pm »
Re: the /OE for the 2764, I was actually wondering about that. I'll see about putting that trace in the layout.

And looking at my build notes, the actual ICs on the board are HC and not LS. :) I'll update the schematic for accuracy.
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 3796
  • Country: gb
Re: 68HC11F1 setup questions
« Reply #20 on: July 29, 2022, 07:10:03 pm »
The Motorola M68hc11EVB board (68hc11A or 68hc11E) uses a 27xxx 16Kbyte UV EPROM.
As decoding logic (poor man PLA)? I'd be surprised!

No, not as decoding logic! I meant, the simplest solution I have ever seen is on the m68HC11-EVB board, where the /CS of the ROM comes from a 74HCxxx decoder that partitions the address space. I think it's the "poor man" solution ever, which works very well and it's easy to achieve.

Some other boards used a GAL or a simple programmable logic device (SPLD) instead of discrete logic ICs for the address decode.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline metertech58761Topic starter

  • Regular Contributor
  • *
  • Posts: 154
  • Country: us
Re: 68HC11F1 setup questions
« Reply #21 on: July 29, 2022, 11:10:00 pm »
The specific part for the 2732 is AM2732A-200 and the 2764 is MM27C64Q 200
 

Offline srb1954

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nz
  • Retired Electronics Design Engineer
Re: 68HC11F1 setup questions
« Reply #22 on: July 29, 2022, 11:51:44 pm »
The 2764 holds the actual firmware, while the 2732 handles the chip select (D0 = 2764, D1 = 6840 / 6821, D2 = 8279 on display board)

A GAL would be the preferred solution, sure, but I figure that a 1MHz clock should be slow enough that an EPROM would be an acceptable substitute?
Only if you are using fast EPROMs, 70ns or better. Otherwise your margins on setup and hold times are probably going to be insufficient for reliable operation.

The more usual decoder solution is to use a 3-line to 8-line decoder chip like the 74HC138 as its speed is adequate for systems such as this.

You really need to do a full timing diagram to check access times to each peripheral device. Particularly check the 8279 access times as this is an old and relatively slow chip.
 

Offline srb1954

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nz
  • Retired Electronics Design Engineer
Re: 68HC11F1 setup questions
« Reply #23 on: July 30, 2022, 12:12:21 am »
If it helps, here's a copy of the schematic of the board with the HC11. The 2732 serves as a chip select for the PTM and PIA, the 2764 has the firmware.
Ensure that all unused input only pins are tied to ground or supply as appropriate so that there are no floating input pins. Unused I/O pins should be programmed as outputs so they don't float.

This whole circuit could be simplified considerably if you transfer the timer (6840) and I/O (6821) functions back into the 68HC11F1 leaving only the external EPROM.

Using a another 68HC11 family member such as the 68HC711E9 would simplify the circuit even further by moving the program memory on-chip and operating in the single-chip mode. however, this makes program debugging more difficult without having an emulator or a evaluation board to allow easy program changes and external visibility of the program operation to a logic analyser.
 

Offline metertech58761Topic starter

  • Regular Contributor
  • *
  • Posts: 154
  • Country: us
Re: 68HC11F1 setup questions
« Reply #24 on: July 30, 2022, 12:57:27 am »
The original circuit used several 74xx gates to do partial decoding of the addresses. Trying to work out how to tweak the decoding to accommodate the the change from this bespoke MPU to the HC11 was complicated enough I thought about switching to a GAL, then I recalled working on some other boards in the past that used an EPROM for decoding.

I looked through my stash of EPROMs and it seems all of them are glacially slow at 200 or even 250nS. Rats. :(

I noticed the timer section on the HC11, but am not sure of the feasibility of implementing it.

The 6840 is set up so Timer 1 is a programmable delay (1/16 second per count), Timer 2 generates a steady 2.439kHz signal (this is fed to the XIRQ line), and Timer 3 generates a switchable 12.5kHz signal (signal carrier).

The 6821 has three lines under the interrupt routine's control (PA0-PA2), initialization signal (PA4 - output), contact closure checks (PB0-PB3), mode select (PB6), and keypress pending indication (PB7).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf