R6551 & Arduino

Building your first 6502-based project? We'll help you get started here.
Post Reply
ty9000
Posts: 8
Joined: 03 Nov 2021

R6551 & Arduino

Post by ty9000 »

Hello all! I've just started working on adding an R6551 to my 65c02 computer. I have read over some of Garth's RS-232 primer guide and just had a quick question - is it possible to use an Arduino as a RS-232 transmitter to an R6551 receiver without a line driver/receiver, like the MAX232? Thanks!
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: R6551 & Arduino

Post by floobydust »

Well, I guess my first question is:

What do you plan on using the 6551 for? Is it as a console or just an I/O device to communicate with another machine? Second question: what is your preferred method of connecting the 6551 to another device (or machine)?

Last I checked, I don't think an Arduino has a +/- 12-volt supply or I/O pins that would be able to provide the RS-232 voltage levels, as you mentioned using it in place of a MAX-232 level converter.

If you want to attach it as a serial device to a typical computer, there are numerous USB to Serial interfaces available from FTDI and other vendors. As most newer machines do not have serial ports (aka RS-232 ports), these interface devices will give you a serial port via a USB port. This can allow direct TTL level attachment between the 6551 and the USB to serial interface.

Not sure if this helps, but perhaps you can be more specific in what you're trying to accomplish.
ty9000
Posts: 8
Joined: 03 Nov 2021

Re: R6551 & Arduino

Post by ty9000 »

To start with, I just wanted to get it working - that is, load data into RAM from an Arduino. I was thinking since the 6551 chip is TTL, the Arduino could send bits to the RxD pin directly. I don't really understand how the 6551 chip works, to be honest. Reading over the 6551 datasheets doesn't seem to click with me, for some reason.

It sounds like using the USB to Serial might be a similar situation, then? Using TTL level voltage to send bits?

Thanks for the assistance!
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: R6551 & Arduino

Post by floobydust »

Okay, I agree that you're not quite aware of how the 6551 works... no problem. In short, the 6551 is a serial controller, meaning it allows serial communication at various baud rates with the usual RS-232 signals. Before it will operate, it needs to be configured for things like baud rate, number of data bits, parity, stop bits, etc. Unless you configure it first, it doesn't do anything.

As you're looking to use an Arduino to load some level of initial code into RAM (others have done this), you would need to halt the processor and tristate the address and data lines (from the processor), which would allow the Arduino to control the address lines and push data into memory. Once that's done, you un-tristate the address and data lines and then let the processor come out of Reset.

Note that the 65C02 datasheet is your friend... control lines like Reset, RDY, BE are specific ones to read up on. As for the Arduino, I'm guessing you're already familiar with that, so you can likely put something together to interface to the 6502 system.

Do some searching on the forum.... you'll find that others are loading RAM from other machines... Gordon (Drogon on the forum) comes to mind with his Ruby systems.
ty9000
Posts: 8
Joined: 03 Nov 2021

Re: R6551 & Arduino

Post by ty9000 »

Sorry! I know I'm not being very clear on what I am asking for; that's my fault. I did read over the 6551 datasheet and added some code to initialize it, setting up the command and control registers for parity, baud rate, echo, and all that. I made sure to read back the registers to make sure my hardware address decoding works and it does. I have previously used an Arduino connected to a 65c22 to bit-bang data into RAM after pressing a physical button and that works (more or less). It loads all the data into RAM and then jumps to the data's entry point.

I want to now add the RS-232 style of adding bytes into RAM, similarly by pushing a button (for now and for testing). I know the RS-232 standard uses ~12 volts and uses a line driver/receiver to drop it down to 5 volts. I think that is correct? Maybe my understanding is flawed?
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: R6551 & Arduino

Post by floobydust »

So you have some ROM (EPROM/EEPROM) in the system already? How about posting a schematic and what it is you're doing code-wize.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8775
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: R6551 & Arduino

Post by GARTHWILSON »

ty9000, I have not gotten into Arduino, but I suspect it does not have the RS-232 line drivers and receivers, but instead just uses TTL signal levels, making it less bulletproof but perhaps more convenient. This has become quite common in recent years, particularly as most PCs don't have RS-232 ports anymore. The '51 itself just operates with the TTL levels too. It doesn't know or care if you're using line drivers or receivers. If that's what the Arduino also does, you should be able to hook them up straight across. The FTDI converters which floobydust mentions come in different versions, with and without line drivers and receivers. Just make sure you get the right one.
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?
ty9000
Posts: 8
Joined: 03 Nov 2021

Re: R6551 & Arduino

Post by ty9000 »

GARTHWILSON wrote:
ty9000, I have not gotten into Arduino, but I suspect it does not have the RS-232 line drivers and receivers...
No, I don't think Arduinos have line drivers/receivers - some of the larger ones have multiple Serial interface ports (Tx and Rx) where the baud rate can be defined, whereas smaller ones need to have a second Serial interface created via software (not the most optimal solution). But yes - I'm pretty sure it's just a digital 5v or 0v signal at any point in time.
GARTHWILSON wrote:
If that's what the Arduino also does, you should be able to hook them up straight across. The FTDI converters which floobydust mentions come in different versions, with and without line drivers and receivers. Just make sure you get the right one.
Okay, that's what I thought since the Arduino can send +5v or 0v from its digital pins. I figured if I went this explicit route, I would technically never be able to hook it up to a "real" computer via RS-232 cable since I don't have the line driver/receiver. I did find many USB/UART devices online that have a FT232RL chip in them, so I might go that route too. It may be easier in the long run since I can just use a PuTTY or something akin to that and it'll just natively "work."
Post Reply