Keyboard Shortcuts
Likes
Search
NVRAM with Z80MC
On Wed, Apr 9, 2025 at 04:07 PM, Kerem Kapkin wrote:
ST M48Z35 That's a 32K byte part. similar to 62256 as used on CPU card.
The SIO board comes with 64K byte part.
?
They can be used if pinout matches as "battery backed" Ram
which is what they are.
?
I have used them for other systems, be wary as the battery in
it does fail with time.? Experience is? 4-8 years.
?
-Can it be used besides Micro-Basic?
?
Yes, it runs CP/M and there are at least 15 different basics including
at least two Basic compilers ( I use M$-Bascom and matching
interpreter).? ? Also using CP/M it can easily run other available
languages, and a raft of other software.
?
?
Allison |
Hi Allison, I have been researching how to preserve the CPU state before power down and restore on Z80 while using NVRAM without any luck. How would that be done on the Z80 membership card? If I understand correctly, if it is a CMOS Z80 vs NMOS Z80, it is done automatically. I am not sure if the Z80 on my MC is CMOS or NMOS. Perhaps that section of the Z80MC user manual can be expanded to include set up and use cases with NVRAM. If I can figure this out, I don’t mind providing the first draft notes. Thank you, Kerem On Thu, Apr 10, 2025 at 11:02?AM ajparent1/kb1gmx via <kb1gmx=[email protected]> wrote:
|
Its done in programming.? I do not mean in BASIC.
?
Preserving the CPU state means writing all of the registers, internal? flags,
and interrupt status, to protected ram.? Fairly easy but the on startup
(aka reset) the first code in rom has to restore all that and then continue
where the CPU was stopped on power down.? That also means the state
of hardware like serial IO.? So power down is not something to be
allowed to happen randomly and power must be maintained for some
amount of time to permit the needed programming to complete.
?
However all this interacts with the design of hardware so if power down?
happens at a random point then saving all that before the power is
collapsed completely is problematic.
?
This takes a fair amount of understanding how Z80 works and how
the circuitry around? it has to work to support it.? Generally the z80MC is
not going to make all that easy for you.? It would add features not
planned for or typically expected.? that and the built in code in rom
would have to change.
?
So the best you can hope for is that ram only holds the program and?
basic will allow you to access it on startup (many can do that).? In that
case your treating memory during power down as a rom.
?
Also you unclear on what you wish to accomplish and the question
is not clear.? ? It also suggests working with hardware ie: ram, Eprom,
and IO chips is new and unfamiliar.? My early (1970s) experience was
opposite of that I had to build hardware, understand how that
works and then write code in assembler as little to none was
available (no Basic!).? ?That lead to the need to understand the
interaction of code and hardware.? ?Programming? on the bare metal.
People? brought up with PCs rarely, if ever, do that.
?
I hope this helps to answer your question. Or ask more questions.
?
Allison |
To add to this a bit, assume that the loss of power is unpredictable. The Z80 needs to know when a power loss occurs in order to be able to “save state” (i.e. the registers, etc.). The z80 has a non-maskable interrupt that could be triggered by the power loss through another circuit. The NMI vector would point to the save state code. But then, how long do you have to save the state?? You’d need to figure out how long it takes for the power to drop to a point where the chips stop operating (let’s say that’s 4.8v), but that timing depends on power consumption and supply voltage.? Then you can calculate how many instructions can execute in that time period, and hopefully that’s enough to save the CPU and hardware state. At 4mhz, the instructions take anywhere between 1us and about 6us. So, its “just math” so to speak.? On power-up, you’d check a flag to see if the state was successfully saved and either re-load it or start fresh.? NVRAM supervisory chips can sense the power fail and trigger the interrupt. I have?not tried this, but that’s the theory on how it could work but as Allison said, it’s both a software and hardware solution.? Rich On Thu, Apr 10, 2025 at 17:09 ajparent1/kb1gmx via <kb1gmx=[email protected]> wrote:
|
Rich,
?
That can work IF the fail rate is slow enough from initial 5V to trigger
level to assure enough work (save state).? Very iffy and depends on
precision in the supervisory device.? Also those NV-rams have their
own power fail so writing to them could be locked out.? ?The
general assumption with most supervisory chips is assuring
power good before releasing reset.? ?Less so for power fail (unsafe).
?
The big boys (DEC, DG, IBM, and others) did it by first detecting
when?main power fails (AC power) or has decayed below acceptable
limits.? That is used to provide POWER-FAIL or some similar named?
control voltage.? The also provide a set of signal to say DC-GOOD.
That is then used to trigger high priority interrupt, or in the case
of Z80 NMI (non maskable interrupt).
?
This is all assembly language work.
?
I've built systems that do the latter as most (many) supervisory
circuits have boundary cases that may fail.? Harder than it looks.
as then the power supply must have enough "hold" time before
it completely fails to regulate.? The system I still have uses the
raw DC side that is typically 6-8 volts higher than DC out (5V bus).
That gives early warning of potential power fail and? assert
NMI.? ?That was an analog supply with some larger caps to
store enough for 80-100 milliseconds of known good
regulated output.? Typically a NMI routine that preserves
state is under a few milliseconds then it self halts before
power fail.
?
Start up is a Debug monitor system with option of
restore-resume in an orderly way or do a cold start.
?
An alternate way is to have the CPU turn itself off.
Simple push button to NMI makes the system? go to
a quiescent state (stop the machine or finish disk write)
then store its state and under program control
VIA IO port (relay or electronics switch) turn off
the power.
?
The latter is used for many cases as power fail is a?
random event that may have impacts (in robotics?
you need all stop, in an orderly way!) where power
off can be a user command (or event) with
orderly shut down.
?
Startup can be restore and run or cold start depending
on system and potentially establishing? external states
for external hardware or mechanics before resuming
operation but that is a system level consideration like
a machine tool or robotics application.
?
Its a system level application or use situation programming
with hardware to support it.
?
?
Allison
? |
Kerem,
?
Makes no difference if the CPU is Cmos or Nmos as the bigger
difference is overall power consumed, usually it is only part of
the systems power needs.
?
The z80MC only senses power good where it de-asserts /Reset on
power on after delay.? It has no power fail or DC good sensing.
?
NMI is available but what action it causes is define in eprom
and likely not directly usable.? ?Asserting NMI causes a handler
to do effectively nothing as Bigboot has no specific use for it.
?
Start with the Z80 user manual (mostec or zilog) to understand
how the chip works.? All of this is close to the iron work so
understanding the CPU and how its used in the hardware
environment becomes the task.? The Z80MC and Basic manuals?
cannot even attempt to cover this or could if it were larger
than 200 pages.
?
The reason nothing was found for saving the CPU state or
restoring it as its assembly programming 101.? That and
likely the question asked would mislead most search engines
(AI or not).? It is not something that is unusual or rarely done.
Most Debugger software has it wired in.? Its also sometimes
called a Context Save or interrupt programming.
?
Generally the Z80 MC is many levels above those early days
of Altair where limited ram, no rom, dumb front panel,
no IO,?no software was the then context for users.? To do
anything you hand coded assembler and hand entered
a byte at a time.? Doing computers ca1975.
?
?
?
Allison |
Thanks Allison and Rich for your?responses and guidance. I have more learning to do until I can figure out how to replace the RAM with NVRAM on the CPU board, if ever practical. In the meantime, I explored available NVRAM options for direct pinout replacement of the SIO card RAM but nothing seems to work which potentially could resolve the power up and down issues by having the NVRAM in banks of the SIO card instead of CPU card RAM. Regards, Kerem On Fri, Apr 11, 2025 at 12:25?PM ajparent1/kb1gmx via <kb1gmx=[email protected]> wrote:
|
Since most of the boards and parts are CMOS running the whole thing off a
battery and switch mode regulator (for power conversion efficiency) would
be easiest.
?
For mine that means replacing the 8250 with 16C450 and the ttl parts with CMOS.
Everything else save for leds and display are CMOS.?
?
The FP (display) and SIO (8250 and TTL) boards are the highest power consumers.
?
I've built a few all comos systems (both z80 and 80C85 based) and I can get the
power under 30ma @ 5V without effort with the system running CP/M and
application.? I use those for monitoring things (data logger) where run time on
battery needs to be greater than a full week (24x7).
?
?
Allison |
I've been travelling (to VCF-East) and so have missed the start of this thread. But in general... ? The Z80MC CPU board can be run all by itself. It's all CMOS, and draws so little current that I can run it on just the power from my RS-232 adapter. It has diodes from the two PC handshake lines and serial output to a filter capacitor. When my modem program sets the handshake lines high, it delivers 10-15mA, which is more than enough to power the 5v regulator and board. ? You can use a NV RAM, but they generally write-protect themselves before the Z80 and related circuitry crashes from falling power. Thus whatever your program was doing when the power fails will crash. ? As Allison noted, you can use NMI to warn the Z80 to save its state. You'd need a little circuitry to detect when the input to the 5v regulator is getting low, and pull the NMI pin low. Write an NMI interrupt handler to save the state in your NV RAM. It could be an old 60 Hz transformer-rectifier power supply that normally delivers about 8-10vdc. When it falls below about 6vdc, it pulls the NMI pin low. ? The Front Panel uses the most power when the LEDs are active. If the Z80 stops handling interrupts, it times out and blanks the display; so standby power is pretty low. ? When I can find them, I provide 16C450's for the SIO card. It's CMOS, and so draws a lot less power than the 8250. (The 16C550 won't work.) If you have an SD-card, the NMI handler could save the state on the SD-card. ? Since total power consumption is pretty low, the simplest scheme might be to simply power everything from a modest size battery. ? Lee ? -- Excellence does not require perfection. -- Henry James But it *does* require attention to detail! -- Lee Hart -- Lee A. Hart |
Lee,
?
Even with NMOS 8250 and the few TTL pieces the total power is quite small
and a battery plus 5V SMP regulator will produce very long run times before
battery goes too low.
?
Haven't measured it (as all up stack) as yet but I'd expect with parts as are
supplied under 140mA at 5V which is easy to deal with for battery unless
extended operating life is needed.
?
When compared to the Z80 S100 crate with 64K ram dual serial and
FDC and two FD55GF drives (5V at 6A, 12V 1.5A ,and -12 at .20ma) the
Z80MC is power frugal.? ?FYI that was a built in 1980 system and?
no CMOS.? The other S100 crate, very full, has a 8V 25A supply for
the 5V regulator input bus and a somewhat noisy fan to cool the
boards.? ?So something like the Z80MC is way lower power needs.
?
I have lower power Z80 CMOS systems that are built to be very
low power. its needs are clock speed dependant.? About 10ma
at 4mhz and under 3ma at 1mhz.??
?
?
Allison |