Wednesday, March 5, 2025

Enhanced Virtual 2315 Cartridge Facility to gracefully handle abrupt power down of the 1130 system

SCENARIOS THAT I HAD TO ADDRESS

Imagine that the system is up and running, with software running on the IBM 1130 that is writing changes to the disk cartridge. If the building power fails, the Virtual 2315 Cartridge Facility (V2315CF) would have the disk drop out of ready but all data changed during the session would be stuck in SDRAM in the V2315CF and not rewritten to the SD card. Thus, perhaps hours of work would be lost.

In fact, even if the operator finished up a session by switching off the physical disk drive switch, the data would remain inside the V2315CF until the Load/Unload switch was moved to Unload. If the operator forgot that step and later powered down the machine, the same loss of the day's work would happen. 

An even more pernicious failure might occur if the V2315CF box had its switch turned to Unload but was in the middle of rewriting the file on the SD card when power abruptly dropped or the operator flipped the 1130  power switch off. The cartridge image would be truncated and therefore unusable. 

TWO ELEMENTS WERE NEEDED TO GRACEFULLY TOLERATE THOSE SCENARIOS

The V2315CF must have sufficient power to recognize an outage and complete rewriting the updated data from the SDRAM into the SD card file, before it stops working. Secondly, it must be able to recognize that the power has failed even though it has the reserve power from the first element allowing it to continue running for a bit of time. 

A motorcycle lead-acid battery with a battery trickle charger/maintainer will be the easiest way to provide the reserve power needed to gracefully wrap up what it is doing including rewriting if a cartridge was unloaded. The charger/maintainer can be continuously connected to the battery without doing any harm, as the microprocessor inside the maintainer only issues pulses of charging when the battery charge drops below full. 

A diode between the IBM 1130 +12V supply and the V2315CF facility isolates the reserve power such that it only flows into the V2315CF. However, a connection from the 1130 side of the diode gives us a way to detect when the 12V has dropped. A simple transistor circuit converts the 12V into a pulldown of a general purpose IO pin on the PICO processor.

Fortunately for me, George Wiley had a spare pin (GP5) which was routed to a connector JP27 on the main board. Thus, I only need to wire that to an NPN transistor that conducts whenever the +12V from the 1130 is present. 

CHANGES MADE TO THE STATE MACHINE IN THE PICO

The state machine in the PICO is what determines when and how we load, unload and rewrite cartridge images. It must check for the power outage and immediately unload any cartridge that is active. It also must unload a cartridge if it is in the pre-ready stage where it was loaded into SDRAM but the physical disk drive has not come ready yet. 

When it unloads the file, the physical Load/Unload switch remains in its Load state. We have no way to force the switch off, but we can ignore it for the transition from idle to begin loading a cartridge. Thus, before we look at the Load/Unload switch, we check to see if there is a power outage and do nothing when that is true. 

At worst case, if the switch remains physically set to Load, at some later time with the IBM 1130 system is powered up by an operator, the virtual cartridge will load, waiting for the disk drive to come ready. The operator can always turn the switch to Unload if they want to plug a different virtual cartridge into the V2315CF, otherwise it is ready when the disk is turned on. 

TESTED WITH A JUMPER WIRE 

I did some initial testing of the changes to the state machine. I hooked a jumper wire between connector J27 and a ground connector on the V2315CF. That is the state it will assume when there is +12V power from the IBM 1130. The system came up and ran normally. I disconnected the jumper at various times to see how it behaved. It did immediately unload any cartridge that was in SDRAM, then refuse to acknowledge the Load position of the Load/Unload switch until I reconnected the jumper. 

2 comments:

  1. Doesn’t the 1130 power supply do a graceful shutdown if external power is removed suddenly?

    ReplyDelete
    Replies
    1. It is graceful relative to removing power in a sequence, but blazingly fast. Not long enough for an SDRAM image to be written back to SD card file.

      As soon as power drops, a relay opens disconnecting the +48 and +12V supplies from the rest of the machine.
      Among other things, this very rapid disconnect ensures that junk data is not written to core memory. It also disconnects solenoids that trigger various mechanical movements in peripherals.

      The +3, -3 and +6 supplies drop but not as precipitously.

      Since the large capacitors in the 12V supply are removed from the consuming circuits by relay contacts, the voltage drops steeply.

      I believe I need to provide 10 to 15 seconds of full operation to the emulator box in order for it to unload the cartridge image from SDRAM - reading each word, writing it from FPGA to PICO, then writing to the SD Card file.

      About 6 Farads of buffer capacitor at the box would have given me that time, but achieving that capacity at upwards of 20V (to cover transients from the mostly unregulated 12V supply) becomes very expensive using supercapacitors.

      Inside a big heavy machine like the 1130, a motorcycle battery and charger/maintainer are inexpensive and a mere rounding error on space and weight.

      Delete