Thursday, December 20, 2007

Interfacing with the PSP Remote port



(click on the image above for bigger view)


DISCLAIMER:

THE INFORMATION ON THIS AND RELATED PAGES/FILES IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE.

THE ENTIRE RISK AS TO THE ABILITY TO USE ANY OF THE INFORMATION PROVIDED HERE TO INTERFACE WITH THE REMOTE PORT OF A SONY PORTABLE PLAYSTATION (PSP) IS WITH YOU. SHOULD ANY OF THE INFORMATION PROVE INACCURATE OR ERRONEOUS, THE AUTHOR OF THIS PAGE IS NOT LIABLE AND YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.


DESCRIPTION:

o Overview

As already revealed here and here, the Remote port of the PSP is in fact a serial port, and the remote is being handled through a standard RS232 protocol, albeit using [0,+2.5V] voltage instead of [-12,+12V]. Therefore the question is; is it possible to connect the PSP remote port to a PC serial port? The answer is yes!
Of course, you can NOT plug a PSP directly into a PC serial port (unless you want to fry it beyond repairs), but with a simple serial line converter this is no trouble at all, and you can then exploit a standard serial port out of the PSP.
The purpose of this page is to explain how to do this.

o Why is having serial communications between a PSP and a PC an interesting feat?

This is interesting because it can provide us with a very wide array of facilities:
- Debug output for application development:
This is already happening - Check out the excellent PSPLink by TyRaNiD!
- Serial console for any Linux port (a must have device indeed!) or any other applications
- The serial protocol is a simple, well known and robust protocol, with loads of existing applications ready to be used. You could even use a PSP for dial up access or GPS!
- Hijacking the UART4 PSP driver to use the Remote UART might give us access to the low level debug functions of the PSP without the need to tear it apart in order to access the internal UART4
Also:
- The remote is a very optional device for the PSP => it can be used for other purposes (eg. debug) without interfering with standard operations (USB, WiFi, ...)
- As a serial device, IRDA could be used as well, but not everybody has an IRDA receiver. On the other hand, almost every computer out there has a serial port (sorry Mac users - this is the one thing that Apple did get wrong!)
- The cable is very inexpensive/simple to build (see below), and not doubt someone out there will be selling ready made cables for the PSP at some stage
- Rumoured additional capabilities of the Remote Port like re-flash (this is very doubtful, but who knows...)
- The Remote driver is probably the best driver to experiment with for development (low footprint, simple, loads of serial code samples out there)

Of course, at the moment, the only use we have for this serial port is to emulate the PSP remote, but this is likely to change in the future.

o So what next?

- Reverse engineering of the sceHP_Remote_Driver to see if there are additional features to standard remote operations
- Unload of the sceHP_Remote_Driver and replacement with our own custom serial driver
- Hijack the Uart4 driver and replace it by an equivalent driver using the Remote Port
- Linux on the PSP! :D


THE DEVICE:

o Details:

Various IC manufacturers do provide serial line voltage converters. In this montage we use a MAX3232 serial line converter, which, though listed for voltages above +3.0V, handles the +2.5V signals of the PSP just fine. Such a montage uses a handful of capacitors for the charge pump, but that's really all there is to it, therefore it is very simple and inexpensive to build - Anybody can build one.

o Diagram:
- Click on the image below to access the schematics (PDF)

- Because the PSP can switch power off on the serial line, we want to have a way to check if our device is powered or not. To this effect we use the V+ output of the MAX3232 which we connect to the CTS pin of the RS232 connector (Of course, using the DSR pin would have been preferable, but the DB9 <-> RJ45 adapters that we use don't have this pin readily available).

o List of components:
- 5 x 0.1 uF ceramic capacitors
- 1 x MAX3232CPE - If you're going to build this montage, make sure you get the DIP version of the MAX3232 (= MAX3232CPE). Soldering SSOP or TSSOP by hand is simply NO FUN!
- Connectors (eg. DB9 female), cables, development PCB, etc.

o Building the device:

I strongly advise getting your hands on one of these DB9<->RJ45 serial adapters pictured below (click on the image for bigger picture):

Because our serial converter is such a small montage, it is actually possible to fit it perfectly into one of these adapters. If you pry open one of these adapters (one notch above the RJ45 part and 4 for the DB9 plate), you will find that the RJ45 part slides into the DB9 housing, and it is the perfect size to fit small sliding PCB.
The DB9 part usually only has cabling for RxD, TxD, CTS, RTS and GND, so just cut the RJ45 part out and keep RTS as much as you can, since we will not be using it at all (double
check that you are indeed cutting RTS and not CTS!). Keep about 2-3 cm of the other connectors.
On the opposite hand of the PCB, you can use a right angle 4 ways 2.54 mm Molex connector. If you remove the comb structure of the RJ45 part from the socket (it's all plastic), the molex
connector should slide easily in place.

Below are pictures of the insides of the device (click on each image for bigger view):

The finished device (click on the image for bigger picture):


CABLE AND CONNECTORS:

The interest of using a 2.54 mm Molex connector is that you can then use a standard 4 ways Analog CD - Audio Card cable to connect to the PSP. The only problem is that you need a cable with 4 actual connectors. Manufacturers are going so cheap these days that they are using 3 conductors instead of 4, so finding a proper cable can be a bit of a pain. Of course, you can always build your own cable, but the advantage of using an Audio Card cable is that you can easily reorganize the crimp connectors at each end, instead of having to fit those yourselves.

On the PSP end, you will obviously need to build a custom remote connector (the small part with 6 pins in the picture above). To achieve this, you can cut a double sided copper PCB into shape, using the original remote connector as guide. Then you can draw the 6 contacts with a cutter or any sharp object. Make sure you have a tight fit, and plug the PCB in place a few times before scratching the copper out, as this should leave very visible contact marks. Thoroughly check that each contact is isolated from the others before using the connector.
On the other end, you should be able to solder a 2.54 mm Molex 6 ways/dual row connector.

Before soldering, make sure that you leave enough room to be able to connect the headphones connector on the left side: Remember, the audio connector MUST be plugged in for the remote port to be powered!
Once you have the Molex dual row connector soldered in, you can use a 6 ways/double row housing to fit your audio cable in there - easy! ;)


SOFTWARE PSP REMOTE FOR LINUX: PSP_REMOTE v1.00


(click on image for bigger view)

psp_remote v1.00 is a sample Linux program that emulates the PSP Remote on a PC. It is meant to be used with the PSP Serial Converter device above. You need to be root to run it and have the ncurses library installed (any decent distribution of Linux should have it)
This program simply reads a numeric key and sends the associated PSP Remote code. It is more a proof of concept for serial communications between a PC and a PSP than anything else.
For more information on the PSP Remote protocol, have a look at the ps2dev.org thread or Marcus' page.

This program was compiled and tested on Slackware 10.0.

Download: psp_remote_v1.00.tgz


No comments: