PlayStation+Xplorer+RaspberryPi Zero+Catflap

Start a log and update it occasionally with your projects progress
Post Reply
User avatar
danhans42
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 138
Joined: November 28th, 2012, 11:51 pm
I am a: Chocolate Labrador
IRC: danhans42
PlayStation Model: SCPH-7502
Location: Leeds, UK
Contact:

PlayStation+Xplorer+RaspberryPi Zero+Catflap

Post by danhans42 » November 5th, 2018, 6:43 am

This is something I have always wanted to get working, and dreamt about way back in 2012 when I got a RaspberryPi Model B at launch.

My current Xplorer setup used a HP thin terminal, which worked fine but the thin client was actually larger than the Playstation. With Arduino etc there was always going to be a cheaper solution but was never smart enough to get anything working. I did use Gregs xlinkusb for a bit but I really like the console redirection and that doesn't work with xlinkusb, nor is it currently open source.

Anyway, after a couple of weekends tinkering (and digging parts out of storage) I present....

Catflap running on a RaspberryPi, talking to a Xplorer via GPIO.

Works remarkably well but the level shifting is f**k ugly from an electronic engineering perspective so wont be releasing a schematic at the moment - its not properly buffered so could toast your Raspberry pi (it had 3.3v IO - the Xplorer is 5.5v)

I will design a board for it and release all the details shortly. Final goal is to have a Pi Zero had type board that plugs straight into the DB25 on the Xplorer, but also has a socket for serial connection (siocons or psxserial). I cant imagine it costing much to put together as my aim is to make this super cheap so everyone can join in.

I will then look at what else we can get running over on Linux and take it from there.. it should be fairly trivial to make a simple script that sends over an EXE via SFTP and executes it.

This is the setup thus far (forgive the mess of wires - dupont cables everywhere :D).
IMG_20181104_174142.jpg
Video of it in action

https://www.youtube.com/watch?v=Fm7mibMe3lo

So.. todo

Finalise schematic.. Already there but at the moment uses a TSSOP IC (massive pain to soldier) - might switch to 74 series logic as may be easier and fine for this application.

Credits - to follow. This is not all my work - its a combination of looking at other solutions for other problems and putting it all together so it works for our needs. Catflap etc was all written by someone else.

Also need a friendly way of installing this. Currently you need to build quite a bit from source and set up - will have a look at some sort of installer or a buildroot image eventually.

Help, comments, input etc all welcome as always - I wont be able to do much with it as I go on holiday for two weeks - but will look at getting a board designed and produced ready for when I get back. Ill try and learn Eagle while im away (provided my laptop works well in the sunshine).

Also, if anyone knows of any useful tools or has any source for some of the caetla tools I will look at porting these over and getting them built on Linux - if you can send me any links and will have a crack.
♥ PSX - http://psx0.wordpress.com

My collection - SCPH-102/SCPH-7502, Yaroze Modded PSone, PocketStation (Clear), 2x Xplorer Carts, 2x Xplorer Pro, 2x AR Carts (1 with Ezoray), GS Pro 3, ISA Comms Link Card. Various USB serial devices, Sharklink, xlinkusb, iMode Cable & other bits and bobs.

User avatar
gwald
1997 Yaroze Enthusiast
1997 Yaroze Enthusiast
Posts: 234
Joined: September 18th, 2013, 8:44 am
I am a: programmer/DBA
PlayStation Model: Net Yaroze
Location: Australia
Contact:

Re: PlayStation+Xplorer+RaspberryPi Zero+Catflap

Post by gwald » November 12th, 2018, 11:43 am

I have a v2 action replay, I'm guessing it's a lot harder to do the same with right?

User avatar
danhans42
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 138
Joined: November 28th, 2012, 11:51 pm
I am a: Chocolate Labrador
IRC: danhans42
PlayStation Model: SCPH-7502
Location: Leeds, UK
Contact:

Re: PlayStation+Xplorer+RaspberryPi Zero+Catflap

Post by danhans42 » November 13th, 2018, 2:11 am

Yeah it's harder with the AR's.. you need to use a hardware latch and whatnot and completely different software, way beyond my capabilities. The above will work with an Xplorer/Xploder device only.

That being said, if someone could get the Linux port of catflap to work with Freewing hardware again, you would be able to do it that way and you could probably omit some hardware out of the circuit. I won't be doing that though.

This could work with the standard Xplorer ROM if someone could write something for Linux that used ppdev.. it would work on the above and on a regular PC.
♥ PSX - http://psx0.wordpress.com

My collection - SCPH-102/SCPH-7502, Yaroze Modded PSone, PocketStation (Clear), 2x Xplorer Carts, 2x Xplorer Pro, 2x AR Carts (1 with Ezoray), GS Pro 3, ISA Comms Link Card. Various USB serial devices, Sharklink, xlinkusb, iMode Cable & other bits and bobs.

User avatar
danhans42
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 138
Joined: November 28th, 2012, 11:51 pm
I am a: Chocolate Labrador
IRC: danhans42
PlayStation Model: SCPH-7502
Location: Leeds, UK
Contact:

Re: PlayStation+Xplorer+RaspberryPi Zero+Catflap

Post by danhans42 » November 25th, 2018, 3:15 am

Quick little update...

Have decided to get a version one off my protoboard and onto a proto-hat so I can try and simplify/improve it.

At the moment its just a set of 16 level shifters (3.3v RPi Zero to 5v PSX). I am seriously useless at PCB design so that may well be a way off, but this is a rather nice compact start.

It uses those foxconn ribbon cables that are used for breaking a parallel port out from a motherboard. The zero is attached to the back of the xplorer with velcro, that is attached to the blanking plate from the PSX parallel port. Looks quite tidy
20181124_155614.jpeg
Ill get this bit finished and get a schematic and a guide up.
♥ PSX - http://psx0.wordpress.com

My collection - SCPH-102/SCPH-7502, Yaroze Modded PSone, PocketStation (Clear), 2x Xplorer Carts, 2x Xplorer Pro, 2x AR Carts (1 with Ezoray), GS Pro 3, ISA Comms Link Card. Various USB serial devices, Sharklink, xlinkusb, iMode Cable & other bits and bobs.

User avatar
danhans42
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 138
Joined: November 28th, 2012, 11:51 pm
I am a: Chocolate Labrador
IRC: danhans42
PlayStation Model: SCPH-7502
Location: Leeds, UK
Contact:

Re: PlayStation+Xplorer+RaspberryPi Zero+Catflap

Post by danhans42 » December 7th, 2018, 8:35 am

I wrote a guide for the software side of things. The schematic is to follow.

I have tested this as a run through yesterday on a Pi 3B+ and had previously tested this on a Pi Zero and ZeroW. It assumes a little linux/raspberry pi knowledge but still should cover most of the basics.

Catflap works perfectly. With the schematic I will post code upload is fast, but I am sure its slower the gregs xlinkusb. Ill get some speed tests up soon. Other functions in catflap seemed to work other than the console mode :- i tested a gameboy emulator and psxbasic , pccdrv: redirection and stdio input over the console didnt work. Output seemed to work fine though.

I will keep revising this guide as well as the schematic and link to the current in the first post.

Raspberry Pi Setup For GPIO Parallel Port/Catflap4linux

Step 1 - Basics

Get and write the latest Raspbian image to an SD card - any new version works (http://raspberrypi.org/), I have used on both Stretch Lite and Stretch with Desktop. Then you can connect to your Pi using SSH or just using a terminal on the Pi. I won’t cover the basics such as network setup as its covered pretty well elsewhere.

Be aware that by default Raspbian doesn’t allow access to SSH unless you enable it. The easiest way is to create a file in the FAT partition (or boot folder) called ‘ssh’. This will then enable it.

Step 2 – Initial Config

Once you are sorted and logged into a terminal you need to make sure of some settings. We can do this through raspi-config. This is pretty standard stuff but will cover it here just in case.

Code: Select all

$ sudo raspi-config
Firstly, go into the submenu Interfacing Options and disable automatic loading of both SPI and I2C interfaces.

Next, go into Advanced Options and select expand filesystem.

Whilst here you are in raspi-config, you may as well check everything else – WiFi region etc. Once you have finished go back and then save and exit. When prompted to reboot answer yes.

Step 3 – Updating & Required Packages

As we are building kernel modules from source, we need to ensure that Raspbian is up to date.

Enter the following to do this:-

Code: Select all

$ sudo apt update && sudo apt upgrade
Answer yes when prompted.

Once completed we can then install the Linux kernel headers and Git

Code: Select all

$ sudo apt install raspberrypi-kernel-headers git
Once apt has finished getting the two packages we can start to grab the sources we need. We are going to get the pi-parport code and also the catflap4linux code. To do this enter the following:-

Code: Select all

$ git clone https://github.com/garlick/pi-parport.git
and

Code: Select all

$ git clone https://github.com/hkzlab/catflap4linux.git
Once completed you should have two folders in your home directory : catflap4linux and pi-parport.

Step 4 – Compiling the Device Tree Overlay

Build the device tree overlay.

Code: Select all

$ cd pi-parport/dts

Code: Select all

$ make && make install
The files are now copied to the overlays folder in the /boot partition. To ensure the overlay is loaded on boot, add it to the config:-

Code: Select all

$ sudo nano /boot/config.txt
Then scroll to the bottom of the file and add the line :-

Code: Select all

dtoverlay=parport-gpio
Save and exit nano (press CTRL+O followed by CTRL+X) and reboot.

Code: Select all

$ sudo reboot
Once rebooted, log back in.

Step 5 - Building The Kernel Modules

Go into the driver folder and then compile the kernel modules.

Code: Select all

$ cd pi-parport/driver

Code: Select all

$ make
If everything compiled successfully you should now have 4 kernel modules in the driver folder lp,parport,parport_gpio and ppdev .

The module 'lp' is not required, it's a line printer driver which we will not be using. The three required modules can be tested with insmod.

Code: Select all

$ sudo insmod parport.ko

Code: Select all

$ sudo insmod parport_gpio.ko

Code: Select all

$ sudo insmod ppdev.ko
And check they have loaded successfully.

Code: Select all

$ dmesg
Output should be something like:-

Code: Select all

[    2.533826] parport: loading out-of-tree module taints kernel.
[    2.539911] parport0: data on gpio pins [22,23,24,10,25,9,8,11]
[    2.539924] parport0: status on gpio pins [18,17,4,3,2]
[    2.539942] parport0: control on gpio pins [26,19,6,13]
[    2.539946] parport0: hd on gpio pin 20
[    2.539950] parport0: dir on gpio pin 21
Step 6 – Loading modules on boot

Firstly, make a folder for the modules. To ensure they are in the matching folder for the kernel we are running, use the following command:-

Code: Select all

$ sudo mkdir /lib/modules/$(uname -r)/ppdev
Secondly, copy the modules to the folder we just created:-

Code: Select all

$ cp *.ko /lib/modules/$(uname -r)/ppdev
Run depmod so they can be detected:-

Code: Select all

$ sudo depmod -a
We want the modules to load on boot, so we need to add them to /etc/modules.

Code: Select all

$ sudo nano /etc/modules


Add the three modules to the end of the file, one on each line, eg:

Code: Select all

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

parport
parport_gpio
ppdev

If still present, you can remove or comment out both i2c-dev and spi-dev if they are as we don’t need them.

Save and exit (press CTRL+O then CTRL+X). Then reboot again:-

Code: Select all

$ sudo reboot
Step 7 – Check and Set Permissions For /dev/parport0

Once Rebooted check the modules have loaded.

Code: Select all

$ dmesg

See the same lines from earlier? That means everything has loaded correctly. The last bit is to add the user ‘pi’ to the group ‘lp’. This means the parport0 device can be accessed without using sudo. If your username differs, substitute ‘pi’ for your login.

Code: Select all

$ sudo adduser pi lp
To see the changes to the group, logout and back in again:-

Code: Select all

$ logout
Step 8 – Compiling Catflap4linux

Login again after rebooting. Build the catflap4linux sources :-

Code: Select all

$ cd catflap4linux

Code: Select all

$ make
Stick the compiled binary into a folder :-

Code: Select all

$ sudo cp catflap /usr/local/bin
Now, lets test the access to the parport0 device and catflap:-

Code: Select all

$ catflap reset

If you haven’t yet built the adapter, catflap will eventually timeout. If you are lazy just press CTRL+C to exit. Otherwise, the PSX should reset and the output will be like below. If so, all done 😊.

Code: Select all

pi@raspberrypi:~ $ catflap reset

+------------------------------------------------------------+-------+
| CatFlap for Linux           (Control for PSX & Caetla ROM) | v0.01 |
+------------------------------------------------------------+-------+

Internal CCaetla Class version 2.36
Initializing Caetla...
Initializing device /dev/parport0 ...
Resetting PSX...

Notes

Schematic is currently separate – currently using some hacky bidirectional level shifters, but they work well. Also, the strobe signal is omitted as its not required. I would recommend visiting the pi-parport github if you want to do a full parallel port.

Credits
  • Jim Garlick – Amazing work on building a parallel port for the Raspberry Pi. Please visit his github for the source and the PCB files. He has two versions on his site which are designed to give you a complete parallel port that will drive printers etc. https://github.com/garlick/pi-parport
  • Fabio Battaglia – For porting over catflap to linux using ppdev. https://github.com/hkzlab
  • Intar Technologies – No idea who they are or were, but thanks for the original version of Catflap!
♥ PSX - http://psx0.wordpress.com

My collection - SCPH-102/SCPH-7502, Yaroze Modded PSone, PocketStation (Clear), 2x Xplorer Carts, 2x Xplorer Pro, 2x AR Carts (1 with Ezoray), GS Pro 3, ISA Comms Link Card. Various USB serial devices, Sharklink, xlinkusb, iMode Cable & other bits and bobs.

User avatar
danhans42
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 138
Joined: November 28th, 2012, 11:51 pm
I am a: Chocolate Labrador
IRC: danhans42
PlayStation Model: SCPH-7502
Location: Leeds, UK
Contact:

Re: PlayStation+Xplorer+RaspberryPi Zero+Catflap

Post by danhans42 » December 7th, 2018, 9:24 am

As well as getting the above written up, I've switched from a Pi ZeroW to a Pi3B+.

Main reason being there are a few forks of dosbox that have extra features, one of them being direct parallel port emulation. I want to give that a try and see if it works and for that a 3 is much better than the Zero for compiling from source. If that works out can try the original Xplorer tools with the original Xplorer ROM, as well as the original caetools

Also, I wanted to compare speeds. I will get the schematic up in the next few days. Basically it comprises of two cheap 8 bit bi-directional level shifters and basically just hook up each signal through them (RPi on the Low voltage side, pax on the high). Connect GND from both sides, and you can get 3.3 &5v from the GPIO header. The pin assignments are in both the code and can easily be worked out from the schematics that are on the pi-parport GitHub.

Ideally, the v1 that I've done isnt ideal. So am looking to improve it using some 74HC something or other. The ideal was to be able to use DIP so it's easily bread boardable or built on a proto HAT.

Next step is to see what perfomance is like with different types of level shifting.
♥ PSX - http://psx0.wordpress.com

My collection - SCPH-102/SCPH-7502, Yaroze Modded PSone, PocketStation (Clear), 2x Xplorer Carts, 2x Xplorer Pro, 2x AR Carts (1 with Ezoray), GS Pro 3, ISA Comms Link Card. Various USB serial devices, Sharklink, xlinkusb, iMode Cable & other bits and bobs.

User avatar
Shadow
Admin / PSXDEV
Admin / PSXDEV
Posts: 2174
Joined: December 31st, 2012, 5:37 pm
PlayStation Model: H2000/5502

Re: PlayStation+Xplorer+RaspberryPi Zero+Catflap

Post by Shadow » December 10th, 2018, 3:52 am

Does this work with PSEXE.COM and do printf's work?
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

Development Computer: Windows 98, Pentium 3 [400MHz], 128MB SDRAM, DTL-H2000, DTL-H201A, 21" Sony Trinitron CRT, CD-ROM burner, 3.25" and 5.25" Floppy Diskette Drives and a ZIP 100 Diskette Drive.

User avatar
danhans42
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 138
Joined: November 28th, 2012, 11:51 pm
I am a: Chocolate Labrador
IRC: danhans42
PlayStation Model: SCPH-7502
Location: Leeds, UK
Contact:

Re: PlayStation+Xplorer+RaspberryPi Zero+Catflap

Post by danhans42 » December 10th, 2018, 7:00 am

I'm currently looking at dosbox-x. That supports directlpt emulation through ppdev. This project provides ppdev so catflap4linux will work, so as long as I can get dosbox-x compiled properly, you should be able to use the original k-comm tools such as psexe, psxkiller or anything that works in DOS - hopefully.

As for printfs I'm not sure, I'd be inclined to say no. The kernel messages come though, but nothing directly from the program that is running. That could be just the demos and psxbasic.

I'm pretty sure if they were working psxbasic should have given me a prompt to be able to type a command, but it didn't. Ill try a hello world example and post back. If not it's a limitation of the Linux port of catflap. I've raised an issue on its GitHub but haven't had a reply.

EDIT: See attached screenshot.. (from my phone) and see the hitmod text.. maybe it does support it, I'm just pretty sure it doesn't support getchar and that kind of thing. PCDRV definitely doesn't work like it does on the original windows catflap.
Attachments
Screenshot_20181209-200656.png
♥ PSX - http://psx0.wordpress.com

My collection - SCPH-102/SCPH-7502, Yaroze Modded PSone, PocketStation (Clear), 2x Xplorer Carts, 2x Xplorer Pro, 2x AR Carts (1 with Ezoray), GS Pro 3, ISA Comms Link Card. Various USB serial devices, Sharklink, xlinkusb, iMode Cable & other bits and bobs.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest