Project

General

Profile

New Model #1035 » th9000.py

Draft version of the TYT TH9000 memory map - David Fannin, 08/25/2013 10:24 AM

 
1
"""
2
 
3
 Description: Chirp Data Structure of the Memory Map for TYT TH-9000/VHF
4
 Version: 0.1
5
 Date: 8/25/2013
6
 Status: Imcomplete
7
    - This is the initial, incomplete version of the channel data structure. 
8
    - The memory map looks a lot like the Anytone 5888 model, however, these does appear to be significant differences.
9
 ToDo:
10
    - Decode channel DCS settings
11
    - Decode General Options and Settings
12
    - Decode Skip and Channel Set 
13

    
14

    
15
    Memory Map:
16

    
17
    Field                   Start  End   Size
18
                            hex)  (hex)  (dec)
19
    Channel Set Flag        0100  011F    32
20
    Channel Skip Flag       0120  013F    32
21
    Blank/Unknown           0140  01EF    176
22
    Global Options          01F0  191F    5036
23
    Channel 000             2000  201F    32
24
    Channel 001             2000  201F    32
25
    ...
26
    Channel 100             2DC0  2DDF    32
27
    ... 
28
    Channel 199             38E0  38FF    32
29
    Blank/Unknown           3900  3FFF    1792   
30
        Total                             16128 (2^8 = 16384)
31

    
32

    
33
   Protocol for Upload Sequence, Only Writes shown:
34

    
35
   1) Start 
36
      "Program"                   50 52 4F 47 52 41 4D
37
      0x02                        02
38
      "R\0x01\0x40\x10"           52 01 40 10  (?means "Read" address 1040, 16 bytes, but doesn't match write data field) 
39

    
40
   2) Write Records, Loop from address 0100 to 3900, step 0x10
41
     "W"<address><length><data><checksum>"\0x06"   57 .. .. 10 ..(*16)  .. 06  (write record of 16 bytes)  
42
       header[4 bytes]:
43
         command[1] = Write ("W")
44
         address[2] = 0100 to 3900
45
         length[1] = 0x10 (16 bytes length)
46
       data[16 bytes]:
47
         data[16] = 16 byte payload
48
       end[2 bytes]:
49
         checksum[1] = 1 byte,  uses digit check checksum ( sum of header and data bytes, modulo 256)
50
         end of record[1] = 0x06 (ascii ACK char)
51

    
52
   3) END
53
     "END"   45 4E 44
54

    
55
     
56

    
57
"""
58

    
59

    
60
"""
61
  draft memory map , per channel record
62
    - does not include DCS or various tone, cross settings
63
"""
64

    
65
mem_format = """
66
struct memory {
67
  bbcd freq[4];
68
  bbcd offset[4];
69
  u8 unknownA:4,
70
     tune_step:4;
71
  u8 unknownB:4,
72
     channel_width:2,
73
     reverse:1,
74
     txoff:1;
75
  u8 talkaround:1,
76
     compander:1,
77
     unknownC:2,
78
     power:2,
79
     duplex:2;
80
  u8 unknownD:4,
81
     rxtmode:2,
82
     txtmode:2;
83
  u8 unknown5:2,
84
     txtone:6;
85
  u8 unknown6:2,
86
     rxtone:6;
87
  u8 txcode;
88
  u8 rxcode;
89
  u8 unknownE[3];
90
  char name[7];
91
  u8 unknownF:6,
92
     busychannellockout:2;
93
  u8 unknownG[4];
94
  u8 unknownH:7,
95
     scrambler:1; 
96
};
97
#seekto 0x2000;
98
struct memory memory[200];
99
"""
100

    
101

    
102
"""
103
  description of channel record 
104
  bytes:bit   type                 description
105
  ---------------------------------------------------------------------------
106
  4         bbcd freq[4]        receive frequency in packed binary coded decimal  
107
  4         bbcd offset[4]      transmit offset in packed binary coded decimal (note: plus/minus direction set by 'duplex' field)
108
  1         u8
109
   :4       unknownA:4
110
   :4       tune_step:4         tuning step, menu index value from 0-9
111
  1         u8
112
   :4       unknownB:4          not yet decoded, used for DCS coding?
113
   :2       channel_width:2     channel spacing, menu index value from 0-3
114
   :1       reverse:1           reverse flag, 0=off, 1=on (reverses tx and rx freqs)
115
   :1       txoff:1             transmitt off flag, 0=transmit , 1=do not transmit 
116
  1         u8
117
   :1       talkaround:1        talkaround flag, 0=off, 1=on (bypasses repeater) 
118
   :1       compander:1         compander flag, 0=off, 1=on (turns on/off voice compander option)  
119
   :2       unknownC:2          
120
   :2       power:2             tx power setting, value range 0-2, 0=hi,1=med,2=lo 
121
   :2       duplex:2            duplex settings, 0=simplex,1= minus(-) offset, 2= plus (+) offset (see offset field) 
122
  1         u8 
123
   :4       unknownD:4
124
   :2       rxtmode:2           rx tone mode, value range 0-2, 0=none, 1=CTCSS, 2=DCS  (ctcss tone in field rxtone)
125
   :2       txtmode:2           tx tone mode, value range 0-2, 0=none, 1=CTCSS, 3=DCS  (ctcss tone in field txtone)
126
  1         u8 
127
   :2       unknownE:2
128
   :6       txtone:6            tx ctcss tone, menu index
129
  1         u8 
130
   :2       unknownF:2 
131
   :6       rxtone:6            rx ctcss tone, menu index
132
  1         u8 txcode           ?, not used for ctcss
133
  1         u8 rxcode           ?, not used for ctcss
134
  3         u8 unknownG[3]
135
  7         char name[7]        7 byte char string for channel name
136
  1         u8 
137
   :6       unknownH:6,
138
   :2       busychannellockout:2 busy channel lockout option , 0=off, 1=repeater, 2=busy  (lock out tx if channel busy)
139
  4         u8 unknownI[4];
140
  1         u8 
141
   :7       unknownJ:7 
142
   :1       scrambler:1         scrambler flag, 0=off, 1=on (turns on tyt scrambler option)
143
"""
(1-1/14)