content/eip545b_4.rst

Tue, 28 Aug 2018 15:05:01 +0200

author
David Douard <david.douard@logilab.fr>
date
Tue, 28 Aug 2018 15:05:01 +0200
changeset 104
8396e709bde5
parent 90
3a2040f53c9f
child 115
6b6e13653348
permissions
-rw-r--r--

improve hgignore

78
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
1 ========================================
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
2 EIP 545B RF Frequency Counter - Part 4
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
3 ========================================
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
4
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
5 :author: David Douard
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
6 :Category: Electronics
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
7 :Tags: test equipment, RF, EIP, 545, 545A, 545B, 575A, 578A, counter
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
8 :series: EIP545B Frequency Counter
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
9 :series_index: 4
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
10
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
11
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
12 This part is about my attempt to modify the firmware to "fix" the problem of
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
13 weird intial setup: a -160MHz offset and a resolution set to 5 digits.
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
14
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
15 In the `previous part <{filename}/eip545b_3.rst>`_, we figured some probable
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
16 spots in the firware where these default setup configurations might be set.
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
17
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
18 EPROM checksums
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
19 ===============
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
20
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
21 In order to be able to modify the content od the firmware without generating an
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
22 error at startup, we must understand how checksum are computed.
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
23
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
24 The Service Manual for the 578B does not explain how it is computed. The one
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
25 for the 545A gives a clue but is not valid for the 545B: in the Option 2 (power
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
26 meter) calibration procedure, since the "power vs. power" and "power vs.
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
27 frequency" calibration tables are stored in the EPROM, the checksum must be
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
28 computed when a calibration is performed. For this unit, the value at address
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
29 0x02F6 must be set so that the sum modulo 256 of all bytes of the EPROM is
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
30 equal to 0xFF.
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
31
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
32 So the checksum is just a matter of sum modulo 256, but on the 545B, each EPROM
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
33 chip has its content verified, as can be deduced by the fact there are 3 error
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
34 codes (31, 32 and 33), one for each EPROM chip.
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
35
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
36 I found the part of the initialisation code that compute this checksum::
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
37
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
38 ; Test PROM bank i (i in 1,2,3);
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
39 ; M000C: start address
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
40 ; M000E: i
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
41 6041 Z6041 CLRA ;4F
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
42 6042 LDY #Z4000 ;10 8E 40 00
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
43 6046 LDX Z000C ;9E 0C
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
44 6048 Z6048 ADDA ,X+ ;AB 80
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
45 604A LEAY -$01,Y ;31 3F
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
46 604C BNE Z6048 ;26 FA
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
47 604E STX >Z000C ;BF 00 0C
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
48 6051 LDB >Z000E ;F6 00 0E
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
49 6054 CMPB #$03 ;C1 03
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
50 6056 BEQ Z605E ;27 06
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
51 6058 DECB ;5A
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
52 6059 LDX #MFFEA ;8E FF EA
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
53 605C ADDA B,X ;AB 85
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
54 605E Z605E COMA ;43
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
55 605F RTS ;39
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
56
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
57
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
58 This chunck of code is called with the start address in 0x000C (set to 0x4000
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
59 on normal initial execution), and EPROM 'bank' in byte 0x000E (can be 1, 2 or
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
60 3). Once again, during normal init execution, this function is called with the
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
61 value 1 in this memory cell.
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
62
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
63 So when i = 1 or 2, the sum if computed (in register A), and the result is
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
64 compared to the value stored at 0xFFEA (first EPROM) and 0xFFEB (second EPROM).
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
65
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
66 For the third one (in which those checksum values are), no comparison is made,
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
67 the sum is expected to be 0xFF, which can be achieved by modifying the value of
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
68 byte 0xFFEC.
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
69
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
70
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
71 Frequency Offset
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
72 ================
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
73
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
74 As explained before, the frequency offset initial value seems to be set in the
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
75 chunck of code around 0x6118-0x6125::
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
76
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
77 6118 LDX #M0276 ;8E 02 76
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
78 611B LDA #$01 ;86 01
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
79 611D STA ,X ;A7 84
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
80 611F STA $02,X ;A7 02
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
81 6121 LDA #$60 ;86 60
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
82 6123 STA $03,X ;A7 03
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
83
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
84 So the easiest way to remove this is to replace this code by NOPs. I've tried
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
85 this, computed the checksums and burnt a pair of EPROMs (only bank 1 and 3 are
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
86 modified).
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
87
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
88 And it worked! Mostly. The offset set to 0 as expected, but the "Offset"
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
89 indicator remains on. I can live with that, but I'll try to figure out how to
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
90 fix this also, if possible.
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
91
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
92
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
93 Digits Resolution
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
94 =================
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
95
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
96 The chuck of initialisation code related to this setup is::
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
97
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
98 6125 LDX #M005D ;8E 00 5D
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
99 6128 LDA #$0D ;86 0D
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
100 612A STA $01,X ;A7 01
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
101 612C LDA #$05 ;86 05
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
102 612E STA >M0045 ;B7 00 45
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
103
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
104
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
105 At least the last 3 lines are directly related to this resolutin setup. So I've
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
106 tried to replace these few opcodes with NOPs.
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
107
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
108 And the result is a partial success: all the digits are displayed when I power
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
109 the device on, but the frequency counter still computes only 5 digits, the
90
3a2040f53c9f [eip545b] typo
David Douard <david.douard@logilab.fr>
parents: 78
diff changeset
110 other ones stay zero. The gating is not modified. Not very useful as is...
78
9e6170316dbe [eip545b] part 4
David Douard <david.douard@logilab.fr>
parents:
diff changeset
111 More digging required!

mercurial