Discussion:
IIc serial to SPI
(too old to reply)
cb meeks
2018-02-05 21:00:38 UTC
Permalink
Raw Message
Has anyone developed any sort of driver for working with SPI devices (SD cards, SRAM, etc.) using just the serial port on the IIc?

I'm not even sure how feasible it would be at the moment. I need to break down and find the technical manuals for the IIc. :-D
Delfs
2018-02-06 16:17:48 UTC
Permalink
Raw Message
On Monday, February 5, 2018 at 3:00:39 PM UTC-6, cb meeks wrote:
> Has anyone developed any sort of driver for working with SPI devices (SD cards, SRAM, etc.) using just the serial port on the IIc?
>
> I'm not even sure how feasible it would be at the moment. I need to break down and find the technical manuals for the IIc. :-D

https://www.google.com/search?q=RS232+to+SPI+interface&oq=RS232+to+SPI+interface
cb meeks
2018-02-06 16:25:20 UTC
Permalink
Raw Message
On Tuesday, February 6, 2018 at 11:17:50 AM UTC-5, Delfs wrote:
> On Monday, February 5, 2018 at 3:00:39 PM UTC-6, cb meeks wrote:
> > Has anyone developed any sort of driver for working with SPI devices (SD cards, SRAM, etc.) using just the serial port on the IIc?
> >
> > I'm not even sure how feasible it would be at the moment. I need to break down and find the technical manuals for the IIc. :-D
>
> https://www.google.com/search?q=RS232+to+SPI+interface&oq=RS232+to+SPI+interface


Thanks. But that wasn't really what I was looking for. I wasn't very clear.

What I'm looking for is information on bit-banging the SPI protocol from a IIc directly to an SPI equipped device such as a micro-controller.

In fact, even I2C would be great as well.

Thanks.
David Schmenk
2018-02-07 17:57:08 UTC
Permalink
Raw Message
On Tuesday, 6 February 2018 08:25:21 UTC-8, cb meeks wrote:
> On Tuesday, February 6, 2018 at 11:17:50 AM UTC-5, Delfs wrote:
> > On Monday, February 5, 2018 at 3:00:39 PM UTC-6, cb meeks wrote:
> > > Has anyone developed any sort of driver for working with SPI devices (SD cards, SRAM, etc.) using just the serial port on the IIc?
> > >
> > > I'm not even sure how feasible it would be at the moment. I need to break down and find the technical manuals for the IIc. :-D
> >
> > https://www.google.com/search?q=RS232+to+SPI+interface&oq=RS232+to+SPI+interface
>
>
> Thanks. But that wasn't really what I was looking for. I wasn't very clear.
>
> What I'm looking for is information on bit-banging the SPI protocol from a IIc directly to an SPI equipped device such as a micro-controller.
>
> In fact, even I2C would be great as well.
>
> Thanks.

This is a pretty interesting idea. Since the //c serial ports use the 6551, you'd have to figure out how to map the SPI protocol to the pins available: DTR, DSR, TD, and RD. If you were going to have the //c be the master, things are easier. The SPI master supplies the clocking so you would have to decide if you wanted the clock signal to be derived from the Transmit Data, or the Data Terminal Ready. The actual data would have to be sent on the other pin. One idea would be to use the TD for the clock - configure for one stop bit. Send a data value of 0 (or maybe a bit value to extend the clock duration), use the start bit as your clock. You would have to bit bang DTR and DSR as your SPI send/receive data to transition the data between the clocks.

Caveats: I'm just guessing at this. The 6551 may act funny when you play with DTR in the middle of transmitting data. RS232 also uses much different voltages than the standard GND/+5V so that needs to be converted.

Dave...
cb meeks
2018-02-07 18:17:04 UTC
Permalink
Raw Message
On Wednesday, February 7, 2018 at 12:57:10 PM UTC-5, David Schmenk wrote:
> If you were going to have the //c be the master, things are easier.

Oh yeah. That's the plan. I would like the IIc to be the SPI master for a device I want to build. Basically a mcu would be an SPI slave but take commands from the IIc. Then it would do various things, read sensors, etc.


> The SPI master supplies the clocking so you would have to decide if you wanted the clock signal to be derived from the Transmit Data, or the Data Terminal Ready. The actual data would have to be sent on the other pin. One idea would be to use the TD for the clock - configure for one stop bit. Send a data value of 0 (or maybe a bit value to extend the clock duration), use the start bit as your clock. You would have to bit bang DTR and DSR as your SPI send/receive data to transition the data between the clocks.


That's an interesting idea! Thanks for the pointers. If I have the energy tonight, I might bring the IIc back out and see if I can do some stuff with the serial. I got some more reading to do.


> Caveats: I'm just guessing at this. The 6551 may act funny when you play with DTR in the middle of transmitting data. RS232 also uses much different voltages than the standard GND/+5V so that needs to be converted.


I don't have the schematic in front of me. But does the 6551 go through something like a Max232? I guess it would if it was legit RS-232. But I bet you're right. I probably will need some level conversion before I hit the mcu.
Ralf Kiefer
2018-02-07 20:22:11 UTC
Permalink
Raw Message
cb meeks wrote:

> That's an interesting idea! Thanks for the pointers. If I have the
>energy tonight, I might bring the IIc back out and see if I can do some
>stuff with the serial. I got some more reading to do.

I think that it would be difficult to use the 6551 in a different way
than an asynchonous, serial V.24 device.

The 6551s in the IIc can run baud rates between 50 and 19200 and 115200
Baud. But the first mainboards don't supply the 6551s with the correct
clock (1,8432MHz). The real clock rate is 14.318MHz DIV 8: 1.789MHz.
Sometimes that's the cause of failed connection.


> I don't have the schematic in front of me. But does the 6551 go through
>something like a Max232?

Of course. The serial ports are real V.24 or EIA-232D ports. The line
driver and receiver are a 1488 and a 1489.

Regards, Ralf
David Schmenk
2018-02-07 22:21:09 UTC
Permalink
Raw Message
On Wednesday, February 7, 2018 at 12:22:13 PM UTC-8, Ralf Kiefer wrote:
> cb meeks wrote:
>
> > That's an interesting idea! Thanks for the pointers. If I have the
> >energy tonight, I might bring the IIc back out and see if I can do some
> >stuff with the serial. I got some more reading to do.
>
> I think that it would be difficult to use the 6551 in a different way
> than an asynchonous, serial V.24 device.
>

Ah, but that is the fun of hacking.

> The 6551s in the IIc can run baud rates between 50 and 19200 and 115200
> Baud. But the first mainboards don't supply the 6551s with the correct
> clock (1,8432MHz). The real clock rate is 14.318MHz DIV 8: 1.789MHz.
> Sometimes that's the cause of failed connection.
>
>

We're not talking about an asynchronous serial bus. SPI is clocked. If one were to repurpose the serial data stream as the clock signal, then there is an input pin and an output pin that *could* be bit-banged as the data I/O. However, the 6551 may not like doing that. If it were to work, you could even send multiple clock signals in one data write (01010101) but it would require very accurate timing to bit bang the data. As Ralf noted, early //c computers didn't have an accurate clock signal going into the 6551.

> > I don't have the schematic in front of me. But does the 6551 go through
> >something like a Max232?
>
> Of course. The serial ports are real V.24 or EIA-232D ports. The line
> driver and receiver are a 1488 and a 1489.
>

Yes, +-12V

> Regards, Ralf

Dave...
Ralf Kiefer
2018-02-07 23:09:45 UTC
Permalink
Raw Message
David Schmenk wrote:

> We're not talking about an asynchronous serial bus.

Yes, but the 6551 in the IIc cannot do anything else than asynchronous
serial communication with fixed baud rates and hardware handshake.

If you change the hardware of the IIc you can use the RxC signal instead
of the baud rate generator.


> SPI is clocked. If one were to repurpose the serial data stream as the
>clock signal, then there is an input pin and an output pin that *could*
>be bit-banged as the data I/O. However, the 6551 may not like doing
>that. If it were to work, you could even send multiple clock signals in
>one data write (01010101) but it would require very accurate timing to
>bit bang the data.

Running a simple SPI interface I would prefer an AppleBus board with a
6522, and not a IIc.


Regards, Ralf
Jorge
2018-02-08 08:56:56 UTC
Permalink
Raw Message
On Wednesday, February 7, 2018 at 7:17:06 PM UTC+1, cb meeks wrote:
>
> Oh yeah. That's the plan. I would like the IIc to be the SPI master for a device I want to build. Basically a mcu would be an SPI slave but take commands from the IIc. Then it would do various things, read sensors, etc.
>

And why don't you want use the uart for that?
f***@hotmail.com
2018-02-08 16:50:17 UTC
Permalink
Raw Message
How about //c --> ADT-compatible serial cable --> USB-to-serial dongle --> Raspberry Pi running A2cloud instead?

f


On Monday, February 5, 2018 at 1:00:39 PM UTC-8, cb meeks wrote:
> Has anyone developed any sort of driver for working with SPI devices (SD cards, SRAM, etc.) using just the serial port on the IIc?
>
> I'm not even sure how feasible it would be at the moment. I need to break down and find the technical manuals for the IIc. :-D
cb meeks
2018-02-08 21:10:31 UTC
Permalink
Raw Message
On Thursday, February 8, 2018 at 11:50:19 AM UTC-5, ***@hotmail.com wrote:
> How about //c --> ADT-compatible serial cable --> USB-to-serial dongle --> Raspberry Pi running A2cloud instead?


To be brutally honest, if I see one more RPi project I'm going to puke. I've got nothing against the RPi (I own several), I just don't want to use them for my projects.

I want to directly control a micro-controller over the serial port of an Apple IIc. I'm not looking for cable converters to a modern desktop. My project would be 100% stand alone with no internet required.

In the long run, the IIc would tell the micro-controller to play a song from an SD card, for example.

The reason I don't want to do it on a standard A2 card (I have before) is that I would like to just change the interface and use the same device on a Commodore 64, TI, Atari, etc. So ADT isn't an option.

Think "plug-n-play" hardware for different vintage computers. They all have different ports but they (usually) speak serial.
Anthony Ortiz
2018-02-08 21:31:14 UTC
Permalink
Raw Message
Any particular reason you don’t want to use the Pi? The Pi Zero would seem perfect for this and have the necessary power to decode video/audio. Have you tried the Teensy? I’m planning on using a teensy on my “raspberry pi as a peripheral card” Apple ii project. The teensy 3.5 is 3.3v but the Gpio pins are 5v tolerant and can drive 5v TTL signals so you should have no problem interfacing with the Apple II.
cb meeks
2018-02-08 21:53:40 UTC
Permalink
Raw Message
On Thursday, February 8, 2018 at 4:31:15 PM UTC-5, Anthony Ortiz wrote:
> Any particular reason you don’t want to use the Pi?

Because I plan on using a mixture of Parallax Propeller and AY sound chips. Putting a RPi in between that (with it's Linux OS) doesn't make sense for what I want to do.


> The Pi Zero would seem perfect for this and have the necessary power to decode video/audio.


I don't plan on doing any video/audio decoding. RPi is overkill for my project.


> Have you tried the Teensy?


Yes, I have Teensy boards. Teensy is something I considered but they are a little pricey for what I want to do. I haven't mentioned this but I have already coded much of the libraries already. Long before everything jumped onto to RPi. And, some of the OS drivers I would use are already developed for the Parallax. Adding a Pi (or even Teensy) would literally be more work for something that doesn't buy my anything.
Michael J. Mahon
2018-02-08 21:46:01 UTC
Permalink
Raw Message
cb meeks <***@gmail.com> wrote:
> On Thursday, February 8, 2018 at 11:50:19 AM UTC-5, ***@hotmail.com wrote:
>> How about //c --> ADT-compatible serial cable --> USB-to-serial dongle
>> --> Raspberry Pi running A2cloud instead?
>
>
> To be brutally honest, if I see one more RPi project I'm going to puke.
> I've got nothing against the RPi (I own several), I just don't want to
> use them for my projects.
>
> I want to directly control a micro-controller over the serial port of an
> Apple IIc. I'm not looking for cable converters to a modern desktop. My
> project would be 100% stand alone with no internet required.
>
> In the long run, the IIc would tell the micro-controller to play a song
> from an SD card, for example.
>
> The reason I don't want to do it on a standard A2 card (I have before) is
> that I would like to just change the interface and use the same device on
> a Commodore 64, TI, Atari, etc. So ADT isn't an option.
>
> Think "plug-n-play" hardware for different vintage computers. They all
> have different ports but they (usually) speak serial.
>
>

And the same is true for most microcontrollers.

So why not use a standard (except, perhaps, voltage levels) serial link
from the vintage computer to the microcontroller?

You won't be able to beat 115kb with but-banged SPI or I2C.

--
-michael - NadaNet 3.1 and AppleCrate II: http://michaeljmahon.com
cb meeks
2018-02-08 22:00:19 UTC
Permalink
Raw Message
On Thursday, February 8, 2018 at 4:46:08 PM UTC-5, Michael J. Mahon wrote:

> So why not use a standard (except, perhaps, voltage levels) serial link
> from the vintage computer to the microcontroller?


That's what I'm trying to learn how to do. Just can't slice off the time to do it. Ugh. That's really it in a nutshell. Sending commands from the IIc and reading back a little data.

>
> You won't be able to beat 115kb with but-banged SPI or I2C.
>


Speed isn't a huge deal. Think of a small list of instructions:

IIc:

10 POKE <ADDR-to-Device>, 100 : REM Setup audio mode
20 POKE <ADDR-to-Device>, 115 : REM Set volume
30 POKE <ADDR-to-Device>, 200 : REM Load track from SD card

etc.
Michael J. Mahon
2018-02-08 23:15:39 UTC
Permalink
Raw Message
cb meeks <***@gmail.com> wrote:
> On Thursday, February 8, 2018 at 4:46:08 PM UTC-5, Michael J. Mahon wrote:
>
>> So why not use a standard (except, perhaps, voltage levels) serial link
>> from the vintage computer to the microcontroller?
>
>
> That's what I'm trying to learn how to do. Just can't slice off the time
> to do it. Ugh. That's really it in a nutshell. Sending commands from
> the IIc and reading back a little data.
>
>>
>> You won't be able to beat 115kb with but-banged SPI or I2C.
>>
>
>
> Speed isn't a huge deal. Think of a small list of instructions:
>
> IIc:
>
> 10 POKE <ADDR-to-Device>, 100 : REM Setup audio mode
> 20 POKE <ADDR-to-Device>, 115 : REM Set volume
> 30 POKE <ADDR-to-Device>, 200 : REM Load track from SD card
>
> etc.
>

Yes, but think about controlling a Mockingboard; several times per measure
you may need to change six oscillator's parameters. That's a couple dozen
bytes that are sent in, hopefully, just a couple of milliseconds.

For higher-level controls, like "start playing", I agree that speed is
almost irrelevant.

--
-michael - NadaNet 3.1 and AppleCrate II: http://michaeljmahon.com
Loading...