• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

External LocalTalk / serial port clocks

cheesestraws

Well-known member
I know that, in theory, one can supply an external synchronous clock to the SCC by supplying it on the clock in pin on the 8-pin DIN of the appropriate serial port.

Does anyone know if this is sufficient to get that clock used, or whether I have to do anything in software? (I sort of expect to have to?)

I am looking at running LocalTalk at a different data speed (lower), for various rather silly reasons.

 
Last edited by a moderator:

Bunsen

Admin-Witchfinder-General
This may be of interest to people hoping to run Localtalk at faster than 230kbps as well.  A few third party hardware makers back in the old days achieved around 1Mbps or better - Farallon and Asante are the names that come to mind.  Though if I recall, they both required you to use their hardware at both ends.

 
Last edited by a moderator:

Dog Cow

Well-known member
Does anyone know if this is sufficient to get that clock used, or whether I have to do anything in software?
You should configure the SCC in software. I have attached the Zilog manual that you will need. It is difficult to understand this manual at first, as it is not so well organized, but after you look at some sample source codes too, you will understand it better.

The file SCC.SDLC.Asm is what I wrote earlier this week for the SCC. Turns out I don't need this code for my particular application, but I'll leave it here as an example for others.

Also, look into Async AppleTalk (or Asynchronous AppleTalk). This was a project back in the late 1980s or so to run AppleTalk over RS232. Someone bought a source license to the AppleTalk .MPP driver from Apple and rewrote the ALAP. I don't have any files for this, but I'm still looking.

View attachment Z8530UM.pdf

View attachment SCC.SDLC.Asm.txt

 

cheesestraws

Well-known member
It is difficult to understand this manual at first, as it is not so well organized, but after you look at some sample source codes too, you will understand it better. 
I have the SCC manual and I think more or less understand it—I've also got a technote which I've distributed before about implementing LocalTalk on a Zilog microcontroller with a built-in SCC (which you are welcome to a copy of if you would like).  What I'm trying to work out is how Apple wired it up, rather than how the chip itself behaves.  Perhaps to clarify, I was always given to understand that the provision of an external clock line to make synchronous serial, and especially SDLC, go faster was a deliberate design decision, and so it's perhaps not unreasonable to think that there is a "neat" way to enable that external clock line without having to go near hardware.  Especially given that I would rather not pierce that abstraction unless I absolutely have to.

I'm curious especially about that Farallon stuff that used an external clock. If anyone has any of that, what software did it use?  Is there a copy available anywhere?

The (potential) use case (well, useless case?) I have here is very definitely synchronous, and has an external clock, and is SDLC framed.  So the only thing I need to do is to slave the existing implementation to an external clock.

 
Last edited by a moderator:

Dog Cow

Well-known member
 Perhaps to clarify, I was always given to understand that the provision of an external clock line to make synchronous serial, and especially SDLC, go faster was a deliberate design decision, and so it's perhaps not unreasonable to think that there is a "neat" way to enable that external clock line without having to go near hardware.
OK, now I understand your objective better. The clock can be supplied through one of the pins on the Mac's serial ports. It's one of the handshaking pins.

The first-generation Macintosh hard disks like the Tecmar MacDrive provided a clock to operate at around 700 or so kilobaud.

 

cheesestraws

Well-known member
The clock can be supplied through one of the pins on the Mac's serial ports. It's one of the handshaking pins.
Pin 2 on a mini-DIN, if memory serves.

My question is what I need to do to enable this from an OS perspective, if anything.  And especially how the Farallon devices did it.

 

Realitystorm

Well-known member
Did you figure out how to create an external clock?  Since I figured out how to get AppleTalk over a null modem connection, I've been wondering how to increase the speed.

My USB to serial adapter is 921.6kbit/s (115.2KB/s), way faster than the 57.6 kbit/s (7.2KB/s) my LC 475 does.

I'm wondering if I could use an external clock to push the LC's end of the connection to a faster speed (limited by the CPU's ability to keep up of course)

The 900 kbit/s (112.5KB/s) for the IIfx and Centris/Quadra AV thanks to their Input/output processor (IOP) ports is pretty close to the speed I'd like to hit.

 

paws

Well-known member
Not sure if this helps at all, but all the simple passive MIDI interfaces work like this. MIDI is a serial port at 31.25KHz, which the Mac can't do natively, so to do MIDI you need a breakout box that supplies a 1MHz clock. I have schematics for something like this somewhere but my Macs aren't hooked up due to moving. It's extremely simple, though, literally just the clock on the right pint (and some components normally required for MIDI, which is a current loop, not a TTL connection). Unfortunately I don't think there's driver sources available for this.

 

cheesestraws

Well-known member
Unfortunately I don't think there's driver sources available for this.


Yeah, the hardware is reasonably straightforward.  It's the software side that I don't know how one would go about doing :-( .

I wish I had one of those Farallon jobbies that had their own clocks...

 

Realitystorm

Well-known member
I plan to look in old mac mags on the archive to see what I can find about LocalTalk/Serial devices with external clocks.

 
Pin 2 on a mini-DIN, if memory serves.

My question is what I need to do to enable this from an OS perspective, if anything. And especially how the Farallon devices did it.
The one big benefit of finding this out is that once the method is isolated. It should not be too much of an issue to bring it to an OpenTransport based networking stack. Since one of the limitations of the older equipment is that you can only run it in 24 bit memory addressing thus limiting you to 68K Macs and System 7.1
 
The one big benefit of finding this out is that once the method is isolated. It should not be too much of an issue to bring it to an OpenTransport based networking stack. Since one of the limitations of the older equipment is that you can only run it in 24 bit memory addressing thus limiting you to 68K Macs and System 7.1
Although the original thread is already quite old, I think this information might still be useful. From the schematics (e.g. http://www.bitsavers.org/pdf/apple/mac/EarlyMacSchematics.pdf - note that this one uses the 9-pin D-Sub connectors) we can see that the external clock is provided on the TRxCA/TRxCB pins of the SCC.

According to section 3.5 "Clock Selection" of the Z8530 User Manual (https://68kmla.org/bb/index.php?attachments/z8530um-pdf.25527/), "[t]he source of the receive clock is controlled by bits D6 and D5 of WR11. The receive clock may be programmed to come from the /RTxC pin, the /TRxC pin, the output of the baud rate generator, or the receive output of the DPLL."

D6D5Function
00Rx Clock = /RTxC
01Rx Clock = /TRxC
10Rx Clock = BR generator
11Rx clock = DPLL output

The transmit clock is controlled by bits 4 and 3 of the same register, see the attached diagram. Bit 2 sets the direction of the /TRxC pin, 0 = input (default after reset).

Please note that I haven't checked this information – I'll need to recap some of my 68k Macs first...
 

Attachments

  • wr11.pdf
    46.5 KB · Views: 2
According to section 3.5 "Clock Selection" of the Z8530 User Manual (https://68kmla.org/bb/index.php?attachments/z8530um-pdf.25527/), "[t]he source of the receive clock is controlled by bits D6 and D5 of WR11. The receive clock may be programmed to come from the /RTxC pin, the /TRxC pin, the output of the baud rate generator, or the receive output of the DPLL."

D6D5Function
00Rx Clock = /RTxC
01Rx Clock = /TRxC
10Rx Clock = BR generator
11Rx clock = DPLL output

The transmit clock is controlled by bits 4 and 3 of the same register, see the attached diagram. Bit 2 sets the direction of the /TRxC pin, 0 = input (default after reset).

Please note that I haven't checked this information – I'll need to recap some of my 68k Macs first...
Some assembler code to initialize the SCC for MIDI operation, which also uses an external clock (1 MHz to create the 31,250 bps baud rate used by MIDI), can be found in this MacTech article, see function "InitSCCChan". See the lines printed in bold that set WR11 of the SCC to use the external clock, these set bits 6/5 and 4/3 to "01" as expected.

However, MIDI is an asynchronous protocol, so the complete initialization for Localtalk has to be adapted.

InitSCCChan
MOVE.B #4,(A0) ; pointer for SCC reg 4
MOVE.L (SP),(SP); Delay
MOVE.B #%10000100,(A0) ; 32x clock, 1 stop bit
MOVE.L (SP),(SP); Delay
MOVE.B #1,(A0) ; pointer for SCC reg 1
MOVE.L (SP),(SP); Delay
MOVE.B #%00000000,(A0) ; No W/Req
MOVE.L (SP),(SP); Delay
MOVE.B #3,(A0) ; pointer for SCC reg 3
MOVE.L (SP),(SP); Delay
MOVE.B #%00000000,(A0) ; Turn off Rx
MOVE.L (SP),(SP); Delay
MOVE.B #5,(A0) ; pointer for SCC reg 5
MOVE.L (SP),(SP); Delay
MOVE.B #%00000000,(A0) ; Turn off Tx
MOVE.L (SP),(SP); Delay
MOVE.B #11,(A0) ; pointer for SCC reg 11
MOVE.L (SP),(SP); Delay
MOVE.B #%00101000,(A0) ; Make TRxC clock source
MOVE.L (SP),(SP); Delay
MOVE.B #14,(A0) ; pointer for SCC reg 14
MOVE.L (SP),(SP); Delay
MOVE.B #%00000000,(A0) ; Disable BRGen
MOVE.L (SP),(SP); Delay
MOVE.B #3,(A0) ; pointer for SCC reg 3
MOVE.L (SP),(SP); Delay
MOVE.B #%11000001,(A0) ; Enable Rx
MOVE.L (SP),(SP); Delay
MOVE.B #5,(A0) ; pointer for SCC reg 5
MOVE.L (SP),(SP); Delay
MOVE.B #%01101010,(A0) ; Enable Tx and drivers
MOVE.L (SP),(SP); Delay
MOVE.B #15,(A0) ; pointer for SCC reg 15
MOVE.L (SP),(SP); Delay
MOVE.B #%00001000,(A0) ; Enable DCD int for mouse
MOVE.L (SP),(SP); Delay
MOVE.B #0,(A0) ; pointer for SCC reg 0
MOVE.L (SP),(SP); Delay
MOVE.B #%00010000,(A0) ; Reset EXT/STATUS
MOVE.L (SP),(SP); Delay
MOVE.B #0,(A0) ; pointer for SCC reg 0
MOVE.L (SP),(SP); Delay
MOVE.B #%00010000,(A0) ; Reset EXT/STATUS again
MOVE.L (SP),(SP); Delay
MOVE.B #1,(A0) ; pointer for SCC reg 1
MOVE.L (SP),(SP); Delay
MOVE.B #%00010011,(A0) ; Enable interrupts
MOVE.L (SP),(SP); Delay
MOVE.B #9,(A0) ; pointer for SCC reg 9
MOVE.L (SP),(SP); Delay
MOVE.B #%00001010,(A0) ; Set master int enable
MOVE.L (SP),(SP); Delay
RTS
 

cheesestraws

Well-known member
Ohhhh, I remember what I was asking about this for. This was a bad idea :D. I was trying to see whether I could get LocalTalk and Econet to share wiring. They're very, very similar: both FM-0 SDLC over RS422, but econet has a global clock for each network segment rather than each speaker being responsible for their own clock. So to get it to work you'd have to get the Macs to respect the Econet clock. Hence why I was asking.

Thanks for the information, @michaelengel. :)

But I don't want this enough to spend the time to write a full networking driver for it...

Some assembler code to initialize the SCC for MIDI operation

I hadn't seen this article before: thanks!

The SCC should be able to do 115.2kbit/sec in standard serial mode

Yup, but that won't help with my original question as I'd specifically need synchronous operation tied to that external clock.
 
Top