Module programming

Module programming 

Source
Expand description

Binary programming protocol for MCP (Memory Control Program) access.

The TH-D75 supports a binary programming protocol entered via 0M PROGRAM. This provides access to data not available through standard CAT commands, including channel display names.

§Protocol

  • Entry: 0M PROGRAM\r -> 0M\r
  • Read: R + 2-byte page + 0x00 0x00 -> W + 4-byte address + 256-byte data (261 bytes)
  • ACK: 0x06
  • Exit: E

§Safety

Entering programming mode makes the radio stop responding to normal CAT commands. Always exit programming mode when done.

The 0M handler is at firmware address 0xC002F01C.

Structs§

ChannelFlag
A single channel’s flag data (4 bytes per channel at MCP offset 0x2000+).

Constants§

ACK
ACK byte sent after receiving a data block.
APRS_START
First page of APRS messages and settings.
APRS_STATUS_PAGE
APRS message status header page.
BT_START
First page of Bluetooth device data and remaining config.
CHANNELS_PER_MEMGROUP
Channels per memgroup (6 channels + 16 bytes padding = 256 bytes).
CHANNEL_DATA_END
Last page of channel memory data (inclusive).
CHANNEL_DATA_START
First page of channel memory data (192 memgroups x 256 bytes).
CHANNEL_FLAGS_END
Last page of channel flags (inclusive).
CHANNEL_FLAGS_START
First page of channel flags (1200 entries x 4 bytes = 4800 bytes).
CHANNEL_NAMES_END
Last page of channel names (inclusive).
CHANNEL_NAMES_START
First page of channel names (1200 entries x 16 bytes).
CHANNEL_RECORD_SIZE
Size of one channel memory record in bytes.
DSTAR_RPT_START
First page of D-STAR repeater list and callsign list.
ENTER_PROGRAMMING
Entry command to enter programming mode (ASCII).
ENTER_RESPONSE
Expected response when entering programming mode (ASCII).
EXIT
Exit byte to leave programming mode.
FACTORY_CAL_PAGES
Number of factory calibration pages at the end that must never be written.
FLAG_220
Flag used value indicating a 220 MHz channel (150-400 MHz).
FLAG_EMPTY
Flag used value indicating an empty/unused channel slot.
FLAG_RECORD_SIZE
Size of one channel flag record in bytes.
FLAG_UHF
Flag used value indicating a UHF channel (freq >= 400 MHz).
FLAG_VHF
Flag used value indicating a VHF channel (freq < 150 MHz).
GROUP_NAMES_END
Last page of group names (inclusive).
GROUP_NAMES_START
First page of group names (within the names array, indices 1152-1181).
MAX_CHANNELS
Maximum number of usable channel names (channels 0-999).
MAX_WRITABLE_PAGE
Last page that may be safely written (inclusive).
MEMGROUP_COUNT
Number of memgroups (200 memgroups, 192 used for 1152 channels + 8 spare).
MEMGROUP_PADDING
Padding bytes at the end of each memgroup.
NAMES_PER_PAGE
Channel name entries per 256-byte page (256 / 16 = 16).
NAME_ALL_PAGE_COUNT
Number of pages containing all channel name data including extended entries (75 pages, channels 0-1199: scan edges, WX, call channels).
NAME_ENTRY_SIZE
Bytes per channel name entry.
NAME_PAGE_COUNT
Number of pages containing channel name data (63 pages, channels 0-1007).
NAME_START_PAGE
Starting page address for channel name data.
PAGE_SIZE
Size of data payload in each page (256 bytes).
SETTINGS_END
Last page of system settings (inclusive).
SETTINGS_START
First page of system settings (radio state, global config).
TOTAL_CHANNEL_ENTRIES
Total channel entries including extended channels (scan edges, WX, call).
TOTAL_PAGES
Total number of pages in the radio memory (0x0000-0x07A2).
TOTAL_SIZE
Total radio memory in bytes (1955 * 256).
W_HEADER_SIZE
Size of the W response header (W + 2-byte block address + 2-byte data size).
W_RESPONSE_SIZE
Total size of a W response (1 opcode + 4 address + 256 data).

Functions§

build_read_command
Build a binary read command for a given page address.
build_write_command
Build a binary write command for a given page address with 256-byte data.
extract_name
Extract a channel name from a 16-byte entry.
is_factory_calibration_page
Returns true if the given page is within the factory calibration region that must never be overwritten.
parse_channel_flag
Parse a 4-byte channel flag record.
parse_write_response
Parse a write response from the radio.