6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon May 20, 2024 5:39 am

All times are UTC




Post new topic Reply to topic  [ 15 posts ] 
Author Message
PostPosted: Fri Mar 26, 2021 4:06 am 
Offline

Joined: Thu Apr 14, 2016 2:13 pm
Posts: 9
So I'm trying to hook up a Rockwell 6551 to my ben eater breadboard computer and after looking through the datasheet, I'm still a bit confused. Here is the datasheet for reference http://pdf.datasheetcatalog.com/datasheets/2300/501026_DS.pdf.

On the first page in the features section, it mentions that it operates at either 1mhz or 2mhz, which I assume to mean it only supports a 1mhz or 2mhz phi0. Later in the datasheet it mentions needing a 1.8432mhz crystal oscillator for XLT0 and XLT1 or its possible to just use XLT1 and leave XLT0 floating. There isn't a whole lot of detail here. Does anyone have experience with this chip? I'm using a 1.8432 mhz chip for my system clock already, would it be possible to connect that line to phi0 and XLT1 and leave XLT0 floating, or does phi0 need to be 1 or 2 MHZ?


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 26, 2021 4:15 am 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1373
The 1- or 2MHz refers to the speed rating of the chip along with the CPU, which is the phase2 clock that the 6551 gets from the CPU. The XTLI and XTLO refer to the baud rate clock which is used to derive the serial baud rate that is configured for send/receive.

You do need a 1.8432MHz baud clock, otherwise the baud rates won't be standard rates based on the configuration. In general, you can use a (1.8432 MHz) crystal between XTLI and XTLO. If you want to use a clock oscillator instead, you should use XTLI for the input and leave the XTLO (which is an output) floating.

Hope this helps.

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


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 26, 2021 4:23 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8440
Location: Southern California
I see floobydust posted while I was typing, but I'll post anyway. The MHz rating is that maximum phase-2 clock rate it is guaranteed to run and meet the timing margins at. It can probably go quite a lot faster than that at room temperature; it's just not guaranteed. The 1.8432MHz input is separate, and is used to derive the standard RS-232 baud rates. You can deviate from that and it will work, but the baud rates won't be standard, meaning you'll get errors if you try to connect to equipment that is on a standard speed. You can also use the separate 16x clock input for other speeds, like feeding it 500kHz to get 31.25kbps for MIDI, which I've done.

_________________
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: Sat Mar 27, 2021 2:14 pm 
Offline

Joined: Thu Apr 14, 2016 2:13 pm
Posts: 9
GARTHWILSON wrote:
I see floobydust posted while I was typing, but I'll post anyway. The MHz rating is that maximum phase-2 clock rate it is guaranteed to run and meet the timing margins at. It can probably go quite a lot faster than that at room temperature; it's just not guaranteed. The 1.8432MHz input is separate, and is used to derive the standard RS-232 baud rates. You can deviate from that and it will work, but the baud rates won't be standard, meaning you'll get errors if you try to connect to equipment that is on a standard speed. You can also use the separate 16x clock input for other speeds, like feeding it 500kHz to get 31.25kbps for MIDI, which I've done.


floobydust wrote:
The 1- or 2MHz refers to the speed rating of the chip along with the CPU, which is the phase2 clock that the 6551 gets from the CPU. The XTLI and XTLO refer to the baud rate clock which is used to derive the serial baud rate that is configured for send/receive.

You do need a 1.8432MHz baud clock, otherwise the baud rates won't be standard rates based on the configuration. In general, you can use a (1.8432 MHz) crystal between XTLI and XTLO. If you want to use a clock oscillator instead, you should use XTLI for the input and leave the XTLO (which is an output) floating.

Hope this helps.


Thanks for the replies. Sorry I'm still a bit new to all of this. What is the difference between a crystal and a clock oscillator? I've got a few of these metal can looking crystal oscillators. One of them is 1MHz and one of them is 1.8432 MHz. I've been using this 1.8432MHz can as my system clock for my computer. So what I'm wondering is if I can run my system clock to pin 27 (phi2) and then just use a jumper between pin 27 and pin 6 (XLT1) and leave pin 7 (XLT0) floating. That way, the phi2 pin is tied to the crystal used as my system clock, and the same 1.8432MHz signal can be used to derive the baud rates. Does this make sense or should I switch to using a 1MHz or 2MHz crystal oscillator as my system clock and add this 1.8432MHz crystal oscillator separately and connect it to pin 6 while leaving pin 7 floating?


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 27, 2021 2:56 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10802
Location: England
A crystal has just two connections, and needs some support circuitry (usually) to make it oscillate and make a good clock signal. A crystal oscillator (also goes by other names) has four connections, because it needs power and ground, and it directly produces a (relatively) good clock signal.

For more, see
https://www.fpga4fun.com/oscillators.html

There's also a three-terminal device, a ceramic resonator, but I don't think we use those.


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 27, 2021 2:57 pm 
Offline

Joined: Thu Apr 14, 2016 2:13 pm
Posts: 9
Not sure why I asked here instead of just trying it. Just put it on a loop to send the character 'a' from the 6502 to my laptop and it seems to be working. I jumpered pin 6 and pin 27. For some reason my FTDI requires hooking up TxD -> TxD and RxD -> RxD which had me thinking that the clock jumper wasn't working.


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 27, 2021 5:59 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8440
Location: Southern California
As Ed alluded, a crystal by itself is a 2-terminal passive device. It's like one of our small grandchildren on a swing in the park. There's a rate the system tends to go back and forth; but without someone pushing him or her, there's no swinging. The oscillator's electronics in the can do the pushing, and the rate is governed by the crystal which is also housed in the can.

The '51 does have an oscillator onboard, so you can connect just the crystal if you wish, per the diagrams about 70% of the way down the I/O ICs page of the 6502 primer. However, if you're running the processor off a 1.8432MHz oscillator can, you might as well run its output over to the 6551's crystal input as well.

The need to cross the TxD and RxD lines (and handshake lines too if you use them) regards DTE (data terminal equipment) versus DCE (data communications equipment), and is discussed about half way down my 6502-oriented RS-232 primer page.

Ed mentioned ceramic resonators. These tend to be smaller and cheaper, but they're not as accurate as crystals. I've used ceramic resonators in a couple of commercial products where I wanted better accuracy than you can get with just an RxC relaxation oscillator but did not need the accuracy of a crystal. The third terminal BTW is normally grounded. Since the resonator is still a passive device, it has no power connection. These resonators are often accurate enough for asynchronous (as in RS-232) communications, but not by a wide margin. Common accuracy is 0.5%, whereas crystals will generally be far better in the accuracy department, like a few ppm.

_________________
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 Mar 30, 2021 1:38 am 
Offline

Joined: Thu Apr 14, 2016 2:13 pm
Posts: 9
GARTHWILSON wrote:
As Ed alluded, a crystal by itself is a 2-terminal passive device. It's like one of our small grandchildren on a swing in the park. There's a rate the system tends to go back and forth; but without someone pushing him or her, there's no swinging. The oscillator's electronics in the can do the pushing, and the rate is governed by the crystal which is also housed in the can.

The '51 does have an oscillator onboard, so you can connect just the crystal if you wish, per the diagrams about 70% of the way down the I/O ICs page of the 6502 primer. However, if you're running the processor off a 1.8432MHz oscillator can, you might as well run its output over to the 6551's crystal input as well.

The need to cross the TxD and RxD lines (and handshake lines too if you use them) regards DTE (data terminal equipment) versus DCE (data communications equipment), and is discussed about half way down my 6502-oriented RS-232 primer page.

Ed mentioned ceramic resonators. These tend to be smaller and cheaper, but they're not as accurate as crystals. I've used ceramic resonators in a couple of commercial products where I wanted better accuracy than you can get with just an RxC relaxation oscillator but did not need the accuracy of a crystal. The third terminal BTW is normally grounded. Since the resonator is still a passive device, it has no power connection. These resonators are often accurate enough for asynchronous (as in RS-232) communications, but not by a wide margin. Common accuracy is 0.5%, whereas crystals will generally be far better in the accuracy department, like a few ppm.


Thanks for the info. I really appreciate this community being so helpful to new members. It's really easy for people as experienced as yourself to get frustrated with someone like me coming in so little experience and understanding. Building a 6502 hobby computer is something that I've been wanting to do since around 2016 as you can probably see from the date I actually joined, but other projects have always gotten in the way.


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 30, 2021 4:59 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8190
Location: Midwestern USA
GARTHWILSON wrote:
The 1.8432MHz input is separate, and is used to derive the standard RS-232 baud rates. You can deviate from that and it will work, but the baud rates won't be standard, meaning you'll get errors if you try to connect to equipment that is on a standard speed.

Also of note, if you use a 3.6864 MHz oscillator you will exactly double the available bit rates, which will still be standard for most TIA-232 devices. For example, with the 1.8432 MHz oscillator, the highest standard bit rate for the 6551 UART is 19,200. With the 3.6864 MHz oscillator, that would be 38,400, which is a commonly-used speed (many dumb terminals support it). Exactly how high you can go with the 6551's bit rate oscillator I don't know—Garth probably does, since he's monkeyed with it a lot more than have I.

instantaphex wrote:
What is the difference between a crystal and a clock oscillator?

As Ed explained, a crystal usually is unable to generate a usable clock signal without the presence of supporting components. A clock oscillator, on the other hand, is self-contained, and only requires Vcc and ground to produce output. Given that oscillators are readily available in a wide variety of frequencies and cost little more than a "naked" crystal, I usually recommend the use of an oscillator.

Crystal circuits may be finicky and refuse to operate under some circumstances. Oscillator manufacturers have sorted out all of this for you and as long as you stay within their specified voltage, temperature and loading limits (the data sheet is your friend for this sort of information), the oscillator is guaranteed to oscillate at the rated frequency.

Quote:
I've got a few of these metal can looking crystal oscillators. One of them is 1MHz and one of them is 1.8432 MHz. I've been using this 1.8432MHz can as my system clock for my computer. So what I'm wondering is if I can run my system clock to pin 27 (phi2) and then just use a jumper between pin 27 and pin 6 (XLT1) and leave pin 7 (XLT0) floating.

You can, if the UART you are using is rated for 2 MHz operation (not all are). However, consider that while the UART's bit rate clock signal is a constant (1.8432 MHz), the Ø2 clock signal to the MPU can be over a wide range—the WDC 65C02 can work with DC to 14+ MHz. In many cases, there are advantages to having separate clock sources for the MPU and UART. This can especially become important if your unit also has one or more 6522 VIAs.

The 6522's timers are normally slaved to Ø2. In thinking about this, you probably can surmise that using an odd frequency such as 1.8432 MHz for Ø2 will complicate the use of the timers for such things as evenly-spaced interrupts that are an exact decimal fraction of a second, e.g., an IRQ at 10 millisecond intervals (the typical UNIX clock "tick"). How would you accomplish that with a timer slaved to a clock whose frequency has a periodic interval of 542.5347222... nanoseconds? :D

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 30, 2021 5:13 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8440
Location: Southern California
BigDumbDinosaur wrote:
Also of note, if you use a 3.6864 MHz oscillator you will exactly double the available bit rates, which will still be standard for most TIA-232 devices. For example, with the 1.8432 MHz oscillator, the highest standard bit rate for the 6551 UART is 19,200. With the 3.6864 MHz oscillator, that would be 38,400, which is a commonly-used speed (many dumb terminals support it). Exactly how high you can go with the 6551's bit rate oscillator I don't know—Garth probably does, since he's monkeyed with it a lot more than have I.

For one application I use sometimes in my work, to program Bluetooth modules with my workbench computer, I put %00010000 in a 51's control register for a bit rate that's 1/16th of the crystal input pin's frequency, ie, 115,200 bps @ 1.8432MHz. It is guaranteed to be able to do 125kbps IIRC, but I don't know if in actuality it could do two, four, or even eight times that rate. One would have to try it.

_________________
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 Mar 30, 2021 5:39 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8190
Location: Midwestern USA
GARTHWILSON wrote:
For one application I use sometimes in my work, to program Bluetooth modules with my workbench computer, I put %00010000 in a 51's control register for a bit rate that's 1/16th of the crystal input pin's frequency, ie, 115,200 bps @ 1.8432MHz. It is guaranteed to be able to do 125kbps IIRC, but I don't know if in actuality it could do two, four, or even eight times that rate. One would have to try it.

The resulting interrupt storm must be impressive. There's something to be said about UARTs with FIFOs. :D

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 30, 2021 7:11 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8440
Location: Southern California
BigDumbDinosaur wrote:
The resulting interrupt storm must be impressive. There's something to be said about UARTs with FIFOs. :D

I suppose the 02's super-low interrupt overhead is why the '51 doesn't have the FIFO. There wouldn't be any point in going over 115,200 bps at my 5MHz though. The BT module I'm working with only has 9600 and 115,200 as speed options, pin-selectable, and it was frequently dropping bits at the slower speed, for reasons I don't know and wasn't going to waste time looking into since the higher speed worked on first try.

_________________
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 Mar 30, 2021 7:18 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10802
Location: England
I'd be tempted to say that the '51 doesn't have a FIFO because that's a significant extra number of transistors and therefore chip size. I don't know this for sure, but I'd be very surprised otherwise.

It's easy to forget how expensive RAM is, compared to logic, in that timeframe.


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 30, 2021 8:51 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8190
Location: Midwestern USA
GARTHWILSON wrote:
BigDumbDinosaur wrote:
The resulting interrupt storm must be impressive. There's something to be said about UARTs with FIFOs. :D

I suppose the 02's super-low interrupt overhead is why the '51 doesn't have the FIFO.

All the UARTs that were designed back then were "one-note wonders." It reflected the costs and limits of chip design technology of the time. It did help, though, that the 6502's excellent interrupt performance was available. When considered in the context in which they were used at the time (mostly 110 and 300 baud modems), not having a FIFO in a UART was not an issue.

Where it became an issue was with the x86 MPUs, which have horrid interrupt latency. I recall the early IBM PCs couldn't maintain more than 9600 BPS without error, thanks to sluggish interrupt performance—in particular, receiver overruns were a constant headache. That latency was what led to the development of the 16550 UART and its successors and competitors.

These days I fail to see any good reason to use a 6551, 6850 or any other UART of that era. We have so much better hardware now. Why make things difficult?

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 30, 2021 10:29 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8440
Location: Southern California
BigDumbDinosaur wrote:
Where it became an issue was with the x86 MPUs, which have horrid interrupt latency. I recall the early IBM PCs couldn't maintain more than 9600 BPS without error, thanks to sluggish interrupt performance—in particular, receiver overruns were a constant headache.

That's almost comical! In the early years of my 65c02 workbench computer, I was running it at 2MHz and servicing the '51 interrupts in Forth—not even assembly language—at 9600bps.

_________________
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  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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: