USB Related Questions

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
iceman755
Posts: 30
Joined: Mon Jul 21, 2008 1:12 am

USB Related Questions

Post by iceman755 »

Hi,

I want to develop an app that interacts with something extern from the PSP (it will act like a button), I know I can do it modding my PSP and extracting cables from the analog stick, but I don't want to do it that way. Then, here come my questions,
1-Can I take an usb cable (attached to the PSP) and use the 2 data wires to read it like a button???

like this:
Image

2-If something like this does not damage my PSP, can it be read with the funtions in the usb library???

3-Is there a way to do it with attaching an IC (to read a bit)???

I hope this is not a dumb bunch of questions.

Thanks!!!
"Libera eas de ore leonis, ne absorbeat eas tartarus, ne cadant in obscurum"
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

Seems that you're missing a lot of basics....don't do anything of what you've written or your PSP will blow up in a million sparkles...
iceman755
Posts: 30
Joined: Mon Jul 21, 2008 1:12 am

Post by iceman755 »

jean wrote:Seems that you're missing a lot of basics....don't do anything of what you've written or your PSP will blow up in a million sparkles...
lol, crazy things inside my head, trying to solved it the easy way...

then, May I have a suggestion???

I want to make something like a speedometer from it (to use the obtained speed in my app), can this be achieve???

Edit: lol, I figured out that as I have a fat PSP I can use the Ir port to read the bit that I want, so I have just to build a circuit that send that bit (well, a friend of mines knows a lot about electronic, maybe he will build it for me).
I hope this idea does not "blow up my PSP in a million sparkles", lol...
"Libera eas de ore leonis, ne absorbeat eas tartarus, ne cadant in obscurum"
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

The PSP USB is a slave USB device. You need to attach a HOST USB controller to it to do anything. If you don't understand what I just wrote, go study USB until you do understand, then you'll realize what is needed to do anything with the USB on the PSP.
iceman755
Posts: 30
Joined: Mon Jul 21, 2008 1:12 am

Post by iceman755 »

J.F. wrote:The PSP USB is a slave USB device. You need to attach a HOST USB controller to it to do anything. If you don't understand what I just wrote, go study USB until you do understand, then you'll realize what is needed to do anything with the USB on the PSP.
I understand what you said, and I see that a device with those characteristic is out of my hands.

Actually, I'm trying to do it with de IR port, but I can't open it to use it, this "int fdIRPort = sceIoOpen("irda0:", PSP_O_RDWR, 0);" is returning a value less than 0, is it ok??? does the IR port can be open in user mode???

this is the main loop that I'm using to read from IR, it is based on the sample that comes with pspsdk:

Code: Select all

int fdIRPort = sceIoOpen("irda0:", PSP_O_RDWR, 0);
while (1) {
		unsigned char data=NULL;
		len=sceIoRead(fdIRPort, &data, 1);
		if (len>0) 
                  {
		     printf ("signal read");
		   }
		sceKernelDelayThreadCB(100);
	}
sceIoClose(fd);
"Libera eas de ore leonis, ne absorbeat eas tartarus, ne cadant in obscurum"
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

If you're on 3.80 or newer, you need to start the IRDA before you can use it in an app.

Code: Select all

	/* Load irda PRX for CFW >= 3.80 - Thanks, ZX81! */
	u32 mod_id = sceKernelLoadModule("flash0:/kd/irda.prx", 0, NULL);
	sceKernelStartModule(mod_id, 0, NULL, NULL, NULL);
Then you'll be able to use the irda: device.
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

You can short the PSP microphone input to ground to make a tick noise that
you can easily detect in software with the original recording example.
I did a heart rate monitor that way, and an external button.
If not actually, then potentially.
iceman755
Posts: 30
Joined: Mon Jul 21, 2008 1:12 am

Post by iceman755 »

J.F. wrote:If you're on 3.80 or newer, you need to start the IRDA before you can use it in an app.

Code: Select all

	/* Load irda PRX for CFW >= 3.80 - Thanks, ZX81! */
	u32 mod_id = sceKernelLoadModule("flash0:/kd/irda.prx", 0, NULL);
	sceKernelStartModule(mod_id, 0, NULL, NULL, NULL);
Then you'll be able to use the irda: device.
Ok, adding this I'm able to read IR signals.
Art wrote:You can short the PSP microphone input to ground to make a tick noise that you can easily detect in software with the original recording example.
I did a heart rate monitor that way, and an external button.
This idea sounds good, and I'm very interested, not to
replace the irda idea, but to add it. because actually the speedometer that I'm building is to be attached to a bicycle to control the speed of a little game (to make doing exercise more fun lol) and if I can add a heart rate monitor it's going to be very helpful (specially for me, that I'm a little over weight).

how the heart rate monitor worked???
I can't find that example that you said.
Thanks all of you, because you're taking your precious time to help me!!!
"Libera eas de ore leonis, ne absorbeat eas tartarus, ne cadant in obscurum"
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

AFAIK, you have no simple low-level access to IR port....you can only feed and read IRDA or SIRCS....so you cannot simply output a square wave and detect it back when reflected/interrupted by a wheel. Play a little with pspsdk examples and you'll see.
then, May I have a suggestion???
IRDA is hard way to go, expecially if you're not into it.
Mic way is simpler and you can find ready-to-execute examples (provided you can understand them), and advices from Art. But i somehow feel it stinks.
The proper way would be to use a small microcontroller like those 2 euros, 8 pins PIC, to connect it to PSP through SIO and use it as an interface like in another Art's project or in my openKeyboard project. But this is far from your comprehension i guess. Feel free to choose whatever method you like the most, but i think you should go for Art's. So, you can use the search feature of this forum to retrieve all information you need about it.

jean
iceman755
Posts: 30
Joined: Mon Jul 21, 2008 1:12 am

Post by iceman755 »

jean wrote:AFAIK, you have no simple low-level access to IR port....you can only feed and read IRDA or SIRCS....so you cannot simply output a square wave and detect it back when reflected/interrupted by a wheel. Play a little with pspsdk examples and you'll see.
then, May I have a suggestion???
IRDA is hard way to go, expecially if you're not into it.
Mic way is simpler and you can find ready-to-execute examples (provided you can understand them), and advices from Art. But i somehow feel it stinks.
No my friend, I didn't explain it very well ('cause my poor english), actually I don't need to decode the signal or send it and check if it is interrupted/reflected, why???
-1: I don't need the data that the signal brings, I just need to know that there is a signal. This is solved, right now I'm able to verify that a signal is present (thats why I don't need to decode the signal).

-2: I'm not using the IR port to send the signal (or sending nothing), I'm obtaining the signal from a TV remote control (of course this will be replaced by a circuit that send the signal) and it's working just right.
jean wrote: The proper way would be to use a small microcontroller like those 2 euros, 8 pins PIC, to connect it to PSP through SIO and use it as an interface like in another Art's project or in my openKeyboard project. But this is far from your comprehension i guess. Feel free to choose whatever method you like the most, but i think you should go for Art's. So, you can use the search feature of this forum to retrieve all information you need about it.

jean
really is not so far from my comprehension but implementation, I'm not in Europe or USA, so here, to find a programmable IC is an epic adventure so the device programmer; and buy it via internet, no way, you can die waiting (the last item I bought took more than a month)

Maybe I can use the headphones controller, but I'm not sure if I want to lose it (here it cost about 45 dollars).

I'm going to follow your advice, parallel to what I'm doing, I'll try to get the PIC.

Thanks partner!!!
"Libera eas de ore leonis, ne absorbeat eas tartarus, ne cadant in obscurum"
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

No my friend, I didn't explain it very well ('cause my poor english), actually I don't need to decode the signal or send it and check if it is interrupted/reflected, why??
Of course i did understand despite of your english/lack of technicalness.
But you think i didn't because your lack of basics. Believe me, taking a sircs remote's hardware to continuously send a key's code and check how fast the PSP can detect it IS synonimous of _bad_design_.
Nothing personal.

jean
iceman755
Posts: 30
Joined: Mon Jul 21, 2008 1:12 am

Post by iceman755 »

jean wrote:
No my friend, I didn't explain it very well ('cause my poor english), actually I don't need to decode the signal or send it and check if it is interrupted/reflected, why??
Of course i did understand despite of your english/lack of technicalness.
But you think i didn't because your lack of basics. Believe me, taking a sircs remote's hardware to continuously send a key's code and check how fast the PSP can detect it IS synonimous of _bad_design_.
Nothing personal.

jean
Certainly You're right, I know little about it (sircs/irda), even I know little about PSP's hardware/software. But I'm trying to use the resources that I have and trying to learn in the proccess, and believe me or not, comments like yours is what I need to learn.

You say that something like this is a bad design, I believe you, I didn't know it but now I do, then no matter what it takes I'm going to do it using the SIO port, searching the web I found a tutorial about how to make a PSP SIO connector (oh!!! wait, you are the one who wrote it) maybe I can use it together with a PIC (If I get it) or use the PSP remote controller.

Thanks!!!
I hope you'll be around to help me if I do wrong, lol!!!
"Libera eas de ore leonis, ne absorbeat eas tartarus, ne cadant in obscurum"
Post Reply