Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interface Sony PlayStation Analog Joystick

Status
Not open for further replies.

tuinui98

Junior Member level 2
Joined
Dec 18, 2002
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
138
gamepad protocol reverse engineer

Anyone can guide me for schematics and platform to interface

microcontroller with Sony Playstation Analog Joystick

I need for attach with my project presentation

(I'm 4th years bachelor's degree)

Thanks very much.
 

ps2 gamepad picbasic

The Playstation communicates with the Joystick with a SPI interface with an additional acknowledge signal.
It uses SPI mode 3 (CPHA = 1 and CPOL = 1) with Playstation acting as master and Joystick acting as slave.

The protocol from the joystick differs in analog and digital mode.

If you use digital mode, one command is 5 bytes. There is 14 different commands (one for each button).
If you use analog mode the joystick sends 9 bytes in each command.

The Sony Playstation IR receiver sends 7 bytes in each comand.

Useful links:

http://www.classicgaming.com/epr/playstat/Pad&Mem.txt

**broken link removed**

http://www.geocities.com/deonvdw/Docs/PPJoyMain.htm#interfaces
http://www.geocities.com/deonvdw/Docs/Diagrams/Playstation/PSXPower.htm

**broken link removed**

http://www.ourwasteland.com/phpwiki/index.php/PlayStationDualShockController

The 7.6V Power supply is only used for the force feedback and you don't need to connect this if you don't use force feedback.

If you need more info you can PM me or post here.
 

If you don't need the analog functions I would reccomend to use the Joypad in digital mode.
It is easier because all 14 commands are documented in the links above.
And you only have to send 5 bytes instead of 9.
 

Thank you for your informations, it's useful.

Now, I can interface this joystick properly.

But It's not all, I have some problems to ask every one for help.

1. How can I use force feedback function?
2. If I want to force to change mode of joystick (analog to digital or digital to analog), can I command this joystick to change mode which I want?

Thanks very much, for all.
 

tuinui98 said:
2. If I want to force to change mode of joystick (analog to digital or digital to analog), can I command this joystick to change mode which I want?

Yes I know some games for PlayStation 2 forces the joypad to be in analog mode, for example Gran Turismo 3. When you start Gran Turismo 3 the "analog" LED always turns on and you can't switch it of manually by pressing the button.
I don't konw the command though, but you can do some reverse engineering by monitoring the communication between PlayStation 2 and joypad with a logic analyzer.
 

Thanks all,

I really feel thanks for all.

Now, I think that's enought for my project.

But I still explore for more knowledge about it.

And then I'll be post my source code in this board.

Thanks.
 

If you want to check if the joypad is in analog or digital mode you can check the joupad's ID.
In digital mode the ID is 41h (LSB first).
I can't rember the ID in analog mode right now, but you can monitor it yourself.
 

Playstation Gamepad Protocol

Somebody stepped over such protocol?

I know the received values which depend on key strokes...
but what are those other values returned mean?
And what can be set inside the gamepad?
 

Re: Playstation Gamepad Protocol

Look at source code here http://darkfader.net/psx/
Also **broken link removed** seems like a comprehensive description 6f h/w and s/w connections to gamepad.
Also **broken link removed** talks about h/w, shows how to interface gamepads to PC via USB, with asm source code...

HTH
Barny
 

Re: Playstation Gamepad Protocol

barny451 said:
Look at source code here h**p://darkfader.net/psx/
Also h**p://www.zen35383.zen.co.uk/stnield/psxpads.txt seems like a comprehensive description 6f h/w and s/w connections to gamepad.
Also h**p://www.zen35383.zen.co.uk/stnield/ talks about h/w, shows how to interface gamepads to PC via USB, with asm source code...

HTH
Barny

Hi,
can u please provide some info for PS2, i am very interested in doing such type of things 8)

thanks
sawaak
 

Re: Playstation Gamepad Protocol

The gamepads are basically the same between PS1 and PS2 AFAIK.
 

Re: Playstation Gamepad Protocol

The gamepads are basically the same between PS1 and PS2 AFAIK.

well not exactly, see this page
**broken link removed**

PS2 controller is pressure sensitive and PS1 controller isn't, that his a big difference, but i don't know if the protocol is different, but most probably it is
 

Re: Playstation Gamepad Protocol

davorin said:
Somebody stepped over such protocol?
Please search EDAboard before starting a new topic Davorin, this question have already been asked and answered.
I have merged your topic together with this topic.
 

No..the question hasn't been answered!!!!

The question was also what command are accepted by PS2 gamepad...

Normally they just power-on as normal on/off joystick type and you can either switch to analog manually or via serial interface...and tehr are for sure more supported commands here!
 

davorin said:
No..the question hasn't been answered!!!!

The question was also what command are accepted by PS2 gamepad...

Normally they just power-on as normal on/off joystick type and you can either switch to analog manually or via serial interface...and tehr are for sure more supported commands here!
Yes, you are right this haven't been answerd, I think I misunderstood your question a bit because you started asking about the protocol and not the commands, sorry. I looks like others also misunderstood your question as barny451 answered the question asked in the original topic instead.
But I will keep the topics merged because they are very related to each other.

Try to connect a logic analyzer and do some reverse engineereing, then you will probably be able to find the missing commands.
As I wrote earlier, it communicates via SPI interface with an additional acknowledge signal. It runs at 3.6V and the "schock effect" motors are supplied with 7V.
I did a lot of searchig about the protocol a little year ago and everything I could find is in this topic, so I don't think there any more info on the internet than already posted here. Unless it is made within the last year.

Anyone who have worked with this protocol, please post additional info not already mentioned here.
 

What I've found so far is the verilog core here which describes some settings/commands:

**broken link removed**
 

davorin said:
What I've found so far is the verilog core here which describes some settings/commands:

h**p://babelfish.altavista.com/urltrurl?lp=ja_en&trurl=h**p%3a%2f%2foffice-dsan.hp.infoseek.co.jp%2fpspad%2fpspad.htm
This circuit leaves out the ACK signal, which makes it somewhat easier to inteface to a microcontroller, because you can just conncet it to a normal SPI port without an additional ACK input pin.
If you connect a microcontroller to the playstation to emulate a gamepad you need to send the ack signal from the microcontroller to the Playstation.

Read my description in the second post on how to set up the SPI inteface correctly to mode 3.
Not all microcontrollers with SPI port, have support SPI mode 3, but I used it with an Atmel Atmega AVR which support SPI mode 3.
You can also make a software SPI interface by bit banging, but it's much easier to use a microcontroller with hardware SPI interface that supports mode 3 (like Atmel AVR does).
 

Hi All,

I remember I had came across a project in the Internet using a PS2 gamepad interface to PIC16FXXX and then to a 433MHz TX. Anyone seen this page? Please advice. Thank you.

Regards
 

Hello again

now i have my own C-code (keil) of PSX joystick connected with MCS-51

until now, i still not reverse engineer for force-feedback yet.

but i hope this useful for someone, thankz.
 

Hello

I have started working at PSX controller emulator.
I'm using atmega 8 microcontroller, I have conected psx plug like below:
MOSI->COMMAND
MISO->DATA
/SS->ATT
SCK->CLK

PB1(as output)->ACK

I have set SPI to mode 3, but I can't send more than one command. I use osciloscope to watch what is going on.
My C code looks like that:

Code:
void slave_init(void){
	spi_DDR=(1<<MISO) | (1<<PB1);
//ack high
	sbi(spi_PORT, PB1);
//mode 3, enable interrupt
	SPCR=(1<<SPIE) | (1<<CPOL) | (1<<CPHA) ;
//first valu is ffh
	SPDR=0xFF;
//enable spi
	SPCR |= (1<<SPE);
}


SIGNAL(SIG_SPI){	
	//ACK
	cbi(spi_PORT, PB1);
	
	odb[0]=SPDR;
	SPDR=wys[it1];
	if(it1!=20)
		it1++;
	else
		it1=0;
	delay_us(10);
	sbi(spi_PORT, PB1);
}

int main(void){
	
	sei();
	wys[0]=0xFF;
	wys[1]=0x9E;
	wys[2]=0x5A;
	
	slave_init();
	
	while(1){
	}
	
}

What is wrong in this code?
please help.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top