[sci.electronics] 6526 CIA chip problems?

gail@alberta.UUCP (Gail Miklos) (03/20/87)

An interesting problem:
----------------------
I added a Flash!(tm) disk drive enhancement to my Commodore 64 and 1541
disk drive years ago and have had no problem.... but then....
Recently I have added another 1541 disk drive and purchased the 2nd 
Disk Flash and the error rate on data transfer shot WAY UP!  
My old disk drive is the long-board model and the new one is a 
short-board model with a lever to close the door instead of a flap. 

The method:
----------
The method used by the Flash product is to utilize the
serial shift registers (which are unused) in the 6526 CIA chips 
in both the 64 and 1541s. New operating ROMs in all machines essentially
redirect the data through new wires that are attached to pins on the chips
(across machines).  There are only two lines and a ground to support the
data flow.  One line is a sync (CNT), and the other is data (SR). The lines are
bidirectional - so the same serial shifter is capable of sending and
receiving.  When attaching a second disk drive, the lines are hooked up
in parallel on the 64 side, so the same shift register
handles data transmission for both drives.  According to the specs on the
6526 CIA chip in the 64 Reference Manual this is possible.
The two pins for the shift register are open-collector or open-emitter
(or some other technical term) which allows the shift register to drive more
than one device by simply daisy-chaining the devices.

The symptoms:
------------
However, the world is not perfect, and nothing is that simple.
Attaching the second disk's lines to the 64 cause errors at a rate of 
about 1 in every 512 bytes.  If I disconnect one drive (either one) then 
there is are no errors in data transfer to or from the connected drive.
Only when both drives are attached, errors creep up suddenly.  What is 
worse is when both drives are connected but one is powered down:
Errors occur at a rate of about 1 in every 5 bytes from the powered up drive!!

The challenge:
-------------
  I need help from a hardware-kind-a-guy who knows a little about
6500 series chips,  preferably the 6526.  I notice (according to the
64's schematic in the reference guide) that although the lines are not
used for the serial shift register in the 64, they are pulled up with
3.3Kohm resisters to +5 volts.  Since the recommended method of
installation in the 1541 is to pry a 6526 pin out of its socket and connect
a wire to it, I know that there is no pull-up resistor on the 1541 side.
I wonder if this fact is causing a drain on the 64 side
whereby the 6526 cannot daisy-chain to more than one device.  Or
is it possible that the 6526 chip in the 64 is defective?
What do you think could cause such a problem?  I would be very
pleased to hear (via mail or news) any advice that could solve
this problem, since such a high error rate makes using the dual drives
unacceptable. Bryce Nesbitt (inventor of Flash) are YOU listening?

Thank you,
Scott McPhee

ch@well.UUCP (03/21/87)

	You're hooking up to a 6526 in the 1541?  Does FLASH! add a 6526
to the 1541 or are you connecting to a 6522?

What hardware changes to the 1541 are there with FLASH!?

What quality wire/cable are you using?  Maybe you need something with
better shielding...

There's nothing you can do about the problem with having one drive
turned off--So keep the other drive on or disconnect the cable from
that drive.

Make sure you don't remove the pullup resistors in the C64.


	Something else about the 6526:  There's a bug with the timer
interrupts--If you are polling the interrupt control register to check
for an underflow instead of responding to IRQs (IRQ masked), the read
of the ICR can clear the underflow bit before it is set, so the
underflow won't be detected...


With open-drain (or collector, as the case may be..) devices, it is
an absolute necessity that there be a pull-up resistor to +5V on
the outputs of all lines.  If you removed the pins of the 6526 inside
the 64 from their sockets, (bypassing the pull-ups and the USER PORT
connector), make sure that there are pull-ups for the lines in one
of the drives.

Hope this helps,
-- 
	Chris Hayes
			UUCP: ucbvax!dual!well!ch
			 OR : {hplabs, ptsfa, lll-lcc}!well!ch

russ@m-net.UUCP (03/26/87)

In article <1097@cavell.alberta.UUCP> gail@alberta.UUCP (Gail Miklos) writes:
>
>An interesting problem:
[description of how either drive works alone, but how interconnected
drives fail, and a powered-off drive really mungs things.]

This seems like it's not too hard:

1.)	When both drives are connected, the open-collector drivers in
	one drive suddenly have to sink the current from not one but
	two sets of pull-up resistors in order to pull the lines down
	to logic 0.

2.)	When one drive is off, its pull-up resistor is connected to
	ground (or close enough); the lines can't be pulled up to
	logic 1, and errors result.

Possible solutions:

1.)	a.)	Try disconnecting one set of pullups.
	b.)	Failing this, try increasing the current drain capability
		of the line driver by buffering it, so that it can drive
		the line even with multiple pullups connected.

2.)	a.)	Connect diodes (germanium, not silicon) in series with
		the pullup resistors so that they can't sink current
		when the drive is off.
	b.)	Don't try running with one drive off!
-- 
My employer gets all its opinions from me.  (My employer *is* me.)
                                   	|  Russ Cage, Robust Software Inc.
     The Moral Majority runs Iran.   	|      ihnp4!itivax!m-net!russ
NSA food> CIA DIA KGB rocket ammunition AK-47 dynamite atomic TEMPEST Hail Eris!