Rockwell R65C51P2 and handshaking issues

Building your first 6502-based project? We'll help you get started here.
Post Reply
SamCoVT
Posts: 344
Joined: 13 May 2018

Rockwell R65C51P2 and handshaking issues

Post by SamCoVT »

I'm trying to implement hardware handshaking on an R65C51P2 on a 1MHz 65C02 SBC. My ACIA has been working fine with no hardware handshaking, although it drops characters if the CPU is busy and not polling the ACIA, as expected. I've been playing with bringing the RTS line high (connected to CTS line of FTDI cable) to get the computer to pause transmission. I've already discovered that the FTDI adapter will transmit up to 3 more characters after it sees it's CTS line go high (datasheet says 0-3 extra characters, but I've always seen three), and I plan to add a software receive buffer to deal with that, but I've run into this issue first:

After bringing the ACIA's RTS line high, the ACIA stops transmitting after a little while, and the "tx buffer empty" bit in the status register never goes high. Sometimes I can transmit for a little while longer and sometimes it stops immediately after bringing the RTS line high.

I've o'scoped out my address and data lines, and I find that I'm stuck in my code that waits for the TX buffer to be empty, but that bit stays a zero (the entire status register is all zeroes for that read). Please note this is not the same as the WDC bug where that bit is stuck high. In my case, the bit stays low. I've checked the CTS input to the ACIA (hooked up to the RTS line on the FTDI adapter) and it stays low the entire time. I've checked the ACIA oscillator and it stays stable the entire time. I have Pin 11 (DTR) floating (although it stays low after initialization). Pins 16 and 17 (DSR and DCD) are tied to GND, and my chip select comes from a GAL (25ns).

Here is the code I get stuck in:

Code: Select all

Send_Char:
	pha                         ;Save A (required for ehbasic)
	sta ACIA_DATA
wait_tx:			            ; Wait for the TX buffer to be free.    
	lda ACIA_STATUS
	and #$10
	beq wait_tx		            ; TRDE is not set - byte still being sent.
	pla	
	rts			               
I'm stuck in the tight loop at wait_tx. I probed the address lines to see what code I was running, and probing the data lines shows that this code gets a $00 into A every time.

I happen to have an RCA CDP65C51E2. When I swapped this in, I discovered that this IC needed the 1Meg resistor across the crystal and a little capacitance (10nF) on the XTLO pin as well to get it to oscillate. Once I made the oscillator happy, this chip works fine! Putting the Rockwell R65C51P2 back in displays this same funny behavior.

I tried a 4MHz clock on my SBC to see if that made a difference (even though both ACIAs are 2MHz parts) and I get the same behavior. Both ACIAs work when not using the handshaking. The Rockwell part stops transmitting a short time after bringing it's RTS output high, but the RCA part works fine.

I know some of the folks on this forum use the Rockwell parts - has anyone else seen this behavior? I'll be leaving the RCA part in my 65C02 computer for the time being, but I would like to figure out what's wrong when using the Rockwell part.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8775
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Rockwell R65C51P2 and handshaking issues

Post by GARTHWILSON »

I've been using CMD [1] 65c51's and have never had any trouble with them except when I didn't have the capacitor in the crystal circuit. [2] I think the only time I used the Rockwell '51 was in the late 1980's, for a tape modem, so there was no need for any handshaking. I don't think I have the source code anymore to see what I might have told it to do with RTS\. No, come to think of it, those were probably Synertek. I do have the source code for the automated test equipment I made about 1990; but I don't seem to have any information anymore as to what brand of 65Cxx ICs were on the Cubit 7540 STD-bus 65c02-based SBC I used. What you're saying does not go with what the Rockwell data sheet says. Rockwell's has probably the most complete data sheet for the '51 of any of the manufacturers. Do you have another R65C51 one to try? (I can't think of any kind of damage that would cause what you're saying though.)

If I may suggest this: If you do the polling before storing the byte instead of after, the processor will spend less time twiddling it thumbs, because more of the sending time will be spent while the processor can be doing something else useful. Depending on what all is going on, throughput may be better.

Code: Select all

Send_Char:
      PHA
         BEGIN
            LDA  ACIA_STAT
            AND  #$10
         UNTIL_NOT_ZERO
      PLA
      STA  ACIA_DATA
      RTS
 ;-------------

(With my program flow-control structure macros, BEGIN is just a marker for the assembler to remember the address which it will need for the BEQ instruction later when it gets to the UNTIL. BEGIN does not lay down any code. The UNTIL_NOT_ZERO lays down the BEQ instruction. UNTIL_NEQ does the same thing.) Actually the set of macros offers a couple of additional ways to do it as well.


[1] California Micro Devices, previously called GTE Microcircuits, and then ON Semiconductor acquired CMD nine years ago
[2] BTW, I hope you meant 10pF, not 10nF. According to the data sheet, 22pF would more likely be about right; but it depends on the crystal.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
SamCoVT
Posts: 344
Joined: 13 May 2018

Re: Rockwell R65C51P2 and handshaking issues

Post by SamCoVT »

Thank you, Garth, for your suggestion. I will definitely swap my code around so that it waits for the TX buffer to be empty first. That makes good sense to me. I'm running Forth (Scot's Tali Forth 2) on this hardware, so it has to go and do some stack gyrations before it's ready to give the ACIA another character anyway.

I did mean 10pF - thanks for the correction. I already had 30pF on the XTLI pin, but the RCA 65C51 wanted some capacitance on the other pin as well and needed a 1Meg across the crystal to reliably start up every time. I don't have much for caps this small, so I've been stacking 10pF caps to get to 30pF. I'll have to order some in the right size. I normally have some 22pF laying around just for crystals, but it seems my lifetime supply of 50 caps finally ran out. :D

Unfortunately, I only have the two 65C51's, so I wasn't able to troubleshoot much further. At least I have one that seems to work correctly, so I'll be proceeding with that one installed. It's entirely possible that I accidentally damaged the Rockwell part. I did have a few wiring oopsies along the way to getting a working 65C02 computer, and most of the parts I am using are "pre-owned".

I'd like to run the board at 4MHz, so I'll look for a 4MHz or faster rated part, and perhaps that will help decide if my Rockwell part belongs in the trash or not.
Post Reply