Retrochallenge 2013 Winter Warmup

 

In order to keep this chronological, I’ll put a table of contents up here at the top.


30 Dec, 2012

At the moment, this is actually kind of a placeholder for the 2013WW until I really solidify my plan. As generally happens, the Retrochallenge occurs at “vacation” time, when I’m out of town for a large portion of the time.

I did actually sort of plan ahead this time, and dragged with me the following equipment:

  • Apple IIc Plus
  • Raspberry Pi
  • Casio FX-730P
  • Parallax Quickstart board
  • various cables and related stuff

I had no plan even then, the main common factors here are: small and retro. If I wait a couple of weeks and try to cram the Retrochallenge into the latter half of the month, I have tons (well, maybe not, but probably actually a good part of a single ton) of stuff in my office that I can work with—and I’m pretty certain that I will be working with that then anyway—but I think for the purpose of the 2013WW I’ll try to limit myself to what I have on-hand.

One thing that I’m interested in trying to do is interface with the Casio, which has an interface port. I have not yet determined if there are any published specifications for this interface, however, so that might be a lost cause. If I can do it, this would be a job for the Raspberry Pi most likely, the goal being to allow saving, loading, and printing.

A secondary project that I might also work on is something on the IIc Plus—over the summer, I made an aborted attempt at creating a QR code generator on the IIc Plus, and I might pick that up again as a secondary go-to project. Or, some other project that involves the IIc Plus somehow connected to the modern world, I’m still thinking about possibilities there.

A third thing that I’d been thinking about was interfacing to the Epson PX-8. Earl Evans recently got a floppy drive emulator running on a Raspberry Pi, and I have all of the components to follow in his footsteps. What I was thinking about as a followup is the ridiculous project of porting that to the IIc Plus, so that the IIc Plus could serve as a virtual drive for the PX-8. This would require a fair bit of programming blind at first (until I get back to my office and can try connecting it to the real PX-8), and I’m not quite sure what level of control I have over the IIc Plus’s serial ports, but it might be possible, though it’s also not practical in the least.

Probably it will be either the first or second option that I go with, preference on the first, since that really is a little bit practical, and possibly more likely some variation on the second, since that doesn’t require much specialized equipment.

“Progress” will be documented here.

IMG_7736

(The keyboard above, by the way, looks so mangy because it’s actually got a silicone keyboard cover, which originally had the key covers painted with white letters on a black background so as to look like the keys underneath. However, the paint wears off, so now you can see exactly how I strike the space bar. Incidentally, the wear pattern doesn’t correspond particularly to any passwords I use, I type other things a lot more often than I type my passwords. The Delete key seems to have gotten a pretty good workout. Actually, though, my guess is that the worst of the wear pattern comes at least in large part from my resting positions. I very often sit on “left-shift”, “A”, “left-command” and “right-shift”, “space”, and something around “O/P/I/L/;” while waiting for inspiration to strike concerning what to type next.)

4 January, 2013

Doing a little bit of research to see if I can discover what I’d need to discover about the connections to the Casio FX-730P. There are a few sites out there that document it, and there are a couple of scanned manuals.

I found a very ambitious project here: CASsette IO Utilities (Marcus von Cube). This page has software and discussions focused on reading and writing sound files that can be used by the Casio cassette interfaces. The trick of course is that the cassette interface boxes are harder to come by than the computers themselves. I’m still not quite sure which interfaces are compatible with the FX-730P, there are a few different interfaces (cassette, printer) and a slew of variations on the basic computer.

Linked from there were Piotr Piatek’s pages, and that looks like the place I’d need to start, there is a lot of technical information there. I’ll deep-link a couple here: Data formats (for the family, character sets, file formats), Information specific to the 730P (BASIC tokens, file format, wiring diagram for data transfer between computers), hardware description (for the family, and includes the pinout of the expansion port, and a description of the communications protocol for the printer and cassette interfaces).

Reading through it, I can kind of make out the logic of what I need to do. There’s also a pretty extensive write-up of how to access the GPIO pins on the Raspberry Pi that I can use to start thinking about the connections.

I’m still a little bit skittish about this project, I haven’t tried to do anything like this before. At least at the basic level, it is probably pretty straightforward, I just need to connect the pins correctly and read and write them from the Raspberry Pi. But I’ve got no experience and only a kind of rudimentary understanding, so I worry that something I don’t know about current, voltage, or timing might get in the way of my making this work (or worse, damage one of the machines).

The way I see it now, though:

Casio FX-730P
1 2 3 4 5 6 7 8 9 10 11 12
D4 D3 D2 D1 OP CK2 CK1 VDD3 CE1 CE2 VDD1 GND
Raspberry Pi GPIO
3V3 io0 io1 io4 GND io17 io21 io22 3V3 io10 io9 io11 GND
1 3 5 7 9 11 13 15 17 18 21 23 25
2 4 6 8 10 12 14 16 18 20 22 24 26
5V 5V GND io14 io15 io18 GND io23 io24 GND io25 io8 io7

I presumably need to tie their grounds together, so C-12 to P-25. The RasPi GPIO pins are not 5V tolerant, so I believe that I need to scale the 5V signals coming from the Casio down to 3.3V. I need to watch C-10 (CE2; Cassette Interface Chip Enable) for low to indicate that cassette interface is activated, so I need to connect that to, say, P-11 (GPIO 17). I need to be able to watch C-7 (CK1; clock ca. 200kHz) so I can tell when to change/read the data, so that needs to go to, say, P-16 (GPIO 23). The cassette interface uses only Data 4 for communication, so I need to connect C-1 (D4) to, say, P-18 (GPIO 24). Lastly, I need to be able to read OP (Register select), so I need to connect C-5 to, say, P-22 (GPIO 25).

If I want to try to read or write RAM (which I’ll need to do if I want to emulate the printer), I’ll need to connect Data 1-3, but for the moment I’m not going to bother with it, this is a simpler way to start.

On the RasPi, I’ll need something like the following.

  • Wait for cassette activation. Watch GPIO-17 (CE2) until it goes low, then we’re on.
  • Wait for command. Watch GPIO-25 (OP) until it is low.
  • Wait for IO. Watch GPIO-25 (OP) until it is high.
  • Collect bit. Wait for GPIO-23 (CLK) to be high, wait for it to transition to low, and read a bit (1=low) from GPIO-24.
  • Send bit. Wait for GPIO-23 (CLK) to be high, set GPIO-24 to high (0) or low (1), wait for GPIO-23 (CLK) to transition to low, wait for GPIO-23 (CLK) to transition to high.
  • Collect command. Collect 6 bits. I don’t know how well synchronized this is going to be, I’ll presume that the command will come immediately after CE2 and OP drop to ground, this will require some testing.
  • Collect data. Collect 16 bits. Possibly parse it out here (start 0, 8 data bits LSB first, parity bit, stop 11, anything xxxx), though I don’t know how to report an ill-formed read.
  • Status ok. If command is 000100, pull GPIO-24 (D4) low (to send 1), and wait for IO, then wait for command.
  • Read data. If command is 010010, wait for read, then collect data. If data is 0xFF, it’s an idle string, ignore it, otherwise store it and increment storage pointer.
  • Finish reading. If command is 000000, reading is done, back to waiting for initial command.
  • Send data. If command is 010010, wait for IO, send 16 bits.
  • Write data. If in “read mode”, send 12 0xFF idle strings, then cassette data.

Having worked out that much, I see that I don’t know how the cassette interface knows when it’s done. The Casio should send a Reset command 000000 when it’s finished with the interface to close the connection, but what if there’s still data to send? Is it a fixed amount of data? I think now I may need to see if I can understand what Marcus von Cube has done with his CASsette IO Utilities, or Piotr Piatek’s AVR-based home-brew interface.

I think this project is mainly going to be me trying to understand what other people have already figured out, but it will still be interesting. I think this is going to be more or less within my grasp, though depending on whether I can find a way to do the voltage stepping locally, I may need to wait a week or two until I’m back home where I know I have the necessary doohickeys to make the physical electrical connection between the RasPi and the Casio.

5 January, 2013

This isn’t really the “retro” part, but I have successfully lit an LED from the 3.3V power and ground of the Raspberry Pi (nothing under its control, but that’s a relatively short step from here). The connections into my breadboard are not reliable, I may look around locally to see if I can get a real solderless prototyping breadboard, or I may put this on hold for a week or so until I can back home.

Pi led hello world

27 January, 2013

Time is running out on the RC2013WW window. It’s not entirely that I haven’t been working on this, but I haven’t been able to get it to do what I want. I’m still stuck on a pretty early step—which was always kind of the danger of trying to both learn how to design the circuits with a breadboard and code the interface.

As mentioned before, the Raspberry Pi is a 3.3V device at the interfaces, it is not 5V tolerant. But the Casio is doing everything at 5V. So, in order to protect the Raspberry Pi, I need to tone down the voltage. I wanted to try to do this with logic level converters, which seem like they should be straightforward to use. One end gets power and ground from the Casio (5V), the other from the RasPi (3.3V). Then when a wire from the Casio registers a 5V signal, it should be passed through the converter and come out at 3.3V.

I’ve wired this up several times, and I’ve even tried just pulling 5V down to 3V with a series of resistors and skipping the converter, but the signal just doesn’t seem to be getting through. I wired some LEDs up so I could visualize what was happening. There are four main pins on the Casio that I’m paying attention to, so I put an LED on each to see when there’s current. And I put four corresponding LEDs on the other end of the logic converter, so I could see if the signal gets through. And it just doesn’t. I’ve tested the LEDs on the other end of the converter by just sending power straight to them and they light, so they are oriented right and working. I also tried skipping the LEDs and reading the pins on the RasPi directly, but they also weren’t seeing anything (except when one component or another lost its connectivity, then it would hop around randomly between reading high and low). I’m almost tempted to try just hooking them up directly and hoping I don’t wind up with fried Pi, but I don’t really want to do that.

When coding the RasPi part, Gordon’s Henderson’s Tux Crossing example was a big help. I think I have a small C program working that just reads and reports the state of the four pins I’m trying to watch.

Just so I have something to post, though, I’ll put up this movie of me demoing the failure. The RasPi is already hooked up, so the power LED starts up lit. I plug in the power connector to the Casio, and that lights up the Casio LED. Powering on the Casio and typing causes some activity in the LEDs, and the most stable activity is generated by issuing the LOAD command, which will wait for something interesting to come in over the cassette interface. The Casio’s LEDs light up in a kind of a pattern, but the 3.3V LEDs remain silent. I also issued a SAVE command, but the Casio detects pretty quickly that there’s no device to save to, and so errors out.

Logic level converters aren’t doing shift from Paul Hagstrom on Vimeo.

I really am not sure where to turn next on this, it seems like I’m bumping up against something obvious that everyone else would know how to overcome. I guess I can’t be entirely sure that the logic level converters even work at all, maybe that’s something I should try an isolated test on. Also, I know there is another looming problem that I haven’t yet figured out how to handle, which is that at least one of the Casio’s pins is bidirectional, I need to be able to read from it, then shift modes, and write to it. At least as far as I understand it. So, a pure resistors-in-series solution to the voltage shift is not going to do it, because I need to be able to put the pin at 5V from a 3.3V source (at least, assuming the Casio won’t read 3.3V as high, maybe it will). But also, this probably means I need to use an additional channel on the logic level converter and I’m not sure whether they’ll interfere with one another when tied to the same Casio pin. I was planning on just trying it to see, but if I can’t even read the pins, then I’ve still got a ways to go.

A couple of days left, but I’m not optimistic (and I have a lot of Real World work to do).

1 February, 2013

I never really got this off the ground, but not entirely for lack of time and effort spent, rather because I was thwarted early on by my novicehood at electronics work.

I think I know now what the problem was, but not in time to do anything with it (for the RCWW—I’m still going to try to make this work). It turns out I had more faith in electricity than I should have. As Robin Debreuil insightfully noted, the level converters are on PCBs that are really designed to be soldered, not wired up with breadboard pins. After the clock (even EST) ran down to zero, I went back to square one and just tried to get power across the level converter with the most basic circuit I could muster. And it did work—intermittently—if I mashed everything in with my fingers. The connection to the level converter was much, much flakier than I’d imagined. It’s not that wiggling would disconnect it—rather, it was only dramatic wiggling that would even instantaneously get a signal through.

I think at least that this realization is a kind of accomplishment of the RetroChallenge Winter Warmup for me. What I really did is aim for a retrocomputing project and learn a little bit of electronics instead, and how to connect to the Casio and the Raspberry Pi to LEDs. I still have a fairly long way to go from the lighting of the LEDs that I succeeded in doing to getting a working tape drive emulator, but I have a better idea now what the path will look like.

I probably won’t continue to update this page, but at some point I’ll post something about the progress of the project in the meanwhile. I do hope that it will not be already time for the summer Retrochallenge before I get it working, but we’ll see.

It’s been fun having a go at it, though, certainly!

So, when I do this for real, what I’m going to need to do is solder some feet onto the level converter so I can push it into the breadboard and maintain the connections. That is to say, I will move on from suffering defeat, and commence with soldering the feet.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>