Serial connection between QL and PC

Nagging hardware related question? Post here!
User avatar
bwinkel67
QL Wafer Drive
Posts: 1187
Joined: Thu Oct 03, 2019 2:09 am

Serial connection between QL and PC

Post by bwinkel67 »

So I did this a ton back in the 90's and I seem to be stumbling on it now. I created a cable and tried connecting DTR/CTS on the QL side to the various configurations on the PC side and could not get hardware flow control working. I have an old RS232 breakout box that lets me see what's live and rewire the connection with jumper cables, which makes it much easier debugging a cable. It does require a 25-to-9 pin converter for the PC side, but that's pretty standard. I'm connecting to a PC running Tera Term (also tried Termite) and on the QL side all I'm doing is (at 9600 baud):

copy ser1hr to con

I paste a 3 to 4K text file in form the PC side and hardware flow control just doesn't seem to work. I got it to work recently with an internet modem (Retro modem) so I know hardware flow control works on the QL side (I also have a Hermes chip). What am I missing?

I did find this informative article:

https://www.lammertbies.nl/comm/info/rs ... ow-control

It states that for PC-to-PC via a null modem cable, the CTS/RTS hardware flow control gets a little tricky.

With my vDrive broken and presently no floppy drive handy, I'm trying to get some software on my QL (mainly a RAM disk) so I can more easily get some stuff temporarily running while I wait to get my vDrive fixed. I did try:

copy ser1hr to mdv2_demo_bas

...and pasted a 5K BASIC program which did work at one point with Tera Term but dropped some random characters (though it got most of it). So I thought I'd solved it (I think DTR went to DTR and CTS to either RTS or CTS) but the next time it only got a fraction.

Any advice? If it's hardware flow control, the software should not care, correct? So Tera Term, if in its setting I have flow control set to CTS/RTS, and I have it properly connected, it should wait to transfer stuff over, even when I paste in a large file...or does the software have to understand hardware flow control. Just too many decades having gotten used to USB for me to remember :-/


User avatar
Pr0f
QL Wafer Drive
Posts: 1298
Joined: Thu Oct 12, 2017 9:54 am

Re: Serial connection between QL and PC

Post by Pr0f »

Is your PC serial port a pucker serial port or a USB to serial interface?

I have found that most pc interfaces use a UART chip that has a FIFO buffer - and this can be problematic for the QL - as it doesn't have much of a buffer, nor can it react quickly to buffer filling as the algorithm for checking that is done in the IPC firmware - whereas on the more modern UART's in the PC, the control lines directly control the traffic flow in the chip - even before it gets to the PC.

Things to check on the PC side:

Is hardware flow control on? (serial driver usually has hardware / software or none)
Stop bits / data bits - the QL is fixed at 8 and probably needs at least 1 stop bit - ideally 2
Parity setting?
Baud rate - default on the PC is often 9600 - that's probably a max for the QL, even with Hermes chip, if it's two way comms.

Try lowering the baud rate to see if it becomes more reliable at lower rates.

Seems a lot of PC handshaking makes use of DTR / DSR lines - CTS/RTS is not always used properly. You can strap DCD, DTR and DSR together in the cable, and then rely on CTS/RTS only


Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: Serial connection between QL and PC

Post by Martin_Head »

How about using serNET, with QPC2 acting as a file server. That gets any PC terminal software out of the loop.

I've never used serNET. But if it works like the normal QL Net. Then it will do error handling on bad packets.


User avatar
bwinkel67
QL Wafer Drive
Posts: 1187
Joined: Thu Oct 03, 2019 2:09 am

Re: Serial connection between QL and PC

Post by bwinkel67 »

Martin_Head wrote:How about using serNET, with QPC2 acting as a file server. That gets any PC terminal software out of the loop.

I've never used serNET. But if it works like the normal QL Net. Then it will do error handling on bad packets.
It's a chicken and egg problem. The only thing I have running on my QL is JS (well JSU) ROM. I don't have any cartridges presently with software on them. So I can't get serNET running on the QL side since they require an extension. To get an extension on the QL I'd first need to be able to create a reliable connection between PC and QL and transfer software. I got rid of my only floppy since I had vDrive so presently I'm SOL :-/


User avatar
bwinkel67
QL Wafer Drive
Posts: 1187
Joined: Thu Oct 03, 2019 2:09 am

Re: Serial connection between QL and PC

Post by bwinkel67 »

Pr0f wrote:Is your PC serial port a pucker serial port or a USB to serial interface?

I have found that most pc interfaces use a UART chip that has a FIFO buffer - and this can be problematic for the QL - as it doesn't have much of a buffer, nor can it react quickly to buffer filling as the algorithm for checking that is done in the IPC firmware - whereas on the more modern UART's in the PC, the control lines directly control the traffic flow in the chip - even before it gets to the PC.

Things to check on the PC side:

Is hardware flow control on? (serial driver usually has hardware / software or none)
Stop bits / data bits - the QL is fixed at 8 and probably needs at least 1 stop bit - ideally 2
Parity setting?
Baud rate - default on the PC is often 9600 - that's probably a max for the QL, even with Hermes chip, if it's two way comms.

Try lowering the baud rate to see if it becomes more reliable at lower rates.

Seems a lot of PC handshaking makes use of DTR / DSR lines - CTS/RTS is not always used properly. You can strap DCD, DTR and DSR together in the cable, and then rely on CTS/RTS only
Thank you...this is all good stuff. Yes, I'm using a USB-to-SER interface. The COM port allows for number of bits, number of stop bits, parity bit, flow control (CTS/RTS, DTS/DTR, XON/XOFF, none), baud rate. I think back in the 90's a baud rate of 9600 was really fast, I kept it at that now thinking it was slow. So good to know that even Hermes may struggle. Both tera term and termite also have those same settings and need to align with the COM port for them to work properly

The setting I've used are 8N1 with hardware flow control (tried both CTS/RTS and DTS/DTR). I do recall this idea of tying lines together...I'll give that a try (that might be one of the techniques the article I shared talks about). I also have an old Inspiron 8600 that has an actual serial port on the motherboard. I'll try that machine to see if it handles things better.


User avatar
Pr0f
QL Wafer Drive
Posts: 1298
Joined: Thu Oct 12, 2017 9:54 am

Re: Serial connection between QL and PC

Post by Pr0f »

I've had mixed results with USB to serial converters - I use one to transfer stuff to and from the Z88, as pretty much like the situation you are in - other storage options are not really available.

I found on some of them - though the adverts on ebay claim they support hardware handshaking - they don't really - they are just wired across on the D9 connector - so expecting the device on the serial port to do the work, and relying on the much faster buffering on the PC side to ensure nothing gets lost. I found one that allows the FIFO's to be turned off, as well as the correct handshaking to be controlled. Sounds like if you've tested this on one of those breakout boards - and the LEDS change on and off / or go red /green for mark space then your USB <> RS232 chip is providing handshaking. I know the FTDI and CP2030 chip based ones do seem mostly to work. Not all the ebay ads tell you, and not all are honest either - it's something of a lottery - they are cheap enough so that you can get several vendors versions and try.

Mine that I used with the Z88 was very much like this one based on CH430 chip:

https://www.ebay.co.uk/itm/183820741704 ... media=COPY


User avatar
XorA
Site Admin
Posts: 1358
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: Serial connection between QL and PC

Post by XorA »

Seems a lot of PC handshaking makes use of DTR / DSR lines - CTS/RTS is not always used properly. You can strap DCD, DTR and DSR together in the cable, and then rely on CTS/RTS only
Considering none of those lines have been used on a PC for 15+ years, I wouldnt even guess at whether they are operational on a modern PC. I do a LOT of rs232 in my line of work and have not used hardware flow control in my whole professional career!


User avatar
bwinkel67
QL Wafer Drive
Posts: 1187
Joined: Thu Oct 03, 2019 2:09 am

Re: Serial connection between QL and PC

Post by bwinkel67 »

Oh wow, this is all very helpful. I thought I was going bonkers. So the lights on the break out box aren't changing from red to green. I think I had, at one point, red on both sides in Tera Term using RTS/CTS and nothing was going through, so at least that suggests some form of communication was going on (maybe the QL was just paused though, since Tera Term doesn't give much feedback). I think Termite worked differently, though both apps had the flow control settings and give lights in their menu bar telling you what is turned on (so as you both said, the USB-to-RS232 may just ignore those). I would have guessed their'd be a choreography going on with the lights but then again, I only put out 5K of info which, over serial, can be a lot for testing, esp on a QL.

I wired the line from QL to breakout box directly (9-pin to 25-pin -- US has DB9's on the QL side) so I know which pins I'm looking at...funny thing is I'm using an old set of connectors that you stick a RJ11 phone cord in so I only have 4 lines and got rid of the transmit on the QL side so I could get both control lines (I only need one direction but am looking for a wire that can get 6 lines -- RJ45 is too fat but I'm thinking of dremelling an old cable's connector to squeeze it in). On the PC side I'm using a 25-to-9 pin converter (I have two, all from the 90's) and I think they are pretty standards but I should spend time probing their lines just to get a clear picture what is being mapped.

The USB-to-RS232 is actually pretty old as I've had it for a while though never used it. The drivers that came on a mini-CD only went from 98 to XP. I did find a Windows 7/8 driver for it. But, the behavior certainly seems to follow what you describe, its just using a big buffer and saying "QL, you are on your own." I do have Windows XP virtually on my old Windows 7 machine so I can try the older driver on that. I'll then try the old Inspiron 8600 with built-in serial port. Won't get to try this until next week due to summer plans but hopefully with all this info I'll figure it out :-)


User avatar
bwinkel67
QL Wafer Drive
Posts: 1187
Joined: Thu Oct 03, 2019 2:09 am

Re: Serial connection between QL and PC

Post by bwinkel67 »

XorA wrote:Considering none of those lines have been used on a PC for 15+ years, I wouldnt even guess at whether they are operational on a modern PC. I do a LOT of rs232 in my line of work and have not used hardware flow control in my whole professional career!
Wow...hardware flow control seemed so critical back in the day (I remember using it a lot with my QL and even my Mac IIsi back in the early-to-mid 90's), but I guess it makes sense if the throughput is so fast that there is no worries of losing bits. I would imagine hardware flow control would just slow things down.


User avatar
XorA
Site Admin
Posts: 1358
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: Serial connection between QL and PC

Post by XorA »

bwinkel67 wrote:
XorA wrote:Considering none of those lines have been used on a PC for 15+ years, I wouldnt even guess at whether they are operational on a modern PC. I do a LOT of rs232 in my line of work and have not used hardware flow control in my whole professional career!
Wow...hardware flow control seemed so critical back in the day (I remember using it a lot with my QL and even my Mac IIsi back in the early-to-mid 90's), but I guess it makes sense if the throughput is so fast that there is no worries of losing bits. I would imagine hardware flow control would just slow things down.
Yeah by 97 we had 16950 UARTS and they could do 2M without dropping a byte no hardware flow control.

Weirdly this was only broken by ARM chips which had shitty UARTS with no FIFOs!


Post Reply