Serial QPC to QL

Helpful tips and guides, also new users can ask for help here.
User avatar
Jbizzel
Chuggy Microdrive
Posts: 67
Joined: Mon Jun 19, 2023 9:56 pm
Contact:

Serial QPC to QL

Post by Jbizzel »

I have managed to get the serial working between QPC2 on windows 10 and my real QL.

However, I can't get anything useful to happen.

I want to send a basic file from qpc to my QL

I tried...

Save ser1 (on pc)

Load ser1z (on QL)

But just get "bad parameter"

Please help!


__________________


And beyond it, the deep blue air, that shows
Nothing, and is nowhere, and is endless.

https://jbizzel.itch.io/
martyn_hill
Aurora
Posts: 933
Joined: Sat Oct 25, 2014 9:53 am

Re: Serial QPC to QL

Post by martyn_hill »

Hi JBizzel!

From what you have described, it sounds like you are hitting a slight 'incompatibility' between the SAVE and LOAD commands between SMSQe (as running under QPC) and the version of QDOS and/or TK2 on the target QL.

If that is the case, the cause is the missing 'Byte-serial header' expected by LOAD, but not sent by SAVE. The header (the first 15 bytes expected by LOAD) starts with CHR$ 255, followed by 14 bytes that define such things as the File-type (byte 2), File Length (bytes 3-6) and, for other file types, Data-space etc. LOAD is expecting to see that CHR$ 255 byte at the outset and isn't getting it and reporting 'bad parameter.'

Try this instead: SAVE the file in QPC to the local drive, then use COPY <local_filename> TO 'ser1hz' in QPC and use LOAD 'ser1hz' at the QL end. This will effectively re-instate the byte-serial header as expected by LOAD.

You should ideally enable hardware handshaking (the 'h' parameter), but might get away with it at lower BAUD, and the 'z' parameter will add a CTRL-Z to the end of the byte-stream, which will inform LOAD that the file is complete. This latter parameter is only applicable for pure ASCII byte streams, as any SuperBASIC program source will be.

Good luck!


User avatar
Jbizzel
Chuggy Microdrive
Posts: 67
Joined: Mon Jun 19, 2023 9:56 pm
Contact:

Re: Serial QPC to QL

Post by Jbizzel »

Hi Martin,

Thank you! that has moved things on quite a bit. I was able to send a very small program from my PC to the QL.

When I try larger files the QL sits there forever as if it is still getting data, but something has gone wrong. I am able to break into the process - whereupon it says "not complete"

BUT it is always hanging at the same point. I tried with a few BAS files, and have the same issues. It copies around 20 lines, then gets stuck.


__________________


And beyond it, the deep blue air, that shows
Nothing, and is nowhere, and is endless.

https://jbizzel.itch.io/
martyn_hill
Aurora
Posts: 933
Joined: Sat Oct 25, 2014 9:53 am

Re: Serial QPC to QL

Post by martyn_hill »

Hi again!

Glad to hear that.

I shall assume that you are using the handshaking option as suggested, so as to avoid buffer overrun across the Serial link.

Also, that your serial cable actually has the handshaking lines correctly wired (RTS/CTS).

Depending upon just how long you are waiting before hitting Break, it could simply be that the QL is still busy 'tokenising' the inbound SuperBasic source code, which it does 'on the fly' on a line by line basis. Tokenisation is quite a sluggish process on a basic QL, so perhaps it's just a matter of waiting a little longer?

If you provide some more details about how you wired your serial cable, BAUD rate and just how long you are waiting before hitting Break, we might be able to offer some further advice...


User avatar
Jbizzel
Chuggy Microdrive
Posts: 67
Joined: Mon Jun 19, 2023 9:56 pm
Contact:

Re: Serial QPC to QL

Post by Jbizzel »

Thanks again.,

Here are my notes.


I have a very good quality usb to serial adapter that I use flawlessly with the Z88. It has full hardware handshake. The z88 is very picky.

I made my own QL adapter, it's possible I made some error here. I will check after work. See diagram below. Maybe handshaking lines are not correctly wired (RTS/CTS)

I have tk2 ROM installed

I used ser1 on both machines. Is ser2 wired different?

Regarding baud rate:

I tried many options and waited long periods of time. Generally baud 2400 seemed fine. if I wait 5 minutes or 2 minutes the serial is at line 80 when I break into it.

I deleted the first 80 lines from my listing and saved that as a separate file before sending that over to the QL. Again it send only a 15-20% of the program. I waited some time!

My laptop was running on battery and was fairly low on power. Maybe this didn't help.

Cable design:
Screenshot_20240229-054704__01.jpg
Ps, I have the correct ql plug.
Last edited by Jbizzel on Thu Feb 29, 2024 6:04 am, edited 1 time in total.


__________________


And beyond it, the deep blue air, that shows
Nothing, and is nowhere, and is endless.

https://jbizzel.itch.io/
User avatar
Jbizzel
Chuggy Microdrive
Posts: 67
Joined: Mon Jun 19, 2023 9:56 pm
Contact:

Re: Serial QPC to QL

Post by Jbizzel »

Actually I noticed my cable is different from this diagram...


ql_ser.png
ql_ser.png (3.06 KiB) Viewed 401 times
From

https://oldmachinery.blogspot.com/2014/ ... l.html?m=1


__________________


And beyond it, the deep blue air, that shows
Nothing, and is nowhere, and is endless.

https://jbizzel.itch.io/
martyn_hill
Aurora
Posts: 933
Joined: Sat Oct 25, 2014 9:53 am

Re: Serial QPC to QL

Post by martyn_hill »

Hi again Jbizzel!

A few points:

A. Did you use the device names 'ser1hz' or just 'ser1'?

B. The 2x SER ports on the QL are indeed wired differently - RX/TX and RTS/CTS are swapped between them, so I would expect you to need a different wiring than you show in that image for SER2. (SER1 is wired and labelled as if a DCE/modem, whereas SER2 conversely as DTE/host.)

C. Can you estimate how many bytes actually transferred in each instance? Between the buffer in the IPC chip in the QL and the software buffer maintained by QDOS, there is only about 90 bytes buffering available, before the QL would attempt to pause the event flow by deactivating it's RTS (really CTS!) hardware handshake signal line.

D. Is your IPC the original 8049 or the updated 'Hermes' replacement (which is MUCH more reliable!)?

I still suspect that handshaking is somehow not being enabled. It could be that DTR or similar at the PC/USB to Serial adapter end also needs connecting to the '12v' line (pin-6 at the QL), but don't go there yet...

All in all, this looks more like the typical issues facing serial/RS232 transmission rather than a QL specific issue - and one of the reasons why I developed the QLUB Adapter to allow an emulator on a PC to connect to the native QL Network port instead... But that's another option that you needn't worry about right now, as I'm sure we can fix this serial connection!


Derek_Stewart
Font of All Knowledge
Posts: 3975
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Serial QPC to QL

Post by Derek_Stewart »

Hi

Your cabling looks correct,aybe the hand shaking and flow control is not right.

Try using terminal programme at each end of the serial cable.

For more info on RS232 try this link:
https://www.lammertbies.nl/comm/cable/rs-232


Regards,

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

Re: Serial QPC to QL

Post by Martin_Head »

You might want to try lowering the baud rate to 300. So no handshaking should be needed. And at the QL end use COPY ser1 TO con

That will show you the data without SuperBASIC having to convert it to tokenized form.


martyn_hill
Aurora
Posts: 933
Joined: Sat Oct 25, 2014 9:53 am

Re: Serial QPC to QL

Post by martyn_hill »

That's a good call, Martin :-)


Post Reply