content/hp34970a_5.rst

Thu, 10 Nov 2022 20:55:51 +0100

author
David Douard <david.douard@sdf3.org>
date
Thu, 10 Nov 2022 20:55:51 +0100
changeset 147
6b6c2254dac1
parent 137
f3070bd842cd
child 148
2f87039dd0b5
permissions
-rw-r--r--

Enable image_process pugins again

132
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
1 ==========================================
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
2 HP 34970A Data Acquisition Unit - part 5
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
3 ==========================================
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
4
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
5 :Author: David Douard
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
6 :Category: Electronics
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
7 :Tags: HP, 34970A, HP34970A, DMM, repair, test equipment
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
8 :series: HP 34970A repair
137
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents: 132
diff changeset
9 :series_index: 5
132
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
10
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
11
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
12 After a loooong pause on this project, I have recently been able to work on it
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
13 again. In `the previous post in this series <{filename}/hp34970a_4.rst>`_, I've
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
14 started to implement a replacement board prototype based on a an NUCLEO board
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
15 and an SSD1322-based OLED display.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
16
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
17 Meanwhile, I have also almost completely described the `communication protocol
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
18 <{filename}/hp34970a_protocol.rst>`_ between the main unit and the front panel.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
19
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
20 In this episode, I'll describe the next steps: make the circuit diagram and the
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
21 PCB for the replacement board.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
22
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
23
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
24 Circuit diagram
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
25 ===============
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
26
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
27 The circuit diagram is rather simple:
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
28
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
29 - an STM32 MCU (I initially chose the `STM32F303RE
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
30 <https://www.st.com/en/microcontrollers-microprocessors/stm32f303re.html>`_,
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
31 but finally used an STM32F303RD just because the former was out of stock when
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
32 I made my command at mouser.) I wanted an STM32 MCU with USB support and
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
33 reasonnable amount of flash and ram just not to have to worry about these
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
34 while writing the firmware.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
35
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
36 - a 8MHz crystal so the clock config used on NUCLEO boards can be used as is.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
37
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
38 - a step-down DC-DC converter to go from the +18V coming from the main unit
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
39 to +5V to power the OLED display and the some chips on the board; I've chosen
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
40 a `TPS560430 <https://www.ti.com/product/TPS560430>`_ from TI,
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
41
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
42 - a 5V->3.3V LDO regulator to power the MCU, an `MCP1811AT-033
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
43 <https://www.microchip.com/wwwproducts/en/MCP1811>`_ by Microship,
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
44
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
45 - a level shifter for the communication lines bertween the MCU and the main
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
46 unit (5V vs. 3.3V logic). For this, instead of going through individual
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
47 Mosfet transistors, I've chosen the `LSF0204PWR
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
48 <https://www.ti.com/product/LSF0204>`_ from TI, to simplify a bit the
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
49 assembly (this chip really is not much more than a bunch of transistors in a
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
50 TSOP package).
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
51
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
52 Here is the diagram I ended up with:
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
53
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
54 .. image:: {static}/images/hp34970a/replacement-front-panel-schematic.svg
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
55 :alt: Schematic for a replacement front panel for the HP 34970A
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
56 :class: image-process-large-photo
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
57
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
58 PCB design
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
59 ==========
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
60
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
61 I've used librecad_ to draw the edge profile of the PCB, after having carefully
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
62 measured the broken PCB, and a kicad plugin to generate nice keypad footprints.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
63 (I had to adjust the generated footprint by hand to make it more usable.)
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
64
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
65 The end result looks like:
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
66
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
67 .. image:: {static}/images/hp34970a/front_panel_replacement_pcb_3d.png
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
68 :alt: 3D view of the PCB for a replacement front panel for the HP 34970A
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
69 :class: image-process-large-photo
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
70
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
71 The 2 buttons on the left are the Reset and the DFU boot mode. The header on
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
72 the right is the SWD port.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
73
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
74 After a few days, the PCB arrived (from the usual places):
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
75
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
76 .. image:: {static}/images/hp34970a/bare_pcb_front.jpg
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
77 :alt: the PCB for a replacement front panel for the HP 34970A
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
78 :class: image-process-large-photo
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
79
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
80 And it fits just fine in the front panel enclosure:
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
81
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
82 .. image:: {static}/images/hp34970a/pcb_test_fit.jpg
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
83 :alt: test fit of the PCB for a replacement front panel for the HP 34970A
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
84 :class: image-process-large-photo
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
85
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
86
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
87 Unfortunately, I made a few mistakes in this design (see below) bit I also made
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
88 the big mistake of swaping the marking of R11 and R12, which defined the
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
89 feedback divider setting the output voltage of the DC-DC converter. As a
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
90 result, I fried a LDO and a STM32F303RD chips!
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
91
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
92 But once replaced correctly, is began to work:
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
93
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
94
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
95 .. image:: {static}/images/hp34970a/pcb_dfu_connection.jpg
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
96 :alt: test USB connection in DFU mode
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
97 :class: image-process-large-photo
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
98
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
99 After installing the OLED display and adjusting the previous verison of the
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
100 code (which was designed for the NUCLEO F446RE board), I could compile it for
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
101 my custom board and make it run:
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
102
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
103 .. image:: {static}/images/hp34970a/pcb_first_test.jpg
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
104 :alt: test of the display circuit
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
105 :class: image-process-large-photo
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
106
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
107 Firmware design
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
108 ===============
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
109
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
110 At this point, I tried to make the CDC USB driver work on the board, but I
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
111 failed to do so. I realized that the USB stack is `actually missing
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
112 <https://forums.mbed.com/t/usbdevice-support-for-stm32f3/10685>`_ for this MCU
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
113 in MBed OS 6. (update: there is a `PR
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
114 <https://github.com/ARMmbed/mbed-os/pull/13874>`_ waiting to be accepted and
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
115 merged to improve support for the STM32F303 family).
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
116
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
117 Unfortunately, I could not make the debug pin of the SWD port work either. I
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
118 can upload a new firmware juste fine via this SWD port (in addition to the DFU
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
119 mode via USB), but I have been ablt tuse the SWO ping to get a console to see
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
120 print statements.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
121
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
122 In last resort, I ended up soledring thin enameled wired directly on the MCU's
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
123 pin to get access to of the available UARTs as console/debugger.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
124
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
125 At least this worked just fine, and I could then work on the code much more
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
126 easily.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
127
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
128 I also had to use my DSLogic logic analyzer to debug a few things and get to a
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
129 point that make the front panel usable:
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
130
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
131 .. peertube:: cc6f4327-703f-42f6-8157-03cd0a987387
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
132
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
133 In this version of the code are many remaining problems, the biggest one being
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
134 the fact the display flickers a lot. In the code of the formware, I have a
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
135 "frame"-buffer in which the main loop draw the information to be displayed, and
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
136 a thread that copy this buffer to the actual display once every 30ms. And in
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
137 the first version display above, there was no DMA involved in tranferring the
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
138 buffer into the display unit.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
139
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
140 Activating the DMA did help a bit, but was not enough to get rid of the
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
141 glitches. The real problem was there was no lock around that buffer, so the
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
142 display refresher thread was making the transfer at any time, including in the
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
143 middle of the drawing proceure. Adding a lock around this buffer finally fixed
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
144 the problem.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
145
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
146 Another problem I had in the first version of the firmware was the fact a
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
147 keypress event could be sent to the main unit during a transmission of a packet
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
148 by this later, which mess the transmission protocol quite a bit. This problem
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
149 is now (mostly, not 100% sure there is no edge case left) fixed.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
150
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
151 Here is an example of this situation occuring (screenshot of a `PulseView
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
152 <https://sigrok.org/wiki/PulseView>`_ session):
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
153
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
154 .. image:: {static}/images/hp34970a/packet-collision.png
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
155 :alt: transmission collision
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
156 :class: image-process-large-photo
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
157
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
158 In the example above, one can see the front panel is starting a transmission
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
159 (sends a 0x66 on the RX line), but while this byte is being sent, the 0x66
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
160 start of transmission byte is also sent by the main unit.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
161
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
162 Not sure yet how to fix this, either by making sure that this situation does
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
163 not occur (which is most unlikely not feasible), or by impriving the transmission
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
164 protocol handling state machine in my firmware to be aware that this may happen
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
165 and be resilient against it.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
166
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
167 But in the end, I've now reach a point where the firmware begins to be really
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
168 usable:
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
169
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
170 .. peertube:: 172bf449-eba7-4429-8840-ab9b2d5398f8
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
171
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
172
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
173
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
174 Design errors
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
175 =============
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
176
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
177 Making this circuit I made a few mistakes and errors.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
178
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
179 Wrong MCU
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
180 ---------
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
181
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
182 I've not paid enough attention when I chose the MCU. The STM32F303RE I chose is
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
183 more then fine on a specifications point of view, however, since I am writing
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
184 the formware using MBedOS, I did pay attention that the USB FS stack is not yet
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
185 supported for this MCU on MBed OS 6.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
186
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
187 My initial idea was to provide a serial communication protocol with the front
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
188 panel to be able to upgrade the firmware easily or get the current display
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
189 content, but this is for now not possible. Will have to stick to GPIB for now.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
190
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
191
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
192 No proper USB VBUS handling
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
193 ---------------------------
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
194
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
195 I decided not to connect the VBUS power line from the USB socket, but it would
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
196 have made my life a bit easier to connect it via the usual protection, so the
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
197 testing / uploading the firmware could have been a bit easier until the front
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
198 panel wasa plugged back to the main unit.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
199
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
200 Even so, it would be nice to be able to upgrade the firmware without having to
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
201 plug the whole unit.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
202
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
203 The real problem of not having connected the VBUS signal is USB detection. If I
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
204 want to be able to implement a USB connection, I need to be able to detect
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
205 wether the USB connector is plugged, and the simplest way of doing that is to
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
206 detect the presence of the VBUS signal.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
207
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
208 No diagnostic/status LED
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
209 ------------------------
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
210
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
211 I should have added a few diagnostic/status LEDs: there are plenty of GPIO left
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
212 unused on the MCU, having those visble indocators is alway handy.
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
213
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
214 No extra UART
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
215 -------------
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
216
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
217 I should have routed at least one unused UART from the MCU to a pair of
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
218 headers: it way easier not to populate such a header than to hack small wires
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
219 directly on the MCU tget a decent console port...
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
220
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
221
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
222
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
223
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
224
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
225
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
226
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
227
f4160af0485c Add a new HP34970A blog post: new front panel PCB
David Douard <david.douard@sdf3.org>
parents:
diff changeset
228 .. _librecad: https://github.com/LibreCAD/LibreCAD

mercurial