Page 1 of 2

Some questions about ZXPand+ serial port

Posted: Mon Jan 07, 2019 10:40 pm
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!

Re: Some questions about ZXPand+ serial port

Posted: Tue Jan 08, 2019 6:06 am
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.

Re: Some questions about ZXPand+ serial port

Posted: Tue Jan 08, 2019 6:28 am
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+.

Re: Some questions about ZXPand+ serial port

Posted: Tue Jan 08, 2019 7:51 am
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

Re: Some questions about ZXPand+ serial port

Posted: Tue Jan 08, 2019 10:33 am
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

Re: Some questions about ZXPand+ serial port

Posted: Tue Jan 08, 2019 11:17 am
by mrtinb
The PIC18F4525 that the ZXpand uses has a EUSART. I think that's what's used.

Re: Some questions about ZXPand+ serial port

Posted: Tue Jan 08, 2019 11:35 am
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

Re: Some questions about ZXPand+ serial port

Posted: Tue Jan 08, 2019 3:09 pm
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.

Re: Some questions about ZXPand+ serial port

Posted: Tue Jan 08, 2019 4:22 pm
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.

Re: Some questions about ZXPand+ serial port

Posted: Tue Jan 08, 2019 6:10 pm
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