Read/Write Configuration Memory Pseudocode

This document describes the undocumented CAT commands SPR and SPW for the Yaesu FT-991A.

BEFORE USING THIS INFORMAION, PLEASE COMPLETELY READ AND UNDERSTAND THE BACKGROUND INFORMATION BELOW!

Background Information

This information is courtesy of Gil Kloepfer KI5BPK, and was discovered based on some background work done by Steve Ireland VK3SIR for the Chirp project (see this link for more details) and implemented in RT Systems' ADMS software.

  1. This information has been tested only with the Yaesu FT-991A and Main firmware release V2-01.

  2. Memory is accessed by the undocumented SPR and SPW CAT commands.

  3. The commands return or set the byte addressed together with the next byte following. In order to properly write to the configuration memory, it will be necessary to first read then write so that you are able to properly preserve the contents of the location you are not modifying (the following byte).

  4. DO NOT WRITE ANY MEMORY LOCATION THAT YOU ARE NOT ABSOLUTELY SURE IS EXACTLY WHAT YOU ARE INTENDING TO MODIFY. IT IS POSSIBLE TO OVERWRITE FACTORY CALIBRATION PARAMETERS AND OTHER INTERNAL INFORMATION THAT WILL RENDER YOUR RADIO UNUSABLE, AT BEST. THIS WORKS ON THE FT-991A BUT IT MAY NOT WORK ON YOUR RADIO, AND IT MAY BE DEPENDENT ON SOFTWARE VERSION. KEEP IN MIND THAT MEMORY CONTENTS MAY VARY WITH SOFTWARE VERSION, SO ANY CHANGES BETWEEN SOFTWARE VERSIONS COULD RESULT IN UNEXPECTED MEMORY CONTENTS. THIS IS LIKELY WHY THESE CAT COMMANDS ARE UNDOCUMENTED. USE DOCUMENTED CAT COMMANDS WHENEVER POSSIBLE, EVEN IF USING MEMORY ACCESS IS FASTER OR EASIER.

  5. Caveats/Conventions to Pseudo-code:

    1. Numbers prefixed by "0x" are in hexidecimal
    2. Concatenation means byte-wise concatenate the raw byte values together, do not change numeric values to text numbers
    3. "&" means bit-wise AND and is used below to retrieve the lower 8 bits of the result
    4. "+" means unsigned integer addition
    5. string or character constants are quoted using ' (apostrophe)
    6. This pseudo-code is to describe the algorithm used to implement the memory read/write functionality -- it is not in a real programming language, and requires knowledge of low-level programming to be useful
    7. if "auto-information" mode (CAT "AI") is enabled (see CAT Operation Reference Manual, available on Yaesu's Web Site here for details), it is recommended to disable AI mode temporarily while using these functions. This is because it will be difficult to distinguish an AI report from a valid command response, particularly with the cat_write_memory function. This could be done automatically within the functions, but how to do this is beyond the scope of this algorithm description.

Pseudocode For SPR Command (Read Memory)

function cat_read_memory(address)  returns two sequential 8-bit memory contents
     preamble = 'SPR'

     if address < 0 or address > 32767 then address-is-invalid

     address-high = upper 8 bits of address
     address-low = lower 8 bits of address

     concatenate preamble, address-high, address-low to create command-string

     check-byte = (sum of all byte values of command-string) & 0xFF

     append check-byte and ';' to command-string

     send command-string to CAT interface

     read back 9 bytes of response from CAT interface, error if not complete

     response bytes 1 through 5 must match the first 5 bytes of
               command-string, else error (invalid response)

     memory-byte = response-byte-6
     memory-byte-next = response-byte-7
     response-checksum = (check-byte + memory-byte-high +
                          memory-byte-low) & 0xFF

     if response-checksum does not equal response-byte-8,
                 then error (bad checksum)

     if response-byte-9 is not ';' then error (bad format)

     return memory-byte, memory-byte-next

Pseudocode For SPW Command (Write Memory)

function cat_write_memory(address, data, data-next)  returns success or failure
     preamble = 'SPW'

     if address < 0 or address > 32767 then address-is-invalid
     if data < 0 or data > 255 then data-is-invalid
     if data-next < 0 or data-next > 255 then data-is-invalid

     address-high = upper 8 bits of address
     address-low = lower 8 bits of address

     concatenate preamble, address-high, address-low, data, data-next
           to create command-string

     checksum = (sum of all byte values of command-string) & 0xFF

     append checksum and ';' to command-string

     send command-string to CAT interface

     read back 2 bytes of response from CAT interface, error if not complete

     if response-byte-1 is not 'A' then error (negative acknowledgement)
     if response-byte-2 is not ';' then error (bad response)

     return success
Last revised: Fri Oct 14 11:22:24 CDT 2022
Web page contents ©2021 Gil Kloepfer, Jr. All Rights Reserved

Gil Kloepfer, Jr., http://www.kloepfer.org/sendmemail.html