6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Sep 20, 2024 9:34 am

All times are UTC




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Problem adding R65C51
PostPosted: Sat Dec 24, 2016 11:07 pm 
Offline

Joined: Sat Dec 24, 2016 11:00 pm
Posts: 29
Location: Southern California
Over the last couple of weeks, I've been working on my first 6502 SBC project, with much guidance from documentation on here. I'm tremendously grateful to those of you who've shared your wisdom online! I've gotten stuck, though, and need some guidance. As I had suspected, the problems came when I tried to add serial I/O using a (Rockwell) 65C51.

On my solderless breadboard, I had a WDC 65C02 clocked at 1MHz, a 32K SRAM, and a 32K EEPROM. These were all working fine and successfully running tests that let me use address line activity to montitor what was happening.

Then I added my R65C51, connecting to a USB port on a laptop via the FTDI cable (which has a built-in FT232R). I have a test program that loops around writing a test message and waiting for input. However, nothing produces any input or output on the remote end. (A second test program that repeatedly transmits a periodic test message also fails to produce any visible results.)

I've re-run my ROM/RAM tests to confirm that I didn't screw up the parts that were already working when I added the UART. I've also tried two different 6551s -- one 65C51 and one NMOS 6551 (which I ordered by accident -- not sure if mixing these is a good plan generally)? That didn't help, although the behavior they exhibit is slightly different; with the 65C51, an LED attached to the transmit line shows pretty solid on, which isn't true when I use the NMOS part (it's solidly off for that one.)

I've verified that the separate 1.842MHz clock input for the 6551 is good, and that the PHI2 that's reaching it is also good. I've confirmed that the serial communication configuration is correct on both ends (19200 baud, 8N1).

For the cable, I'm just using the Rx and Tx lines; I'm not using any hardware handshaking. (There's a VCC and a GND on the cable but I'm presuming that they are more for supply, via the USB side; connecting the cable GND to my GND changes nothing.) I know that the cable is basically good; looping Tx and Rx produces an echo on the terminal emulator.

On the 6551, the handshaking lines are all tied to GND via resistors. IRQB is tied high through a resistor.

Questions:

Have I configured this cable correctly? Although VCC is 5V, the signals are meant to be 3.3V I think... I'm hoping that this is okay. (I've got an FD232R breakout board on the way which might be easier to debug.)

Am I handling the handshaking lines on the 6551 correctly?

Might I have simply screwed up wiring things on the 6551 and fried it? (I suspect not since neither one works and I've tried to be working static-clean.) Any way to be confident that the 6551 is still working?

Any common lunkhead errors that I might have made? (I'm a software person, not a hardware person, so no mistake is so dumb that I might not have made it.)

And any advice on how to go about debugging this? I don't have a scope here, unfortunatly, although if I can't resolve this soon I might go pick one up from work...

Many thanks in advance.


Last edited by dourish on Sun Dec 25, 2016 7:58 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 25, 2016 3:17 am 
Offline

Joined: Wed Jul 20, 2016 2:14 am
Posts: 78
Location: Irkutsk, Russia
Hi.
Could you draw your schematic diagram? At least, address decoder and memory map.
Vladimir


Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 25, 2016 3:36 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
dourish wrote:
Over the last couple of weeks, I've been working on my first 6502 SBC project, with much guidance from documentation on here. I'm tremendously grateful to those of you who've shared your wisdom online! I've gotten stuck, though, and need some guidance. As I had suspected, the problems came when I tried to add serial I/O using a (Rockwell) 65C51.

First thing to do when you get stuck on a hardware issue is to post a clear schematic here so we can see how you've got things hooked up. BTW, please post it in monochrome. :D

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 25, 2016 6:15 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8510
Location: Southern California
Welcome! And merry Christmas.

CTS\ has to be low for the transmitter to operate, and DCD\ need to be low for the receiver to operate; but don't ground the handshake outputs (RTS\ and DTR\). (It's ok through a resistor; but there's really no point.) Make sure the R/W and chip-select inputs on the '51 are valid and stable before Φ2 rises. You cannot gate these with Φ2 and expect it to work.

Make sure you heed the related chapter in the 6502 primer at http://wilsonminesco.com/6502primer/IO_ICs.html and the 6502-related article on RS-232 at http://wilsonminesco.com/RS-232/RS-232primer.html .

_________________
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: Sun Dec 25, 2016 6:52 pm 
Offline

Joined: Sat Dec 24, 2016 11:00 pm
Posts: 29
Location: Southern California
Thanks for suggestions. I'm attaching the relevant parts of the schematic. I hope you'll forgive my hand-drawn version... I'm not sure what tools people normally use for these?

The address decode logic is based on a circuit from Garth's primer. This works successfully in the other tests I've done that switch between code in RAM and ROM. The 6551 isn't slaved to PHI2.

I'm likely tying some lines that I could ignore up or down on the 6551. All the resistors are 3.3kO.

Anything obviously wrong here?

Thanks again -- and Merry Christmas to everyone!

[An update: As Hobbit1972 noted later, I messed up on one label when drawing the 6551 schematic. For "TxC", read "/DTR". Sorry!]


Attachment:
6551schematic.jpeg
6551schematic.jpeg [ 264.86 KiB | Viewed 2647 times ]


Last edited by dourish on Sun Dec 25, 2016 7:57 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 25, 2016 7:28 pm 
Offline
User avatar

Joined: Tue Feb 10, 2015 5:27 pm
Posts: 80
Location: Germany
Merry Christmas!


IRQ, DTR, RTS are outputs, so no need to pull them down.

What do you mean with TxC? 6551 has no such pin. But DTR is missing in your schematics.

The datasheet and the schematics I looked up don't have the capacitor on XTAL.

Did you make sure that TxD and RxD are not swapped? so that ACIAs output goes into PCs input and vice versa?

Can you read & write the command register?


Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 25, 2016 7:37 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1382
Which FTDI cable setup are using? Is it RS232 level, 5V (TTL) level or 3.3V level? They (FTDI) make all three. I always use RTS/CTS handshaking (5-wire interface) from the 65C51 to a FTDI USB/Serial that has 5V TTL interface signals. Nothing inherently wrong with the schematic but it's not exactly complete, i.e., the FTDI part is still a mystery. What is your init code look like and what does your Xmit routine look like?

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 25, 2016 7:53 pm 
Offline

Joined: Sat Dec 24, 2016 11:00 pm
Posts: 29
Location: Southern California
Hobbit1972: TxC was a stupid mistake on my part when I was doing the schematic. Apologies! Yes, there's no such pin. The missing pin on the schematic is DTRB, which is not connected. In case I got TxD and RxD the wrong way around, I've swapped them back and forth each time I've had a different test, but with no luck. Adding the capacitor with the crystal was in line with one of Garth's circuits in his primer. I haven't tried to see if I can read from the control register, though; that's a good idea and I'll try it out (although of course I lack any other source of output right now, other than address line hacks!)

Floobydust: It's a 3.3V cable, although it claims to be 5V compliant. In particular, it is this one: https://www.adafruit.com/products/70. I've tested the transmit code in the SYMON simulator, and it worked fine there (slightly different ACIA address, although in fact it's mirrored in my design anyway). Here are the initialization and transmit parts of the code:

Code:
main
init_acia

  lda #%00001011                ;No parity, no echo, no interrupt
  sta ACIA_COMMAND
  lda #%00011111                ;1 stop bit, 8 data bits, 19200 baud
  sta ACIA_CONTROL

write
  ldx #0

next_char
wait_txd_empty 
  lda ACIA_STATUS
  and #$10
  beq wait_txd_empty
  lda text,x
  beq pause
  sta ACIA_DATA
  inx
  jmp next_char


(The rest of the code just implements a delay loop and then repeats the transmission.)


Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 25, 2016 8:51 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
dourish wrote:
Adding the capacitor with the crystal was in line with one of Garth's circuits in his primer. I haven't tried to see if I can read from the control register, though; that's a good idea and I'll try it out (although of course I lack any other source of output right now, other than address line hacks!)

Verify that you can write a bit pattern to the control register and read it back before anything else. If that fails then you need to troubleshoot your glue logic. Watching /CS1 with your logic probe while you've got the MPU in a read loop would be a good idea. If you can see that the device is being selected then you may have a defective part.

One other thing to try if you suspect your crystal isn't oscillating or isn't oscillating at the correct frequency is to substitute a 1.8432 MHz can oscillator, which is what I would have used right from the get-go. Cans always work, whereas crystals can on occasion be temperamental. Connect the can's output to XTLI and leave XTLO floating.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 25, 2016 9:31 pm 
Offline

Joined: Sat Dec 24, 2016 11:00 pm
Posts: 29
Location: Southern California
I just did a quick test in line with the suggestions here, and confirmed that I can successfully write a pattern to the control register and read it back again. So, the chip select, data lines, and address lines would seem to be working? I'll do some more testing on that tomorrow -- but for now, I've got a Christmas dinner to cook.

Many thanks for all the suggestions to date. Keep 'em coming!

_________________
Mite 6502: http://www.dourish.com/projects/mite.html


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 26, 2016 3:56 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
dourish wrote:
I just did a quick test in line with the suggestions here, and confirmed that I can successfully write a pattern to the control register and read it back again. So, the chip select, data lines, and address lines would seem to be working? I'll do some more testing on that tomorrow -- but for now, I've got a Christmas dinner to cook.

Many thanks for all the suggestions to date. Keep 'em coming!

Did I hear dinner? I'll be right over! :D

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 28, 2016 7:34 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1382
You should also check the interface connections for the FTDI board. What are you doing with RTS/CTS from that? I would recommend a 5-wire interface... RTS/CTS plus Receive/Transmit and ground between the 6551 and FTDI interface. I used this configuration with ExtraPutty configured for RTS/CTS handshaking.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 28, 2016 7:37 pm 
Offline

Joined: Sat Dec 24, 2016 11:00 pm
Posts: 29
Location: Southern California
Thanks! It's going to be a few days until I can get back to working on this but I'll try it out. (I've also just gotten hold of a 5V FTDI cable which is likely a better option too.)

You just tie the GND line of the FTDI cable to the GND of the 6551?

_________________
Mite 6502: http://www.dourish.com/projects/mite.html


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 28, 2016 7:43 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1382
Cool, 5V version is what I've been using for years. Basic null-modem config:

Gnd to Gnd
RTS to CTS
CTS to RTS
RCV to XMT
XMT to RCV

That's it.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 28, 2016 7:45 pm 
Offline

Joined: Sat Dec 24, 2016 11:00 pm
Posts: 29
Location: Southern California
Since the 6551 pins are labelled as /RTS and /CTS, do I need to invert the signals between there and the FTDI cable?

_________________
Mite 6502: http://www.dourish.com/projects/mite.html


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 62 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: