6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 7:34 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sun Sep 23, 2018 5:07 pm 
Offline

Joined: Sun May 13, 2018 5:49 pm
Posts: 255
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:
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.


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 24, 2018 12:50 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
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:
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?


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 25, 2018 2:41 am 
Offline

Joined: Sun May 13, 2018 5:49 pm
Posts: 255
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 33 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: