annotate doc/SIM-hardware-debugging @ 929:ab771ce34fac

rvinterf/lowlevel/format.c: get rid of static fmtbuf
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 23 May 2023 05:56:08 +0000
parents 0f138858ff39
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
461
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 This article is only going to be of interest to those who are physically
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 producing Calypso-based hardware and therefore get to deal with the joys of
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 yield troubleshooting and failure analysis. If you are a mere user or software
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 developer working on known-good hardware made by someone other than you, then
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 none of the following applies to you.
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 Testing the SIM interface on a Calypso device
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 =============================================
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 A basic pass/fail test of the SIM interface is quite straightforward: simply
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 insert a test SIM into the socket (at FreeCalypso hw manufacturing we currently
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 use Sysmocom SIMs for this purpose) and issue an AT+CFUN=1 command to the
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 standard firmware; if the SIM interface hardware is good, the command will
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 complete successfully with an OK response, otherwise it will throw up an error.
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 But what do you do when this basic test fails? If you get a "SIM not inserted"
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 error even though the SIM *is* in fact inserted, how do you debug it further?
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 In order to facilitate lower-level debugging of SIM interface woes, we have
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 implemented a standalone simtest program described in this article. To run
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 this simtest program on your Calypso device, run an fc-iram command like this:
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 fc-iram -h fcfam /dev/ttyXXX /opt/freecalypso/target-bin/simtest.srec
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 Like other interactive programs in our target-utils suite, this simtest program
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 will present a '=' prompt for you to type further commands. The following
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 sequence of commands should bring up the SIM interface if the hardware is good:
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 abbinit
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 volt 1.8
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 setup
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 poll on
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 reset 1
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
533
0f138858ff39 doc/SIM-hardware-debugging: note that abbinit is no longer needed
Mychaela Falconia <falcon@freecalypso.org>
parents: 461
diff changeset
34 (Update for fc-host-tools-r11: the explicit abbinit command is no longer needed,
0f138858ff39 doc/SIM-hardware-debugging: note that abbinit is no longer needed
Mychaela Falconia <falcon@freecalypso.org>
parents: 461
diff changeset
35 but it is harmless to issue this extra command like before.)
0f138858ff39 doc/SIM-hardware-debugging: note that abbinit is no longer needed
Mychaela Falconia <falcon@freecalypso.org>
parents: 461
diff changeset
36
461
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 You can change volt 1.8 to volt 3 if needed, but all recently made SIMs prefer
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 1.8 V and merely tolerate higher voltages. TI's Iota ABB chip, which is what
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 we target in FreeCalypso, does not support 5V SIMs - it doesn't have a charge
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 pump or any other boost converter to produce 5 V from lower battery voltages.
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 (It is not just TI but all mobile chipset vendors; it has been a very long time
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 since anyone made a phone that can power 5V SIMs, and any old 5V-only SIMs have
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 thus stopped being usable just as long ago.)
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 If the hardware is good and you have a working SIM inserted in the socket as
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 you execute the above commands, you should see ATR bytes from your SIM appear
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 in your terminal window the moment you issue the last reset 1 command: that
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 final command transitions the SIM reset line from low to high, if the SIM has
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 been given good power and clock prior to this event, this transition causes it
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 to initialize and emit its Answer To Reset, and once you issue the poll on
533
0f138858ff39 doc/SIM-hardware-debugging: note that abbinit is no longer needed
Mychaela Falconia <falcon@freecalypso.org>
parents: 461
diff changeset
51 command, our simtest program listens for incoming bytes from the SIM at the
461
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 same time while it listens for you to type further commands.
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 If you execute the above command sequence with a known-good SIM inserted in the
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 socket and you don't see any ATR bytes on the final reset 1 command, then you
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 have confirmed with a lower-level tool that your SIM interface hardware is
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 having some issues. Give it a poweroff command, rerun the fc-iram command to
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 get a fresh session, and get your oscilloscope ready. Now execute the commands
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 slowly, probing with your o'scope at each step:
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 abbinit
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 volt 1.8
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 The volt command enables the VRSIM regulator in the Iota ABB chip and causes it
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 to put out the selected voltage. You should see this voltage appear on SIM
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 socket contact C1 (VCC); if it fails to appear there, then trace out the circuit
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 coming from VRSIM, and the VRSIM regulator itself (inside the chip) may also be
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 suspect.
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 setup
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 This command puts the SIM interface block inside the Calypso into a sensible
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 state and enables the SIM interface level shifters in the Iota ABB. After this
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 command you should see a good 3.25 MHz clock (13 MHz divided by 4) with selected
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 SIM voltage levels on the SIM CLK line (socket contact C3), the RST line (socket
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 contact C2) should be low, and the I/O line (socket contact C7) should be high.
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 The SIM clock is produced in the Calypso and then voltage-translated by a
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 unidirectional buffer in the Iota ABB, thus if the clock fails to appear at the
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 SIM socket, look for issues in that signal path. For the I/O line to be high
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 at this point in the bring-up sequence, the resistor pull-ups on both DBB-to-ABB
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 and ABB-to-socket sides need to be working; if the I/O line is high on the
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 DBB-to-ABB side and the pull-up on the ABB-to-socket side is good, but the I/O
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 line on the ABB-to-socket side is still low, then there may be something wrong
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 with the level shifter in the ABB holding it low.
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 poll on
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 reset 1
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 (The poll on command can be omitted if you are doing o'scope probing on an empty
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 socket and thus not expecting any ATR.) As you issue that reset 1 command, hold
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 your oscilloscope probe on SIM socket contact C2, which is the RST line - it
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 should go from low to high. Our simtest utility's reset command (reset 0 or
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 reset 1) manipulates one bit in one Calypso register that controls the Calypso
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 chip's SIM_RST output, which then passes through a unidirectional level shifter
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 in the Iota ABB on its way to SIM socket contact C2.
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 On those two FCDEV3B V2 boards that have been rejected as defective because of a
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 non-working SIM interface and which are now being revisited for a more thorough
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 investigation, we have not yet seen any problems with the SIM power supply
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 voltage, with the SIM CLK line or with the I/O line pull-up, but on both boards
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 the SIM RST line is not working: we see a constant low at socket contact C2
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 (the only probe-able point in the entire SIM reset signal path), and reset 1
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 produces no effect. Unfortunately there is no way to probe the DBBSRST signal
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 going from Calypso to Iota (it goes from one BGA to the other on an inner layer
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 without coming up to the surface except right under the two ball pads), thus it
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 is too difficult to tell where the breakage occurs: is it the Calypso failing
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 to put out a high on its SIM_RST output when commanded to do so by the register
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 setting, is it some fault in the PCB shorting this signal to GND before it
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 reaches Iota's DBBSRST input, is it some fault inside the Iota chip itself that
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 causes it to put out a low on its SIMRST output even though the DBBSRST input
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 is high, or is it some fault in the PCB shorting the ABB-to-socket SIM RST
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 output to GND?
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 Given that FCDEV3B is not intended to be a high-volume product (we only need to
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 make enough good boards to provide one to every interested developer or
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 tinkerer), it will probably make more economic sense to simply reject SIM-
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 defective boards and write them off as a loss than to spend astronomical amounts
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 on PCB microsurgery to expose the DBBSRST signal for probing or other in-depth
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 troubleshooting measures along those lines. For future board designs that may
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 need to be produced in higher volumes, the Mother's current plan is to add
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 probe-able test points on DBBSCK and DBBSRST lines, so that if similar problems
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 recur, we'll be able to quickly isolate them to the Calypso side or the Iota
10e168596dfd doc/SIM-hardware-debugging: article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 side.