User Tools

Site Tools


microvax_mem_test

Install serial:

pip install pyserial

Run the script:

python vax_mem_full.py

Script:


import serial
import time
import re

# Increase timeout and use a slightly slower baud rate if 9600 is flaky, 
# but 9600 is usually standard.
ser = serial.Serial('/dev/ttyS0', 9600, timeout=1)

def vax_io(cmd):
    # 1. Clear the buffer so we don't read old garbage
    ser.reset_input_buffer()
    
    # 2. Send the command with a Carriage Return
    ser.write(f"{cmd}\r".encode())
    
    # 3. Wait for the VAX to finish. We look for the '>>>' prompt.
    timeout = time.time() + 2  # 2 second safety timeout
    full_resp = ""
    while ">>>" not in full_resp:
        if ser.in_waiting > 0:
            full_resp += ser.read(ser.in_waiting).decode(errors='ignore')
        if time.time() > timeout:
            break
        time.sleep(0.05)
    
    return full_resp

def test_onboard_full_map():
    start = 0x00300000
    end = 0x003FFFFF
    error_count = 0
    
    print(f"--- Mapping Entire Onboard RAM (4MB) ---")
    
    # We'll use a slightly larger step (e.g., 1KB) if you want a fast map,
    # or keep it at 4 to check every single longword.
    for addr in range(start, end, 4):
        addr_hex = f"{addr:08X}"
        
        # Test pattern: All zeros then all ones
        for pat in [0x00000000, 0xFFFFFFFF, 0xAAAAAAAA, 0x55555555]:
            pat_hex = f"{pat:08X}"
            
            vax_io(f"D /L /P /U {addr_hex} {pat_hex}")
            resp = vax_io(f"E /L /P /U {addr_hex}")
            
            match = re.search(r"P\s+[0-9A-F]+\s+([0-9A-F]+)", resp, re.IGNORECASE)
            
            if match:
                received_val = match.group(1).upper()
                if received_val != pat_hex:
                    error_count += 1
                    print(f"\n[!] ERROR at {addr_hex}")
                    print(f"    Expected: {pat_hex} | Recv: {received_val}")
                    
                    # If we get too many errors, the board might be totally dead
                    if error_count > 100:
                        print("\n[!!!] Too many errors! Likely a controller or bus failure.")
                        return

        if addr % 0x1000 == 0:
            print(f"Mapping... {addr_hex} (Errors found: {error_count})", end='\r')

    print(f"\nScan Complete. Total errors logged: {error_count}")

# Clear the screen on the VAX first
vax_io("\r")
test_onboard_full_map()
microvax_mem_test.txt · Last modified: by admin