User Tools

Site Tools


serial_link_info

Serial (RS232) Communications

Utilities: See the folder (“PC-based-apps”)

Two Windows based tools for PC-V6Z80P communications are supplied:

  • Serial_link.exe - this is a GUI style PC app which allows files to sent and received.
  • SerialTX.exe - this is a console style PC app that allows files to sent from the Windows command line to the V6Z80P.

(There is also a Linux version of SerialTX called sendv6 - see the folder Contributions/Daniel.)

The V6Z80P's default baud rate is 115200, format 8-N-1 (57600 baud can also be selected).


Serial_Link.exe details

To send a file to the V6Z80P's memory from the PC, in FLOS enter:

RX filename address [bank]

Notes

  • If filename is “*” - whatever file sent is accepted.
  • If filename is “!” - the file is executed upon reception.
  • “address” should be in the range $5000-$FFFF
  • [bank] is the upper bank number where it should load (only relevant if address > $7FFF). If not specified, the current bank is used.

FLOS will say “Waiting for file…”. On the PC Serial Link util, click “send file”, and choose a file to send.

To send a file from the PC direct to the V6Z80P's SD card (current directory) use the command:

FRX [path]

To send a file from the V6Z80P's memory to the PC, click “Receive File” on the PC serial link util, then in FLOS enter:

TX filename address length [bank]

The Serial Link PC util will time out after a few seconds if no files are forthcoming.

To send a file from the V6Z80P's SD card (current directory) to the PC use the command:

FILETX filename


SerialTX.exe Details

To send a file from the PC command line to the V6Z80P use SerialTX.exe as follows:

SerialTX filename [COMn] [Baud]

COMn is the serial port you're using on the PC (EG: COM1, COM2 etc) If this is not supplied SerialTX will scan the PC and use the first serial port it finds.

If Baud is not supplied, the default 115200 baud is used. The only other option is 57600 (if this is used, then the COM port must be specified also).

(Obviously you need to use RX, FRX or have a serial requester waiting at the V6Z80 end.)

SerialTX.exe can be set up as a helper tool in various text editors allowing files to be assembled and passed to the V6Z80P with little interaction. It can also be handy to add it to the Windows “Send to” list allowing files to sent using the right click context menu.


(used by RX/TX commands and PC-side utils)

To send a file

  1. Create and send a file header packet (see format below)
  2. Wait for ASCII bytes “OK” from receiver - anything else signifies an error.
  3. Send file byte packet of 256 bytes.
  4. Send 2 byte CRC checksum of packet
  5. Wait for “OK” from receiver - anything else signifies an error.
  6. Goto step 3 until all bytes sent

To Receive a file

  1. Wait for file header.
  2. [Test CRC checksum of header when it arrives.]
  3. [Check filename is that of file required if necessary.]
  4. Send ASCII bytes “OK” if checksum/filename are OK, else any other two chars.
  5. Receive 256 byte file packet
  6. Receive 2 byte CRC of packet
  7. Test CRC of packet
  8. Goto step 4 until all bytes received.

Header Format

(first 256 byte packet)

$00 - $0FASCII filename
$10 - $11Length of file (lo word)
$12 - $13Length of file (hi word)
$14 - $1FASCII “Z80P.FHEADER” (12 chars)
$20 - $FFAll must be zero

(All words are in normal Z80 little-endian format)

File format

Bytes from the file, sent in 256 byte packets followed by a 2 byte checksum word.

CRC computation

The calculation is described as a “standard CRC-CCITT that uses polynomial $1021” and produces a 16 bit output, the Z80 code (slow, unoptimized) to generate it is as follows:

;--Z80 code to make CRC --------------------------------------------------------

; makes checksum in HL, src addr = DE, length = C bytes

crc_checksum

            ld hl,$ffff        
crcloop     ld a,(de)            
            xor h            
            ld h,a            
            ld b,8
crcbyte     add hl,hl
            jr nc,crcnext
            ld a,h
            xor 10h
            ld h,a
            ld a,l
            xor 21h
            ld l,a
crcnext     djnz crcbyte
            inc de
            dec c
            jr nz,crcloop
            ret

;----------------------------------------------------------------------------------



serial_link_info.txt · Last modified: 2017/07/03 14:33 by z00m