PDA

View Full Version : Kaypro 4 + Raspberry Pi3 + Serial/Null Modem connectivity = looking for some guidance



mcfuzz89
October 8th, 2017, 10:48 PM
Hi all,

I decided to separate this thread from my floppy woes (and apologies if thats against the rules).

My plan with my Kaypro 4 is to use it as an IRC terminal (using weechat) much like another user on the forums did. I purchased a Raspberry Pi 3 and have Linux Mate running on it. I also have a USB to Serial adapter with the Prolific PL2303 chipset, and a cheap Fry's-special DB9-DB25 null-modem cable.

I am able to telnet into my Pi at 9600 baud using tcpser (tcpser -s 9600 -d /dev/ttyUSB0) but it seems like I am dropping characters and things are getting jumbled. Even when launching screen using adm3a termcap, I get missing characters and weechat is unusable (it doesnt load without screen) - though I suspect it's because of the custom configuration I have on it. It's plausible that my issues are due to RF, but my Kaypro is on top of my network cabinet (half height) and the pi is on a shelf away from anything else.

So what I am hoping to get from those of you who have successfully done something similar to what I want is some information to lead me in the right direction:

1. What USB-to-Serial adapter are you using or is using a PL2303 based one is enough?
2. Any recommendation for a null modem cable? I got a cheap $5 one... not sure if it is shielded or not.
3. Any specific configuration for tcpser I should use?
4. Maybe a custom termcap that I could use for screen?
5. Long shot but can someone share their weechat configuration (if they're using it) so that I could copy? Obviously I am not looking for your servers/channels/usernames/passwords but just general guidance.
6. Anything else that could would be greatly appreciated!!

Thanks!

durgadas311
October 9th, 2017, 10:17 AM
I don't think I fully understand your setup, but one though occurred to me is whether the Kaypro can run at 9600 baud. I did some work in the old days setting up my Kaypro to act as a programmable TV/VCR remote control. Those devices operated roughly at 9600 baud (synchronous, though) and I had to use interrupts and make the code highly optimized. If you are expecting a Kaypro running CP/M to be able to run at 9600 baud, it might require some tuning.

Another thought is handshaking (related to the previous thought). I'm pretty sure any device I ever used on a machine of that vintage required working handshaking flow control to avoid overruns. I don't recall if the Kaypro CP/M used hardware handshake or X-ON/X-OFF, or both. And X-ON/X-OFF can be susceptible to issue with parity settings as well.

Are you using the Kaypro as a terminal device on the Pi, or are you using the Pi as a terminal on the Kaypro (and having CP/M redirect the CON: device to the serial port)?

mcfuzz89
October 9th, 2017, 10:51 AM
I don't think I fully understand your setup, but one though occurred to me is whether the Kaypro can run at 9600 baud. I did some work in the old days setting up my Kaypro to act as a programmable TV/VCR remote control. Those devices operated roughly at 9600 baud (synchronous, though) and I had to use interrupts and make the code highly optimized. If you are expecting a Kaypro running CP/M to be able to run at 9600 baud, it might require some tuning.

Another thought is handshaking (related to the previous thought). I'm pretty sure any device I ever used on a machine of that vintage required working handshaking flow control to avoid overruns. I don't recall if the Kaypro CP/M used hardware handshake or X-ON/X-OFF, or both. And X-ON/X-OFF can be susceptible to issue with parity settings as well.

Are you using the Kaypro as a terminal device on the Pi, or are you using the Pi as a terminal on the Kaypro (and having CP/M redirect the CON: device to the serial port)?

I am trying redirect the console output of the Pi to the Kaypro - basically the same concept as SSH'ing into the Pi from say my laptop... but instead of a shiny macbook, it's a 1984 luggable :p

I did try running at lower baud rates - 2400 for example - but I still get the same issues.

phogren
October 9th, 2017, 11:37 AM
Hmmmm
I think you need to get a serial adapter for the PI. I've never tried one of the USB to serial on the PI but I have used the PI serial adapters. Widely available on different sites.
My setup is with the Kaypro 2X and a Raspberry pi zero. You can go at this in different ways. You can log into the pi over the serial port - meaning that as it boots the Kaypro will be the terminal for the pi. You can also boot the pi into kermit and transfer files back and forth. I have my project on hold but will fire it up later and give you the exact configuration.
I have had no problems at 9600 baud.

phogren
October 9th, 2017, 12:12 PM
My ultimate goal is to use the PI zero inside the Kaypro 2X. I can store an incredible amount of files on the PI and can transfer them to the Kaypro via kermit.
I am using the Zero because it uses less power than the 3.
Pictures of the adapter on the pi:

4122141222

mcfuzz89
October 9th, 2017, 12:42 PM
My ultimate goal is to use the PI zero inside the Kaypro 2X. I can store an incredible amount of files on the PI and can transfer them to the Kaypro via kermit.
I am using the Zero because it uses less power than the 3.
Pictures of the adapter on the pi:

4122141222



Oh wow - that is pretty dope! Could you share where you got it from and whether it'd be compatible with the Pi 3 B? I guess the other question is - what is the difference between using one of these and a USB based adapter?

durgadas311
October 9th, 2017, 12:44 PM
Ah, I get it now. Very cool. This is something that could even be used as a CP/NET server so that you could access files directly (without kermit). Although, CP/NET takes up a lot of memory on CP/M 2.2. You could also implement a disk I/O protocol of some sort and access that way. If you make it look like a WD1005-2 then you could make this into a Kaypro 10 (although you'd have to burn a new ROM).

So, my wild guess at this point is that you are having flow control issues.

phogren
October 9th, 2017, 12:56 PM
I don't think it's flow control. I can use kermit without any issues. If you boot the pi with the Kaypro you can get on the internet (without graphics) and you can D/L files onto the PI. but getting the files onto a Kaypro floppy requires running Kermit on the PI and the Kaypro. I'll get back to it soon. I've been distracted by an Ampro Littleboard project.

phogren
October 9th, 2017, 02:24 PM
I am using Raspian/Jessie on the Zero

durgadas311
October 9th, 2017, 04:08 PM
I do recall that KERMIT implements X-ON/X-OFF, and that CP/M does not (unless a vendor implemented it in their BIOS). So, if the Pi were relying on X-ON/X-OFF and Kaypro CP/M is ignoring it (and KERMIT were honoring it) that could explain what you're seeing.

I'm still not clear on the actual symptoms, though. Which side is jumbling characters and how does the resulting pattern compare to what was sent?

mcfuzz89
October 9th, 2017, 04:26 PM
I do recall that KERMIT implements X-ON/X-OFF, and that CP/M does not (unless a vendor implemented it in their BIOS). So, if the Pi were relying on X-ON/X-OFF and Kaypro CP/M is ignoring it (and KERMIT were honoring it) that could explain what you're seeing.

I'm still not clear on the actual symptoms, though. Which side is jumbling characters and how does the resulting pattern compare to what was sent?

First off - sorry for the delayed responses... looks like all my posts require moderator approval :\


So to give you an example - lets assume that my standard linux command prompt looks like this:

user@localhost$:

Assume I've term'd into my Pi - the display on the Kaypro shows user@localhost$:

Now - if I press enter a few times, the expectation is that I'll see use@localhost$: repeating itself - and it does for the first couple of presses but then it becomes user@lo or use or us$ or a variation thereof.


Another example would be me typing a command - for example: cd /home/user/directory - now assume I saw a typo and want to correct; I can press the backspace to delete the typo and you'd expect the cursor to move to the left and erasing letters but on my end, after a few key presses, the cursor does not move anywhere - i.e. it'd show something like cd /home/user/dire# (where # is the cursor) but it actually does delete stuff... just doesn't show it on the screen.


Another example I can think of would be showing output that is missing the first character - i.e. you'd exact to see something "Please wait..." but instead you see "lease wait..."

durgadas311
October 10th, 2017, 04:44 AM
OK, that gives me some good clues. It sounds familiar to what I saw running kermit on a virtual Kaypro earlier this year. I'll dig up my notes and see if there is anything to report. I recall a lot of fiddling with the linux shell settings as well.

Just to be clear, you are using a custom program on the Kaypro to do the terminal? or is it kermit on CP/M? And also so I have the full picture, this shell prompt is running on an embedded linux on the Pi (and not passing through the Pi to a host PC)?

mcfuzz89
October 10th, 2017, 10:36 AM
Iím actually using the native TERM program - TERM.COM and yes, Iím connecting directly to the Pi which is running Ubuntu Mate. I enabled telnet so when I term to the Pi it acts like SSH... only via telnet.



OK, that gives me some good clues. It sounds familiar to what I saw running kermit on a virtual Kaypro earlier this year. I'll dig up my notes and see if there is anything to report. I recall a lot of fiddling with the linux shell settings as well.

Just to be clear, you are using a custom program on the Kaypro to do the terminal? or is it kermit on CP/M? And also so I have the full picture, this shell prompt is running on an embedded linux on the Pi (and not passing through the Pi to a host PC)?

mcfuzz89
October 11th, 2017, 05:58 PM
OK, that gives me some good clues. It sounds familiar to what I saw running kermit on a virtual Kaypro earlier this year. I'll dig up my notes and see if there is anything to report. I recall a lot of fiddling with the linux shell settings as well.

Just to be clear, you are using a custom program on the Kaypro to do the terminal? or is it kermit on CP/M? And also so I have the full picture, this shell prompt is running on an embedded linux on the Pi (and not passing through the Pi to a host PC)?

Oops - double post.

mcfuzz89
October 18th, 2017, 09:36 PM
Ooooh!!! I can post without moderation approval!

So a bit of an update - I managed to get it to work more-or-less OK using Kermit, 2400 baud and screen (Linux app on Ubuntu) with Kaypro specific termcap. The forrmatting is pretty spot on but 2400 baud is the only thing that I can use since it appears the monitor firmware cannot keep up refreshing anything past that....

Any ideas on that? I've seen folks post that 9600 works fine but... a bit skeptical...

durgadas311
October 19th, 2017, 03:52 AM
That certainly sounds like flow-control/handshaking. Kermit should be capable of X-ON/X-OFF (as well as hardware (CTS/RTS)) handshaking, but I'm not sure of what is enabled by default. But, in order for flow control to work, both sides must agree. So you'll have to make certain that the Linux app (or stty config) enables the corresponding flow control.

mcfuzz89
October 19th, 2017, 02:03 PM
That certainly sounds like flow-control/handshaking. Kermit should be capable of X-ON/X-OFF (as well as hardware (CTS/RTS)) handshaking, but I'm not sure of what is enabled by default. But, in order for flow control to work, both sides must agree. So you'll have to make certain that the Linux app (or stty config) enables the corresponding flow control.

So you don't think this has to do with the serial adapter and/or the null modem cable? I tried both a Prolific and FTDI based USB-TO-SERIAL adapters and two different Null-Modem cables with same results - logic would dictate that it's likely not related to hardware but then again, feels like I am violating the laws of nature trying to get this box online :p

SpidersWeb
October 19th, 2017, 02:59 PM
Just my opinion, and perhaps others have had different experiences, but I find that cheap USB to serial adapters are a waste of time if you need reliable handshaking. With some software I was writing, I'd often find the response to any type of handshaking wasn't quick enough - resulting in data loss and sometimes corruption of bytes.

durgadas311
October 19th, 2017, 03:27 PM
I'm actually talking about software flow control. Kermit, and the stty settings on Linux, need to agree on how to do the flow control, and both need to enable it as well. Its been too long since I've use Kermit, but I seem to recall config options for X-ON/X-OFF and RTS/CTS. And I'm pretty sure Linux TTY drivers support both - although you'll need to read the man pages. I doubt the USB dongles do anything but pass-through.

On Linux, the command "stty" should give you complete control. If you're not familiar with that command, it can be a bit overwhelming. I'd suggest avoiding the tempatation to specify every setting imaginable. I think "ixon" and "ixoff" should be the ones you'll want to look at for X-ON/X-OFF handshaking (read the man page carefully - those each do something different). There is also "crtscts" for RTS/CTS handshaking. I'd pick one or the other, not both, and probably avoid RTS/CTS since the USB dongle may not support modem control lines well. "stty" will also allow you to set baud and other serial port settings.

For kermit you will have to check the documentation on how to setup the appropriate handshaking.

Chuck(G)
October 19th, 2017, 03:57 PM
I believe that many serial adapters employ internal buffering, so using one isn't exactly realtime. That could a source of problems.

Just speculating here.

mcfuzz89
October 19th, 2017, 04:28 PM
I'm actually talking about software flow control. Kermit, and the stty settings on Linux, need to agree on how to do the flow control, and both need to enable it as well. Its been too long since I've use Kermit, but I seem to recall config options for X-ON/X-OFF and RTS/CTS. And I'm pretty sure Linux TTY drivers support both - although you'll need to read the man pages. I doubt the USB dongles do anything but pass-through.

On Linux, the command "stty" should give you complete control. If you're not familiar with that command, it can be a bit overwhelming. I'd suggest avoiding the tempatation to specify every setting imaginable. I think "ixon" and "ixoff" should be the ones you'll want to look at for X-ON/X-OFF handshaking (read the man page carefully - those each do something different). There is also "crtscts" for RTS/CTS handshaking. I'd pick one or the other, not both, and probably avoid RTS/CTS since the USB dongle may not support modem control lines well. "stty" will also allow you to set baud and other serial port settings.

For kermit you will have to check the documentation on how to setup the appropriate handshaking.

Thanks - I'll do some digging and reading.


I believe that many serial adapters employ internal buffering, so using one isn't exactly realtime. That could a source of problems.

Just speculating here.

It doesn't seem like I have many options when it comes to adding an interface to the Pi. Most of the GPIO based ones are also using the same Prolific chipset as the USB ones do.

durgadas311
October 19th, 2017, 04:52 PM
Chuck brings up a good point. If there is (much) buffering in the dongle it could create issues with end-to-end handshaking. If there are options to turn off the buffering, that might be wise. I guess that all depends on how the Linux TTYUSB drivers work, though. I'd hope they handled that better. From what little I've heard about USB, the communication between the device and the computer is packetized and not subject to the idiosyncrasies of legacy Rs-232 ports. But I could also imagine (in my ignorance) all sorts of ways for things to get messed up transitioning between Rs-232 and USB.

MarsMan2020
October 19th, 2017, 06:57 PM
Thanks - I'll do some digging and reading.



It doesn't seem like I have many options when it comes to adding an interface to the Pi. Most of the GPIO based ones are also using the same Prolific chipset as the USB ones do.

The Pi has a native UART on the GPIO pins. You'll need a small board with an MAX232 or similar IC to translate the levels from the Pis 3.3V to full RS-232 levels.

When people attach a USB to Serial converter to the GPIO they are using the converter to act as the UART for their other computer to talk to the Pi. In this case you also want a USB -> 3.3 v serial converter, NOT a USB -> RS232 serial converter.

Prolific chips tend to be trouble so getting a **genuine** FTDI USB->RS232 adapter could also help. But I would go with the Pis native setup.

Chuck(G)
October 19th, 2017, 09:46 PM
Level translators are simple; a 5V supply for a MAX232 or ICL3232 and a few capacitors. SparkFun and others have ready-made ones. Then you can use the native UART of the Pi.

Search for "RS232 Level Shifter".

I do use USB comm adapter for a console connection on various boards, but that's strictly for getting a TTY console going the easiest way. I could just as easily use a level shifter and a COM port on a PC.