Close

Serial Communication

A project log for Z80 Reverse-Engineering And Hacking Adventures

What else can I say?

eric-hertzEric Hertz 06/18/2022 at 19:072 Comments

We have Serial!

I am not at all familiar with terminal emulators, despite many prior attempts, and despite having done quite a bit of serial programming...

So, frankly, I'm kinda (no, utterly) surprised this worked upon first try:

DIPs set

On On Off Off On Off Off Off

CTS, Even (why?), No Parity, 1 Stop Bit, 8 Data Bits, 9600baud

(notice 7 data bits as an option... Eventually it occurred to me that having that as an option most-likely indicates that it communicates via text, rather than raw binary. Whew. I kinda thought otherwise, since it also supports GPIB. Though I'm no GPIB expert.)

My go-to first attempt at serialling is to use a script I set up long ago to give All The Options to stty to basically disable everything, for raw serial. Despite having made notes in there regarding each option, I couldn't tell you what any of it means. It's a HUGE list. And surely not at all what this thing wants. E.G. the CTS setting... I mean... I'm almost certain I disabled ALL flow-control at the compy-side. So, like I said, I'm shocked it works right off the bat.

So, once stty is configured (how? Don't ask me! I didn't even understand way back then), then I open a new xterm and run 'cat /dev/ttyUSB0' then turned the unit on, and got nada. A few resets, still nada.

After that in the first xterm I ran 'echo "" > /dev/ttyUSB0' ... and got a '?'

Hey, I only sent a carriage-return and maybe a linefeed, or vice-versa (again, I have no idea how my stty script sets it up). But, it responded with something! Wait, '?'... that could mean unprintable binary... No, wait, this fancy xterm prints those in a diamond. That, right there, is a real '?' sent by the SD70!

OK...

Where do we go from here?

Some fiddling with things, a couple more '?'s, and notice the LCD says "Invalid Command."

I think this thing is actually getting what I send it!

Alright, what is it, then...? 

"200 W1" 

'*' and, on the LCD "W2=200.0000"

Holy moly.

But, apparently serial has the waveforms Zero-based while the screen starts with W1. No prob

"100 W0"

"W2=100.000"

Heh. Alrighty... well... for now... Serial actually works. I'll fiddle with bauds next and report right back here.

...

Oh, and... I found the DB-9 to DB-25 which I've used many times over two+ decades... It was attached to an EPROM programmer which I've never used because I don't understand terminal emulators... I got lost when it came time to upload the binary file. (As much as I love my much newer programmer that can do FLASH, microcontrollers, and PLDs, the fact it requires its own DOS software, and a real parallel port, should probably send me learning terminal emulators...)

But, the point is that it was directly-connected, just as was my 14.4 modem, last I used it, as I recall... And... I directly connected it to the SD70. Which means: No Null-Modem adapter necessary, in this case (right?). Which makes sense... This thing was most-likely to be intended to be controlled by a computer, not controlling other things... So, would look, to a computer, like a device (like a modem)... right?

OK, more 'sperimentin'.

110 baud: NADA, not even illegal command...

300: "100 W0" -> "W2=100.0000" Yep!

19200: "200 W0" -> "W2=200.0000" Right On!

Waitaminnit....

@ziggurat29 pointed this little easter-egg out a while back... which, of course, I forgot in my haste to just "see what happens"...

Yeah, I agreed whole-heartedly this musta been a typo. "You, Sir, are Out Of Order!"

But, like I said, I forgot that when setting the switches for 9600, as-shown... and it "just works"

And, right now it's set for 19200, as shown, and likewise...

Whattya wanna bet they made this panel, with the mistake, and decided to "fix it in software"?

Discussions

ziggurat29 wrote 06/18/2022 at 20:08 point

The panel printing is not a mistake. In the code at 2A05h are the BRG constants, which are indexed by the DIP switch choices. They progress as expected except for the last two, which seemed reversed and caused me some trepidation until I saw your back panel shot which confirmed that indeed that was the way it worked.

I don't know if that was a bug they decided to keep and just fix it with the silk screen on the panel or what. These are the archaeological mysteries that intrigue me. In a sane world it would be so trivial to fix the code and recompile but for some reason, they chose not to.

The 110 bps selection should not work at that speed according to my calculations, but if you have the ability to set your terminal to 220 bps then I think it should work. This due to what I think is a bug that I found in the code.

Well, I guess you've shown this is wired DCE, or else you'd have needed a null modem.

Knowing that this works over a terminal I can give you a list of commands (or you can find them yourself in the listing around 03f0h.  There is a 'big switch' at 0423 that compares what seemed to me to be a command character (with strudel termination, of course) dispatching to handlers. I have no idea what they do, but you can get a list of things to try from that and see what pops up on the LCD.

I don't know what a 'W1' and 'W2' are. Maybe start and end wavelengths? This gizmo is spectroscopy related...

  Are you sure? yes | no

Eric Hertz wrote 06/19/2022 at 19:01 point

LOL, I was scrolling through your listing looking for 0x3f00... but didn't make it that far; the text editor on my phone stopped in the late 0x2000's. Gotta buy the full version! Right... 3f0. How'd I miss that?

I'm pretty sure W1 is the starting wavelength, and W2 the ending, for a "scan."

I think I caught in some of the GPIB code that 0x00 is sent... so that might explain the strudel.

  Are you sure? yes | no