English Amiga Board


Go Back   English Amiga Board > Support > support.Hardware

 
 
Thread Tools
Old 15 August 2019, 10:10   #1
MrD
Registered User
 
MrD's Avatar
 
Join Date: May 2009
Location: UK
Posts: 111
PSCD32 - PS2 pads on Amiga - was 'current limits of Amiga Joystick ports?'

I'm designing a microcontroller-based adapter to allow the use of PS1/2 pads on an Amiga CD32 (or other Amigas if the software performs the protocol). There's possibly many variations of this already, but this one will be mine.

What are the absolute and recommended maximums for current draw from the Joystick ports of an Amiga? Or where can I find this information?

Last edited by MrD; 02 September 2019 at 00:30.
MrD is offline  
Old 15 August 2019, 10:57   #2
jbilander
Registered User
 
jbilander's Avatar
 
Join Date: Jun 2018
Location: Stockholm
Age: 48
Posts: 264
A quick googling says 50mA max, but I'm not sure that is correct.
https://allpinouts.org/pinouts/conne...k-amiga-9-pin/

I took a peek in the book Abacus Advanced System Programmers Guide for the Amiga (1988) and it says:

The +5 volt line on the two game ports is not connected directly to the Amiga power supply. A current-protection circuit is inserted in these lines which limits the short-term peak current to 700 mA and the operating current to 400 mA. This makes these outputs short-circuit proof. To prevent the voltage on these two +5 volt pins from falling off too much, the current draw on the two ports should not exceed a total of 250 mA. Unfortunately, this protection measure has been omitted from the Amiga 500 and 2000.
Attached Thumbnails
Click image for larger version

Name:	Abacus_book_screenshot.jpg
Views:	268
Size:	38.0 KB
ID:	64103  
jbilander is offline  
Old 15 August 2019, 12:49   #3
MrD
Registered User
 
MrD's Avatar
 
Join Date: May 2009
Location: UK
Posts: 111
Quote:
Unfortunately, this protection measure has been omitted from the Amiga 500 and 2000.
Ooof... I cringed hard at that. That's not good.

But apart from that, that's good news. Thank you very much. I expect a PS2 pad draws 20-30mA and the PIC I'm using is going to be using hardly any current as it'll be reacting to clock and frame-request state changes on the CD32 side, and requesting PS2 pad state through SPI a few hundred times a second, but apart from that will be mostly idle.
MrD is offline  
Old 15 August 2019, 13:08   #4
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
The 2000 has a fuse to protect the ports, so you shouldn't do any more damage than blowing the fuse, though it's soldered in place so repair needs to be done by someone who can solder. On the 500 and later Amigas, there's a 4.7 ohm resistor on the 5V supply to the ports that limits current. While you can draw a fairly hefty current that could burn out the resistor after a short time, the useful voltage will drop as current increases, so you're more likely to simply not have a functioning controller. For example, at 100mA, the actual voltage available will drop to around 4.5V, which will start to cause problems for many TTL-based circuits. So, a few hundred mA might be perfectly fine for driving LEDs or something, but won't be much good for a device that needs 5V. 50mA should be safe for sensitive parts, probably dropping to around 4.7-4.8V, so it should be no problem for what you're thinking.

Edit: Also, the 2000's fuse supplies both ports, but the models with a 4.7 ohm resistor have one on each port, so loading on one doesn't affect the other.
Daedalus is offline  
Old 15 August 2019, 13:23   #5
MrD
Registered User
 
MrD's Avatar
 
Join Date: May 2009
Location: UK
Posts: 111
Roger dodger.

The only things that'll be connected to the +5V line will be a +3.3V LDO to power the MCU and PS2 pad, and 20k pull-up resistors to the CD32's I/O lines since my MCU runs at +3.3V.

I'm using the MCU's 5V-tolerant lines and switching between high-resistance and ground to output the Up Down Left Right Fire1 and Fire2/Data signals to the Amiga)
MrD is offline  
Old 15 August 2019, 13:27   #6
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
Sounds like you should be grand so. Bear in mind that some of the pins on the Amiga (Fire 2 and Fire 3, pins 9 and 5 on the port) double up as analogue inputs and might require more pull-up current. I've no idea if that's the case, but if you get funny behaviour, try dropping the pull-ups to 10k.
Daedalus is offline  
Old 15 August 2019, 13:36   #7
MrD
Registered User
 
MrD's Avatar
 
Join Date: May 2009
Location: UK
Posts: 111
Thanks. 10k was my first thought. I'll change it if I get any weirdness.

I've got small (200R-600R maybe) protection resistors leading into and out of my MCU on the data lines since I don't really trust the Amiga all that much. Pin 6 being used for both Atari-style Fire1 output-to-Amiga and an active-low SPI-frame input-from-Amiga signal depending on Pin 5 made me nervous, and I didn't want a bad scenario where both the MCU and Amiga would drive the line together unprotected. (Too cheap/lazy/cowboy to use the two inverting buffers that the real CD32 pad uses.)

Plus, I'm intending this to be used with older software, and I've got some configuration (maybe software/maybe hardware) that'll let me map Square or Triangle on the PS2 pad to Jump on A500. It's entirely possible that some weird/old software will do something unexpected with those POT-X/Y pins, so I'm very keen on protection there.

I had a look at the Amiga's schematics near the joystick port and did some voltage divider calculations and came up with a scenario where either the MCU or the Amiga wouldn't be able to pull the signal down to something like 0.25V with a 10k, so that's where 20k came from.
MrD is offline  
Old 15 August 2019, 13:45   #8
robinsonb5
Registered User
 
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,153
Quote:
Originally Posted by Daedalus View Post
Sounds like you should be grand so. Bear in mind that some of the pins on the Amiga (Fire 2 and Fire 3, pins 9 and 5 on the port) double up as analogue inputs and might require more pull-up current. I've no idea if that's the case, but if you get funny behaviour, try dropping the pull-ups to 10k.
Seconded - the dual-purpose nature of those pins can make them squirrelly. You're more likely to have trouble with pull-down than pull-up, though. You really do need to get that voltage right down to as near zero as you can. Test on as many machines as you can, especially different A1200 revisions, and A600s.
robinsonb5 is offline  
Old 02 September 2019, 00:18   #9
MrD
Registered User
 
MrD's Avatar
 
Join Date: May 2009
Location: UK
Posts: 111
https://pbs.twimg.com/media/EDFcfdQXYAUb53N.jpg

https://cdn.discordapp.com/attachmen...180340_DRO.jpg

https://cdn.discordapp.com/attachmen...141500_DRO.jpg

https://cdn.discordapp.com/attachmen...141429_DRO.jpg

I got some PCBs made up of my design and assembled them, and everything seems to be going great.

On the PS2 side, I'm using a MIC2940A 3.3 to power the pad. All the pad<-MCU connections are direct through a 470R resistor. All the pad->MCU connections are through a 470R with a 18k pull-up to 3.3V connecting at the connector side.

On the CD32 side, UDLR and Fire2 are always 'output' MCU->Amiga (either high-Z or open-drain), so they're connected through 470R. A 18k pull-up connects them to 5V on the side closest to the MCU. Joymode/Frame is always input MCU<-Amiga, so it's connected through 470R with an 18k pull-up on the outside edge closest to the connector. Fire1out/Clockin is bidirectional and is connected the same way.
MrD is offline  
Old 02 September 2019, 00:28   #10
MrD
Registered User
 
MrD's Avatar
 
Join Date: May 2009
Location: UK
Posts: 111
The hardware for the PS2 side worked first time. I just needed to come up with a workable event-driven way to read the pad using the hardware properly, and everything was sunny.

On the Amiga output side I'm simply simulating a two-button joystick for now until I write the correct protocol. With this design as it is, UDLR and Fire worked great, but Fire2 wasn't being recognised. I measured the voltage at the connector pin (where the wire is soldered into the board) and when the MCU was trying to pull it low it ended up at 1.7V, miles away from where it needed to be. This safety resistor had to be lowered. I looked at the schematic, and that pin seems to come straight out of Paula without any interference or safety, just a couple of debouncy/emi caps, which scares me a little. I really didn't want Paula blowing up because of this.

I tried some lesser values of resistor by soldering some more in parallel and in the end it needed to be less than 100R to trigger Fire2. I'm testing with Amiga Test Kit.

Grounding Fire2 across an ammeter gives 17mA current, which is much less than I thought it'd be. I suppose it would have to be a safe scenario to ground this pin directly since that's what 2-button dumb pads and normal 2-button mice do, but I still don't like it! I modelled the output on paper with some values as if the pin was a 5V source through an internal current limiting resistor and it came out to 300R. Which means that if I want a voltage at that pin of <0.7V, my safety resistor has to be around the 50R range. An order of magnitude lower than what I intended. ^_^;

I made the switch (after trekking to the one remaining brick and mortar shop that sells resistors in Wirral - a locally owned hi-fi repair shop where I got totally gouged) for a 47R resistor on the Fire2 line, and B.C. Kid works perfectly!

I'm nervous that if, at some point, there's bus contention on that line and that hypothetical current limiting resistor I invented doesn't actually exist, there's going to be 100mA moving about, which neither Paula or the MCU are going to be capable of achieving or surviving.

I've only tried this on a (somewhat expendable) A500 so far. I'm too tense to try it on an A1200 or a CD32 properly yet.
I have an A600, but... ahem...

https://cdn.discordapp.com/attachmen...183043_DRO.jpg

I wonder if they deliberately omitted the screw wings to prevent any accidental 9-pin serial cable connections?

Amiga games are so much nicer with multiple buttons. Makes me wish Pleasance had worked out a deal with Sega or something: when marketing the Amiga, ring up Sega and get them to sell him a few hundred thousand Master System pads. They're basically made of nothing, so how much could they be? Stick one of those in every box! The Amiga would've had more two-button games, and everybody would've been happy.

Last edited by MrD; 02 September 2019 at 00:34.
MrD is offline  
Old 02 September 2019, 02:35   #11
dalek
Registered User
 
Join Date: Nov 2014
Location: NSW/Australia
Posts: 462
Understand wanting to do your own thing, but in case you haven't seen it a good starting point is: http://aminet.net/package/docs/hard/appe_v32
dalek is offline  
Old 02 September 2019, 03:09   #12
MrD
Registered User
 
MrD's Avatar
 
Join Date: May 2009
Location: UK
Posts: 111
Thanks appreciate it.
MrD is offline  
Old 05 September 2019, 14:33   #13
MrD
Registered User
 
MrD's Avatar
 
Join Date: May 2009
Location: UK
Posts: 111
2 Button mode was straightforward. 7 Button mode was a little more crossed-fingers, since I'm not certain the sequence of events that I'm asking the MCU to perform is strictly within specifications, but it is having the correct result.

(I'm using the SPI module to have the MCU emulate the CD32 pad's shift register behaviour, using the mode it has that allows MSB to appear on the data line as soon as JOYMODE (as /SS) is pulled low. But that would require me to dedicate FIRE2/DATAOUT to SPI output since the PIC seems to monopolise the outputs of enabled modules even if no SPI exchange is taking place, meaning it wouldn't have the dumb 2button behavior any more. However it seems that the early-first-bit behaviour considers the level of /SS rather than the falling edge, so if I very very quickly enable the entire SPI module only for the duration of FRAME and then disable it again, I can have the same behavior the CD32 pad shows where the FIRE2 pin is driven by Blue directly while JOYMODE is high, and then immediately transforms into a shift register when JOYMODE is low with JOYMODE already low which triggers the MSB (which is Blue anyway) appearing on the data line. When JOYMODE goes high again, an interrupt fires and disables SPI, returning the pin to gpio for FIRE2 output.)

https://imgur.com/a/BuxMmrY

7 Buttons in Amiga Test Kit! I'm trying all the games I can find one by one. Bubba & Stix has a Melee button, a Throw button... and it's still up to jump. Baffling.

You weren't kidding about the fire pins being squirrelly. Though Mr. Nutz works just fine as far as I can tell. (Does it even use the other buttons for anything?) The only game that hasn't worked well so has been Arabian Nights. I can't get past the difficulty select because the Fire1 doesn't want to be read. My 47R is too strong and it's not going low enough for long enough.

https://imgur.com/a/q4lpC9P

UDLR have 470R on them.
FIRE2/DATA and JOYMODE/FRAME now have 47R on them.
FIRE1/CLOCKIN has 47R but no luck. I've even tried making it 47R/3 = 16R but that's still too high. I think I might have to bite the bullet and just use a 0R and rely on the innate resistances of the board and connections to stop everything blowing up.

I did an ammeter reading of a grounded Fire1, which is coming out around 24mA, which is -huge- if I understand it right. It's approaching the safe limits of my PIC but it is doable. It's weird that the Amiga would fire so much current uselessly outwards just to read a value.

I should have a little faith that the 2018 tech PIC with its 5V tolerant pins is going to be a bit more hardy than a shift register from 1990.

Last edited by MrD; 05 September 2019 at 15:33.
MrD is offline  
Old 05 September 2019, 15:28   #14
MrD
Registered User
 
MrD's Avatar
 
Join Date: May 2009
Location: UK
Posts: 111
https://imgur.com/a/1seEQdA

Even without a safety resistor, AN doesn't recognise Fire1. How bizarre. My meter says it's going down to 0.25V but I guess the game is doing some potgo twiddling that's just too frantic for my board.
MrD is offline  
Old 05 September 2019, 15:37   #15
MrD
Registered User
 
MrD's Avatar
 
Join Date: May 2009
Location: UK
Posts: 111
Tried it with a real CD32 pad, red does nothing. I guess my device is being accurate

I put the 47R back as it was, moving onto other games.

Last edited by MrD; 05 September 2019 at 16:03.
MrD is offline  
Old 05 September 2019, 16:32   #16
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
Weird, pretty sure someone said it was max 100mA?
Photon is offline  
Old 06 September 2019, 01:35   #17
MrD
Registered User
 
MrD's Avatar
 
Join Date: May 2009
Location: UK
Posts: 111
I've been playing Guardian, The Chaos Engine, Microcosm, Marvin's Marvellous Adventure, Lamborghini American Challenge, and Brian the Lion on my CD32 with my adapter with the safety resistor in place. 100% success.

Now I need to figure out what I'm going to do with the dip switches. My plan was to use them to control things like 'disable Up' and 'map Square to Up' in dumb mode so you can use it easier with Up to Jump games. Autofire could be useful, but there's no reason why that can't be on R2 permanently, in either dumb or CD32 mode.

Is this gadget something folks would be interested in? I'll make a more detailed thread when I have nicer pictures and words to show.
MrD is offline  
Old 14 November 2019, 10:33   #18
Hungry Horace
Wipe-Out Enthusiast
 
Hungry Horace's Avatar
 
Join Date: Nov 2005
Location: .
Age: 43
Posts: 2,538
@MrD I’m interested in your finding and the understanding of how it work, but not the device so much (I have a couple of older one from others!)

My reason for interest is my dream of a universal, Mappable, dual inputs adaptor, controller by a Raspberry Pi or similar device..... my problem is a massive lack of understanding about how the different type of input signals work, and putting the hardware in place to make it work.

Reading this thread is therefore of great interest
Hungry Horace is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cute-em ups and the Amiga - hardware limits? Marle Retrogaming General Discussion 4 28 July 2018 15:06
Broken+5v supply on Amiga 2000 joystick ports tomead support.Hardware 2 08 March 2018 20:08
Current Mod scene for Amiga andyhants Amiga scene 3 15 October 2015 00:10
Best website for current Amiga modscene andyhants Amiga scene 4 25 November 2013 12:00
Ports-panel mouse/joystick selection Borg_Number_One support.WinUAE 3 27 November 2008 10:25

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:33.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09664 seconds with 16 queries