Author Topic: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader  (Read 11452 times)

Offline grizzfu88

  • Chief squatting Hard
  • *
  • Posts: 18
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« on: January 19, 2014, 02:09:04 PM »
Simply getting this thread started so hopefully more people will jump on board.

I have made my arduino a Oscilloscope and can see the signal.

I am using the Attiny85 as my chip with the arduino bootloader running at 8mhz.

I program the chip within the arduino IDE and use the arduino to program it.

I have tried the comparator, guessing, smashing, rebuilding, and interrupts to no avail.

SethMods seems to have this whipped but suggested this thread be started to share progress on this.



I AM STUCK.  :angry:

 

Offline RDC

  • Administrator
  • Around the block
  • *
  • Posts: 2595
  • Post quality +90/-2
  • Gender: Male
  • The CGnome Project
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #1 on: January 19, 2014, 04:14:33 PM »
This was my original R1 disable code I did in Basic, it's garbage I know, I'm not a coder and this is over 3 years old now also, but this does work and it worked on a 12F683 running on the internal 4MHz. This would be much nicer if I redid it in C and is easy enough to port over, but I've no desire to mess with it any more. You can see what gets done to 'mask' (disable) the R1 button press, which is half of being able to RF the thing and the hard part.

Code: [Select]

R1:                                     ' ORIGINAL R1 DISABLE CODE

  FE = ReadAD10(3)                      ' Read AN3 line and see what the value is
 If (FE>1011) then                      ' If it's over 1011 then
  goto R1                               ' keep checking it until it drops
 Else If (FE<1010) then wait 380 us     ' If it drops (Falling Edge) then wait 380us to skip R2
  TRISIO = 0                            ' set pin as output
  COM2 = 1                              ' set pin Hi
  wait 490 us                           ' for 490us to mask R1
  TRISIO = b'00011100'                  ' set pin back to input
  wait 3 ms                             ' wait 3 ms to skip the rest of the buttons
  goto R1                               ' do it all over again


That will look like this on you O-scope once it's done right.




You also have the option of using one more IO as Hazer suggested in the other thread. Just connect it to COM3 and watch for it to go Hi, and when it does that's the trigger to start the timing for reading and/or manipulating the COM2 line. That can be done instead of using the ADC or Comparator and waiting for the Falling Edge of the COM2 line as the trigger, but either way it's only a handful of lines of code to get the ball rolling, or button not pressing in this case.
« Last Edit: March 16, 2018, 04:41:35 PM by RDC »
Screwing up is one of the best learning tools, so long as the only thing you're not learning is how to screw up.

Offline grizzfu88

  • Chief squatting Hard
  • *
  • Posts: 18
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #2 on: January 19, 2014, 04:28:29 PM »
I oscoped that r3 line on my controller it stays high until just after the button pulses pass then goes low for 500/100us the back high all the way until the pulses pass again.

ive tried looking for the falling edge using interrupts and tried the detecting it with a comparater and neither worked.

Offline grizzfu88

  • Chief squatting Hard
  • *
  • Posts: 18
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #3 on: January 19, 2014, 04:46:49 PM »
i tried converting that code to match my stats and it partially blocks r1 im gonna play with the timing some more and report back.



No Buenos

just digital interference i guess.
« Last Edit: January 19, 2014, 05:25:53 PM by grizzfu88 »

Offline RDC

  • Administrator
  • Around the block
  • *
  • Posts: 2595
  • Post quality +90/-2
  • Gender: Male
  • The CGnome Project
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #4 on: January 19, 2014, 05:24:38 PM »
Yes the timing will need to be tweaked from that code, it's just to get you started is all.

Change your scope coupling to DC and measure COM3 again, cause it sits Lo and pulses Hi for 500us, and it does it at the same time the COM2 lines starts to do its thing, so it's perfe3ctly usable as a trigger versus watching for COM2 to fall.

COM3 Top Trace
COM2 Bottom Trace


« Last Edit: March 16, 2018, 04:42:58 PM by RDC »
Screwing up is one of the best learning tools, so long as the only thing you're not learning is how to screw up.

Offline grizzfu88

  • Chief squatting Hard
  • *
  • Posts: 18
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #5 on: January 19, 2014, 05:57:26 PM »
just com2







com2 & r3 in blue




Controller board.
Vx7 and believe me I have another brand new controller with a even newer board.
And this is not a actual pic of mine but rather one from vikingmods
« Last Edit: January 19, 2014, 06:03:41 PM by grizzfu88 »

Offline SethMods

  • Registered BST
  • King of the Wii-tards
  • *
  • Posts: 189
  • Post quality +17/-1
  • Gender: Male
  • Acidmods User
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #6 on: January 19, 2014, 06:57:49 PM »
I think this is a great project. Personally I think we need to cater to the Arduino a little more on here(AM Forum) as most new comers to electronics are starting there.


grizzfu88, it looks like  you are already getting going using RDC's input. If you can continue to work from that angle, I am going to start working on how to do a comparator properly with the Arduino. Ideally if you can get some RF working from syncing with COM3 then we should just be able to insert Comparator code later to get it to sync to COM2 or COM1.

You seem to be ridiculously close to getting it going. Don't get discouraged. You are making really good progress.


Also, I should be transparent and mention that my time will be a little limited for the next week or so because of work. So I may not have anything to share for a little bit.

Hazer/RDC, Am I correct in assuming that if you tie to COM3 for sync that the sync goes away if the stick is pressed?  (...which is why we need to eventually tie to COM1 or COM2?)


Offline RDC

  • Administrator
  • Around the block
  • *
  • Posts: 2595
  • Post quality +90/-2
  • Gender: Male
  • The CGnome Project
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #7 on: January 19, 2014, 07:47:02 PM »
No, the COM3 pulse stays there no matter what button on COM3 is pressed, it's the COM3 line. It's just a pulse instead of a steady voltage or ground for that common line. L3, R3, Select and Start all use that COM3 line and pulse their respective button lines when those buttons are pressed.
Screwing up is one of the best learning tools, so long as the only thing you're not learning is how to screw up.

Offline grizzfu88

  • Chief squatting Hard
  • *
  • Posts: 18
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #8 on: January 19, 2014, 07:52:02 PM »
I cannot find that pulse to save my life.. Idk I've tried every pin and test point on this controller.

Offline RDC

  • Administrator
  • Around the block
  • *
  • Posts: 2595
  • Post quality +90/-2
  • Gender: Male
  • The CGnome Project
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #9 on: January 19, 2014, 07:59:29 PM »
It's the other side of LS and RS. If you have the scope set to AC coupling you're not going to see it.
Screwing up is one of the best learning tools, so long as the only thing you're not learning is how to screw up.

Offline grizzfu88

  • Chief squatting Hard
  • *
  • Posts: 18
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #10 on: January 19, 2014, 08:23:59 PM »
I saw it for just a second so would it be safe to use that as a digital high and low? Or stick to an analog pin?

I'm using my arduino as a scope so I can't change the settings.
« Last Edit: January 19, 2014, 08:33:43 PM by grizzfu88 »

Offline RDC

  • Administrator
  • Around the block
  • *
  • Posts: 2595
  • Post quality +90/-2
  • Gender: Male
  • The CGnome Project
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #11 on: January 19, 2014, 08:41:13 PM »
You can end up with the same thing either way, so it's dealer's choice really, all depends on how much code you want to do and how fast all of that IO switching can be done.

It takes one more IO to use COM3 as the trigger, but it eliminates having to do some of the IO switching on just the 1 pin if doing only COM2, so it's a bit easier to implement.

Code: [Select]

  while (COM3 == 0)          // While COM3 is Lo..
  {}                         // ..do nothing
  // Soon as it goes Hi
  delay_us(500);             // delay around 500us to skip R2
  // Set IO pin for OCM2 as Output
  COM2 = 1;                  // Drive COM2 Hi
  delay_us(500);             // for 500us to mask R1
  // Set COM2 back to Input and wait out other buttons, around 3ms

Screwing up is one of the best learning tools, so long as the only thing you're not learning is how to screw up.

Offline grizzfu88

  • Chief squatting Hard
  • *
  • Posts: 18
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #12 on: January 19, 2014, 08:57:20 PM »
I personally only wanted one IO to begin with but that trigger is really enticing lol I'm calling it a night but I'll be back at the code and adding that wire tomorrow night and report back!

Thanks for the help everyone, SethMods can't wait to see that comparator in action on the arduino however if I'm not mistaken none of the attiny  arduino cores support the commands. I'm assuming this was why I was not getting anywhere with that. I'd like to keep it arduino as much as possible so I can learn as much of it as possible for my next project, a mini CNC! :p AiM BiG WiN BiG right!


Sorry nothing to report as of yet been tied up, between my son and car blowing up or whatever its done I don't have time yet to mess with this. As soon as I do I'll report my progress.

Anyone other than me and sethmods on this?

Tried the com3 as a trigger and still can't get anywhere.

]
« Last Edit: January 24, 2014, 05:25:31 PM by grizzfu88 »

Offline SethMods

  • Registered BST
  • King of the Wii-tards
  • *
  • Posts: 189
  • Post quality +17/-1
  • Gender: Male
  • Acidmods User
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #13 on: January 27, 2014, 06:15:46 PM »
Sorry, grizzfu88, I have been super busy.

So first off since you are having trouble finding COM3, let's just skip it. It's an extra pin at this point anyway...which you didn't want.

So from reading the datasheet on the ATtiny25 I think the following will configure/enable the Comparator.

First, add this to the top of the sketch.
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif

Now let's configure the Comparator.

sbi(ACSR,ACBG);  //Connect the Internal 1.1V Reference to the positive input

cbi(ADCSRB,ACME);  //We don't want to connect to ADC0-ADC3. Instead use AN1 as the negative input

cbi(ACSR,ACIE);  //Disable comparator interrupt. We will just read the output directly.

sbi(DIDR0,AIN1D);  //Set AN1 to analog input not digital

cbi(ACSR,ACD);  //Make sure Comparator is turned on



Now that the comparator is setup we just watch the ACO bit of ACSR to see when the voltage on AN1 drops below 1.1V to indicate the start of the frame.

while( bitRead(ACSR,5) == 0 );  //Loop here until the voltage for COM drops below 1.1V


I'm not 100% sure that 1.1V is going to be a high enough voltage to catch start of the frame, but if it isn't then we have to provide our own voltage reference using another pin. If that's the case then it will be easier to go back and find COM3.

I haven't tested this code, so let me know if you get a chance to try it.

Offline grizzfu88

  • Chief squatting Hard
  • *
  • Posts: 18
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #14 on: January 27, 2014, 07:06:25 PM »
What if I press a button really hard and it dips below 1.1 and that catches it?

And whered you reference the comparator setup from I think I need to read that a bit lol

Couldn't I use a resistor between the + and the compare pin?

Offline SethMods

  • Registered BST
  • King of the Wii-tards
  • *
  • Posts: 189
  • Post quality +17/-1
  • Gender: Male
  • Acidmods User
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #15 on: January 27, 2014, 08:17:00 PM »
Ok, scratch that. The voltages do NOT go down to 1.1V without a button being pressed.

I'm going to find COM3.

In answer to your question about losing sync when a button is pressed too hard...
because the frames are predictable. We know that there is ~3ms of button reading followed by ~8ms of dead time.

If you catch that first part of the frame then you know another frame can't start for another 11ms or so. So in your code you don't go back to looking for the start of the frame until after 5ms(or so) of the frame has passed. This makes sure you get dropped in that deadspace with no risk of de-scynchronizing.


Update:
I found COM3. On the top of the PCB is a section of 20 contacts(two rows of ten) designed to connect the flex pcb to the actual pcb. With the PCB oriented like you were holding it to play a game the pad for COM3 is on the top row 6th from the right.
« Last Edit: January 27, 2014, 08:38:04 PM by SethMods »

Offline grizzfu88

  • Chief squatting Hard
  • *
  • Posts: 18
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #16 on: January 27, 2014, 11:37:26 PM »
Happen to find a test point that that leads to?

If not I'll follow it tomorrow if I get some time.

That made complete sense lol but Ithink the r2 dip is like 1.6v or so
And I'm getting fonder of the com3 idea it seems a bit more stable. I just really wish I had an actual oscope matter of fact I may get one of those pocket ones! Any suggestions on those?

Offline SethMods

  • Registered BST
  • King of the Wii-tards
  • *
  • Posts: 189
  • Post quality +17/-1
  • Gender: Male
  • Acidmods User
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #17 on: January 28, 2014, 05:47:53 AM »
So, one of the nice things about going to that pad instead of finding a test point is that the install would be the same for every type of PS3 controller. It's going to be the same point for each of the ?8? style of boards in the PS3 controller.


As far as a oscilloscope. I bought this one a couple years back and love it!

http://www.seeedstudio.com/depot/DSO-Quad-4-Channel-Digital-Storage-Oscilloscope-p-736.html?cPath=63_65

Offline Hazer

  • x4675636B4E7574
  • Acidmods Alumni
  • Acid Modder
  • *
  • Posts: 583
  • Post quality +59/-0
[Quote from Gamermodz via Viking forums]
Don't be jealous your not half as smart. I hate ****tards like you. An ignorant redneck. Your nothing but a posing ******. Get the **** out of here, really, your claim to fame is an open source rapid fire code? You make me laugh. You think you have control over the modding market?  You couldn't create what I can and do. You are too ignorant with your outrageous assumptions and accusations. [/Quote]

Offline grizzfu88

  • Chief squatting Hard
  • *
  • Posts: 18
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #19 on: January 28, 2014, 04:23:37 PM »
I was thinking something a little cheaper lol they have those DSO handheld mp3 lookin ones for 70, any input on those?I won'tuse this on anything other than hobby  projects.

Offline grizzfu88

  • Chief squatting Hard
  • *
  • Posts: 18
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: PS3 Rapid Fire Using Arduino/AVR with Arduino Bootloader
« Reply #20 on: January 28, 2014, 04:24:57 PM »
So, one of the nice things about going to that pad instead of finding a test point is that the install would be the same for every type of PS3 controller. It's going to be the same point for each of the ?8? style of boards in the PS3 controller.


As far as a oscilloscope. I bought this one a couple years back and love it!

http://www.seeedstudio.com/depot/DSO-Quad-4-Channel-Digital-Storage-Oscilloscope-p-736.html?cPath=63_65

Will the strip still work with solder on it or do I need to clean the trace before it and solder to that?

 

SMF spam blocked by CleanTalk
SimplePortal 2.3.5 © 2008-2012, SimplePortal