Some questions about ZXPand+ serial port

Discussions about Sinclair ZX80 and ZX81 Hardware
Enigmachine
Posts: 21
Joined: Fri Oct 12, 2018 10:09 pm
Location: Québec

Some questions about ZXPand+ serial port

Post by Enigmachine »

Hello all!

I've finally managed to revive & mod a deadish TS1000 I bought on eBay (pictures soon) and I'm moving on to playing with my sweet ZXPand+.

For my project I was planning on using bidirectional serial communication with a PC serial port and using the PC as an internet proxy (Zeddynet is in limited supply and takes RAM away from the software). Unfortunately soon after building my zxpand jtag to DE9 serial cable I realized that there's no simple "zxpand ser get" command and that sirmorris has not documented a way to get data from serial because he "doesn't know of a use case". :) Is there code/documentation to do it somewhere (even in asm or c) or a better/simpler way to transfer data to/from a PC?

Note that my knowledge of electronics is limited - in fact I'm not even sure the serial cable I made works right; the LOAD "$" command sends the wrong character [ instead of I to zxsvr, I'm not sure why; the only problem I can imagine is a mismatched baud rate, it's funny ZXpand docs says "baud rate < 38400" instead of "baud <= 38400" even if the zxsvr uses 38400 by default. :)

Finally, since we can easily make a USB cable for that serial port and knowing that some microcontrollers have easy to use USB libraries, how hard would it be to make the ZXpand autodetect USB hubs/HID devices and load a good keyboard/mouse driver in the overlay ROM?

Ok that was a mouthful as my first real post but I appreciate all the help!
User avatar
Paul
Posts: 1511
Joined: Thu May 27, 2010 8:15 am
Location: Germanys west end

Re: Some questions about ZXPand+ serial port

Post by Paul »

I have no additional information about
ZXPand+, sorry.
There is also a serial port card from the German ZX-TEAM available, no ZXBasic commands available, just MC.
Zeddynet requires RAM in the Area 0-8K only for initialisation. Once you are connected most of these bytes are not needed anymore. I can supply these Zeddynet cards. Just PM me.
Kind regards
Paul.
P. S. There is a new Serial port card in development. It has 128bytes fifo and is better in higher Baudrates. Should be ready for our meeting at Mahlerts on March 29th.
In theory, there is no difference between theory and practice. But, in practice, there is.
User avatar
mrtinb
Posts: 1906
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Some questions about ZXPand+ serial port

Post by mrtinb »

RS232 communication is not as simple as you might think. RS232 requires a steady baudrate. This is easy on the PC side where you have a chipset with hardware handshake and interrupts.

Hardware handshakes are not available on the ZX81, so we have to use software handshake (XON/XOFF). And the interrupts available on the ZX81 are needed for the display routine. So if ZXpand+ says it supports 38400 baud I assume it's in FAST mode (without display) and in a highly optimized machine language routine.

So I would suggest you set down the baudrate until you get a stable connection. I assume 9600 or 2400 would be better.

Edit: Someone succeeded sending chars to a LCD display with ZXpand+.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
Paul
Posts: 1511
Joined: Thu May 27, 2010 8:15 am
Location: Germanys west end

Re: Some questions about ZXPand+ serial port

Post by Paul »

mrtinb wrote: Tue Jan 08, 2019 6:28 am
Hardware handshakes are not available on the ZX81, so we have to use software handshake (XON/XOFF).
This only applies to ZXPand. The ZX-TEAM serial port cards have full hardware handshake.
Kind regards Paul
In theory, there is no difference between theory and practice. But, in practice, there is.
User avatar
1024MAK
Posts: 5102
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Some questions about ZXPand+ serial port

Post by 1024MAK »

Hardware handshake does not have to use processor interrupt lines. It can be done using regular (as in frequent) polling if a suitable UART chip is used. The UART chip then deals with all the RTS/CTS signalling automatically.

Systems that do not use a UART chip, however, do require far more processor time.

I forget the details, but I think the ZXpand+ may be using the PIC microcontrollers built in serial hardware. Charlie / SirMorris would be the best person to answer the questions though, as he is the designer.

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
User avatar
mrtinb
Posts: 1906
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Some questions about ZXPand+ serial port

Post by mrtinb »

The PIC18F4525 that the ZXpand uses has a EUSART. I think that's what's used.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
1024MAK
Posts: 5102
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Some questions about ZXPand+ serial port

Post by 1024MAK »

Correction, it looks like the ZXpand uses the PIC to bit bash a general purpose I/O pin (also known as a software serial port). See this post where MIDI is being talked about...

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: Some questions about ZXPand+ serial port

Post by Moggy »

mrtinb wrote: Tue Jan 08, 2019 6:28 am RS232 communication is not as simple as you might think. RS232 requires a steady baudrate. This is easy on the PC side where you have a chipset with hardware handshake and interrupts.

Hardware handshakes are not available on the ZX81, so we have to use software handshake (XON/XOFF). And the interrupts available on the ZX81 are needed for the display routine. So if ZXpand+ says it supports 38400 baud I assume it's in FAST mode (without display) and in a highly optimized machine language routine.

So I would suggest you set down the baudrate until you get a stable connection. I assume 9600 or 2400 would be better.

Edit: Someone succeeded sending [url=htt.s://www.sinclairzxworld.com/viewtopic.php?f=6&t=2505]chars to a LCD display[/url] with ZXpand+.


It can transmit in slow mode, for example when using the MIDI player the MIDI data stream it kicks out has to be at a rate of 31250 +/- 1% and it does this easily whilst maintaining display. Also work has been done on a text/speech utility that transmits from the PC auto converted text/alophones to the 81 via a usb/serial adaptor to be sounded by a Cheeta sweet talker, again in slow mode and at bit rate of choice and I find this works very well too.
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: Some questions about ZXPand+ serial port

Post by Moggy »

@Enigmachine

I was in communication earlier with Charlie on another matter and mentioned the topic and he said, Serial GET _is_ supported, it was just not documented at the time and he has updated the on-line manual to reflect this.

https://github.com/charlierobson/ZXpand ... ine-Manual

He also said that he's happy to respond to messages on SellMyRetro that might result in some easier direct communications.

HTH.
Enigmachine
Posts: 21
Joined: Fri Oct 12, 2018 10:09 pm
Location: Québec

Re: Some questions about ZXPand+ serial port

Post by Enigmachine »

@Moggy That's great! I glanced at the updated manual and the command is there, there doesn't seem to be any info on getting the buffer size/data transferred but maybe I can figure it out from the string termination standard SirMorris uses. Time to get coding on the Zeddy again, I haven't done that in 35+ years (?) so it could take me a while to get it working. :)

I'll test lower baudrates to see if that fixes my problem; I believe it will but I was too lazy to recompile the server with a baudrate parameter. :lol:

@Paul Thanks for the RAM use info. If I can't get my cheap serial idea working I'll probably order a Zeddynet card just to finish this project.

Thanks for all the help everyone, you're awesome!
P-L from Québec
Post Reply