Testing Beeb's analogue port

for bbc micro/electron hardware, peripherals & programming issues (NOT emulators!)
Post Reply
steve3000
Posts: 1839
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Testing Beeb's analogue port

Post by steve3000 » Fri Apr 06, 2018 5:38 pm

My issue 3 beeb has been exhibiting strange behaviour from it's ADC recently. I first noticed this when I plugged a set of Acorn dual analogue joysticks in to test the analogue port. Playing 'Dogfight' I found that neither joystick responded with the direction controls, but the fire buttons both worked.

As a quick test, I swapped the D7002C ADC with an untested spare. With the spare in place, one of the joysticks worked perfectly, but the second still didn't respond with the direction controls.

I replaced the original D7002C, to see if maybe some socket contamination/corrosion was the cause of this strange behaviour. But now with the original chip in place the computer hangs completely on startup. With no ADC inserted, or the spare ADC inserted, the computer boots fine.

Think I need to test the analogue port properly. Does anyone have a good guide, or suggestions on how to do this from BASIC?
Last edited by steve3000 on Sun Apr 08, 2018 12:34 pm, edited 1 time in total.

RobC
Posts: 2187
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: Testing Beeb's analogue port

Post by RobC » Fri Apr 06, 2018 5:59 pm

steve3000 wrote:Think I need to test the analogue port properly. Does anyone have a good guide, or suggestions on how to do this from BASIC?
Have a look at the BASIC ADVAL keyword in the User Guide. ADVAL(0) will test the fire buttons, ADVAL(1)-ADVAL(4) will test the X and Y channels of the sticks.

OSBYTE &80 is the equivalent OS call - there's some sample code on the Retrosoftware site that uses it.

User avatar
MartinB
Posts: 4706
Joined: Mon Mar 31, 2008 9:04 pm
Location: Obscurity
Contact:

Re: Testing Beeb's analogue port

Post by MartinB » Fri Apr 06, 2018 6:05 pm

For a quick test, I just use this....

Code: Select all

   10 PRINT~ADVAL(0)AND3;" ";~ADVAL(1);" ";~ADVAL(2);" ";~ADVAL(3);" ";~ADVAL(4)
   20 GOTO10
When run, the fire buttons are reflected in the first column as 0,1, 2 or 3 depending on the combination of the two being pressed and the other four columns, as two pairs, represent the X and Y deflection of each joystick in hex. The latter will range from a low hex number to a high one as you move the sticks - I can't remember the exact limits but it should become obvious as you play.

( EDIT : I /think/ the X and Y range you should see is $10 to $FFF0 but those extremes could be slightly narrowed by joystick type. )

steve3000
Posts: 1839
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: Testing Beeb's analogue port

Post by steve3000 » Fri Apr 06, 2018 7:31 pm

Brilliant, thanks both, will try this tonight!

Are there any other standard tests with documented expected results eg. using resistors of known values, and reading the results? (only because I'm slightly suspicious of the joysticks themselves!)

User avatar
tricky
Posts: 2466
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Testing Beeb's analogue port

Post by tricky » Fri Apr 06, 2018 7:49 pm

You could try a pair of 10Kohm resistors (anything upto about 1Mohm should still work) with one end of each in the channel to test and the others ends, one in GND and one in Analogue V (~1.8v) not the 5v in the corner. Expect about &8000.
If the joysticks haven't been used recently, they will probably need a waggle to get them working, like an old volume control that is scratchy until the surface has rubbed clean again.
I can't remember which issue boards have the ADC socket soldered and which are a "press" fit, thelatter probably also need a clean, but be careful as the screws don't screw into much and you can easily strip the threads.

PS The values are never completely steady as the ADC chip is either 10 or 12 bits and you are looking at 16.

User avatar
MartinB
Posts: 4706
Joined: Mon Mar 31, 2008 9:04 pm
Location: Obscurity
Contact:

Re: Testing Beeb's analogue port

Post by MartinB » Fri Apr 06, 2018 7:50 pm

As often as not, problems with the analogue port are due to cracked joints at the motherboard_to_15-way connector interface due to repeated waggling when plugging and unplugging joysticks. It generally doesn’t lead to ‘crashing’, just joystick-related intermittency and weirdness, but IMHO resoldering of this connector should always be on the standard refurbishment list.

User avatar
tricky
Posts: 2466
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Testing Beeb's analogue port

Post by tricky » Fri Apr 06, 2018 7:56 pm

I have had several non-working ADC ports, but all but one recovered with cleaning the socket or reseating/resoldering as Martin says. The other was a dead chip, Mark sold me a new one at a good price.

steve3000
Posts: 1839
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: Testing Beeb's analogue port

Post by steve3000 » Fri Apr 06, 2018 10:58 pm

Thanks all. I've had time to investigate this further. First, using Martin's example code and tricky's information, I've determined the following about my dual joysticks and two ADC chips:

1) one of my joysticks has an intermittent fault :(
2) both my ADC chips are fine when the joysticks are working, but one seems prone to hang the machine when the joystick is misbehaving.

To investigate the joysticks, I found this useful note: http://chrisacorns.computinghistory.org ... AN/021.pdf

Then I examined my suspect joysticks using my multimeter and found that there is an intermittent break in the connection for analogue ground pin 8. A bit of rigorous cable waggling located the break to just before the cable enters the moulded connector to the computer.

So now I'll replace the 15 pin connector and hopefully that'll solve the problem completely :)

Not sure why one of the ADCs seems to hang the computer. It's the older of the two chips, from 1982 (the later chip is from 1984) and it only causes problems when the joystick isn't functioning (i.e. analogue ground disconnected). Possibly they'd both hang the computer given the same erroneous input, but in my limited testing I only saw this with the one chip...?

User avatar
MartinB
Posts: 4706
Joined: Mon Mar 31, 2008 9:04 pm
Location: Obscurity
Contact:

Re: Testing Beeb's analogue port

Post by MartinB » Sat Apr 07, 2018 8:22 am

Apart from scrambling the data bus, which is highly unlikely I feel, the only way the ADC could potentially 'hang' the Beeb would be by it's generating permanent or continuous End of Conversion (EOC) interrupts (or strictly Events to the OS) which might possibly drag the OS into a tight servicing loop. I guess if your suspect joystick is screwing around with the ADC's ground reference and maybe also therefore its 0v line in some way, perhaps this is causing an apparent permanent low EOC. There are FX calls to individually enable and disable events (*FX 13 &14 - see AUG), one of which is the ADC EOC so it would be interesting to see whether the duff joystick/suspect ADC could still crash the Beeb with the EOC event disabled.

User avatar
1024MAK
Posts: 7439
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Testing Beeb's analogue port

Post by 1024MAK » Sat Apr 07, 2018 11:06 am

To be fair, open circuit or intermittent open circuit faults are fairly common on multiway/multicore cables where they enter moulded connectors. Especially common with joysticks to the Atari 'standard' where the cable enters the moulded 9 pin D-type socket. Or where the cable enters the base of the joystick.

An intermittent open circuit fault on the analogue ground is very likely to confuse the ADC chip. It can only convert one channel at a time. Normally when used in a Beeb, it completes a conversion on a channel, then moves to the next channel (under the control of the OS). Once all channels are done it starts the process all over again. After every conversion, it signals that a new result is available.

Because of the way it converts the analogue voltage, if the input voltage moves too fast, it will think it has finished the conversion. When the analogue ground connection goes open circuit, all the previously connected analogue outputs from the joystick will jump up to the reference voltage. Thus confusing the ADC...

BTW, it's a 12 bit ADC. But usable resolution is normally considered to be only 10 bit.
Datasheet is here :wink:

Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

User avatar
1024MAK
Posts: 7439
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Testing Beeb's analogue port

Post by 1024MAK » Sat Apr 07, 2018 11:23 am

Found a more detailed datasheet here :wink:

Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

steve3000
Posts: 1839
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: Testing Beeb's analogue port

Post by steve3000 » Sun Apr 08, 2018 12:33 pm

Quick update. I'm still getting some strange behaviour from the ADC on my issue 3 beeb...

The original (suspect) ADC chip still appears to crash the computer occasionally even without the joysticks plugged in! But if I swap it for the known-good ADC from my issue 7 beeb, then the computer seems stable with and without the joysticks.

Now the interesting part... with the known-good ADC plugged in, I've been running a modified version of Martin's test code above, to show the maximum and minimum values recorded for each channel, along with the current value - as pay off my test of the joysticks. But when I tried this with no joysticks plugged in, I see something strange. For ADVAL(0), (2) and (3) the values are fixed (max=min) and don't change at all - consistent with nothing plugged in. However, for ADVAL(1) and (2) I'm seeing constantly changing values. ADVAL (1) varies between &C800 and &DA90, and ADVAL (2) varies between &C2A0 and &D310. (Also worth noting the values of both max and min for each channel increase with time, so I get higher values if I rerun the program...)

Am I right in thinking this is not what I should expect?

FYI - I've also reflowed the solder for the port and IC73 socket on the issue 3, as per Martin and tricky's suggestion, but this hasn't fixed the issue. :(

User avatar
1024MAK
Posts: 7439
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Testing Beeb's analogue port

Post by 1024MAK » Sun Apr 08, 2018 1:33 pm

The analogue inputs are hi-impedance and have no bias resistors, so with nothing connected they may float at any value, but will also pick up interference or static charge from other nearby circuits/conductors.

If you are getting strange results, if the PCB is not spotlessly clean, you could try cleaning this area of the board. It's surprising how much leakage current can flow through dirt and grime.

Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

dp11
Posts: 797
Joined: Sun Aug 12, 2012 8:47 pm
Contact:

Re: Testing Beeb's analogue port

Post by dp11 » Sun Apr 08, 2018 1:59 pm

If you want to see a little more about leakage causing problems : https://www.youtube.com/watch?v=dftkoD7LG0A

User avatar
1024MAK
Posts: 7439
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Testing Beeb's analogue port

Post by 1024MAK » Sun Apr 08, 2018 2:13 pm

I've just run a test on my issue 7 ex-school Beeb:-
IMG_6699.JPG
Test Results #1 (in MODE 7)
IMG_6700.JPG
Test Results #2 (in MODE 1)
Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

steve3000
Posts: 1839
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: Testing Beeb's analogue port

Post by steve3000 » Sun Apr 08, 2018 4:29 pm

Very interesting, thanks Mark. In that case, maybe channels 2 and 3 are the 'strange' ones, as they both sit perfectly at &FFF0 with no change.

Either way, I'll take a good look at the pcb later - it was in terrible condition when I recieved it early last year, and has already had a good scrub, so thought it would be ok, but likely needs some more...

User avatar
1024MAK
Posts: 7439
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Testing Beeb's analogue port

Post by 1024MAK » Sun Apr 08, 2018 5:00 pm

If some channels always sit at a constant value, that's very odd. As reading working channels always results in a changing figure due to the two lowest bits being noisy (that's why even though the chip is a 12 bit ADC, it's only considered to have a 10 bit resolution). Hence the blurred figures in one of my photos.

Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

User avatar
tricky
Posts: 2466
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Testing Beeb's analogue port

Post by tricky » Sun Apr 08, 2018 5:53 pm

Don't worry if unconnected channels follow connected ones a little, at least they do for me ;)

Post Reply