forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

USB Related Questions

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
iceman755



Joined: 21 Jul 2008
Posts: 34

PostPosted: Fri Aug 08, 2008 3:21 am    Post subject: USB Related Questions Reply with quote

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:


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"
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Fri Aug 08, 2008 6:25 pm    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message
iceman755



Joined: 21 Jul 2008
Posts: 34

PostPosted: Sat Aug 09, 2008 2:18 am    Post subject: Reply with quote

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"
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Aug 09, 2008 3:46 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
iceman755



Joined: 21 Jul 2008
Posts: 34

PostPosted: Sat Aug 09, 2008 9:15 am    Post subject: Reply with quote

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:
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"
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Aug 09, 2008 10:00 am    Post subject: Reply with quote

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

Code:
   /* 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.
Back to top
View user's profile Send private message AIM Address
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Sat Aug 09, 2008 10:44 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
iceman755



Joined: 21 Jul 2008
Posts: 34

PostPosted: Sat Aug 09, 2008 3:44 pm    Post subject: Reply with quote

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:
   /* 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.

Quote:

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"
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Sat Aug 09, 2008 7:57 pm    Post subject: Reply with quote

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.
Quote:
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
Back to top
View user's profile Send private message
iceman755



Joined: 21 Jul 2008
Posts: 34

PostPosted: Sun Aug 10, 2008 2:30 am    Post subject: Reply with quote

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.
Quote:
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"
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Sun Aug 10, 2008 10:45 am    Post subject: Reply with quote

Quote:
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
Back to top
View user's profile Send private message
iceman755



Joined: 21 Jul 2008
Posts: 34

PostPosted: Sun Aug 10, 2008 4:51 pm    Post subject: Reply with quote

jean wrote:
Quote:
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"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group