Tuesday, 7 July 2020

6502 CPU Computer - Reset Remote


This blog entry describes a minor change to my 6502 based CPU computer.

A re-worked Power-On-Reset, with manual reset and remote control reset function.


1. Power-on-reset uses NE555 timer

2. Manual reset function, press button switch triggers NE555

3. Remote reset function performed by a connected Raspberry Pi

 

Project History:

When I put together my 6502 based computer, my initial power-on reset circuit was based on the NE555 together with a manual reset switch, all mounted on the same board as the main CPU 6502 and system clock. The positioning of the manual reset button wasn't best placed.

I changed the main CPU board to one with just the 6502 and system clock. A smaller reset board was made as a standalone board. Although it worked, and was more convenient to operate I didn't like the fact that the reset circuit was separate from the main backplane (bus).

In my earlier experiments I connected the serial/USB interface from the 6502 ACIA serial port to a RaspberryPi  and used 'screen' in a terminal to interact over serial with the 6502 monitor. Additionally, using my Windows based PC I remotely accessed the RaspberryPi over my network using SSH and running 'screen'. With the RaspberryPi connected to the 6502, being able to work on the 6502 remotely was something that appealed, especially sitting in a different (more comfortable) location in the evening from my where the 6502 resides ('workshop').

When working on the 6502 computer I sometimes cause a crash, so remotely, I now need to perform a reset.

To perform a remote reset I made a connection from a GPIO pin on the RaspberryPi to the new reset board. I wrote a small python script to toggle the GPIO high & low, timing similar to the NE555 reset function. Both the NE555 and RaspberryPi connect via a 2-input NOR gate, so that when either input go high, the output (reset signal) goes low.

Now I can SSH to the RaspberryPi, use 'screen' to operate the 6502 monitor. If I 'crash' the 6502, I just start another SSH session to the RaspberryPi and run the reset python script. The monitor prompt then re-appears in the 'screen' session.

 

The circuit diagram together with veroboard layout is below.

Reset-Remote Circuit & Board layout

The final constructed board, with connection pins to plug the reset board into the 6502 CPU backplane:

Constructed reset board

The reset board now plugged into the backplane:

Main CPU - Reset board plugged into backplane


The Python script listing is below - I named this file Reset6502.py :

# python v3 script to create a single +ve 'reset' pulse on
# GPIO pin (BCM17), actual hardware pin 11,
# connected to pin 3 of dual input NOR gate.
# When pulse is sent, NOR gate output goes LOW for 0.5 secs.
# NOR gate output connects to 6502 RESET pin, providing a -ve going
# pulse to reset the 6502 CPU when remote working

import RPi.GPIO as GPIO
import time
#set individual GPIO outputs to HIGH or LOW
GPIO.setwarnings(False)         #disable warning messages
GPIO.cleanup()
GPIO.setmode(GPIO.BCM)
port = int(17)
GPIO.setup(port,GPIO.OUT)    # set port as output
GPIO.output(port,GPIO.LOW)  # initialise port low
length = float(0.1)                 # +ve reset pulse
GPIO.output(port,GPIO.HIGH)
time.sleep(length)
GPIO.output(port,GPIO.LOW)
GPIO.cleanup()

===============================

I also created an alias to run the python script at any location when logged onto the RaspberryPi.

Steps to make an alias on the RaspberryPi:

change directory to /usr/local/bin

make a new file

sudo nano 6502-reset.sh (or filename to suite)

in the nano editor enter the following:

#!/bin/bash
echo "Resetting the 6502..."
python3 /home/pi/GPIO_programming/Pulses/Reset6502.py (or location of reset script)

save file from nano and exit

enter:

sudo chmod +x 6502-reset.sh (this makes the file executable)

You'll need to logout of the RaspberryPi account and log in again to pickup the new alias script.

To run the script enter:

6502-reset



No comments:

Post a Comment