content/hp34970a_6.rst

Thu, 10 Nov 2022 19:15:24 +0100

author
David Douard <david.douard@sdf3.org>
date
Thu, 10 Nov 2022 19:15:24 +0100
changeset 146
11e6db4102f1
parent 137
f3070bd842cd
child 148
2f87039dd0b5
permissions
-rw-r--r--

Better fix for matomo integration

137
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
1 ==========================================
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
2 HP 34970A Data Acquisition Unit - part 6
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
3 ==========================================
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
4
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
5
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
6 :Author: David Douard
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
7 :Category: Electronics
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
8 :Tags: HP, 34970A, HP34970A, DMM, repair, test equipment
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
9 :series: HP 34970A repair
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
10 :series_index: 6
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
11
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
12
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
13 Quick follow up; I recently got back on this project to try to complete it and fix
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
14 remaining problems.
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
15
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
16 The source code for the firmware is available here:
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
17
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
18 https://hg.sdfa3.org/hp34970-firmware
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
19
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
20 The Kicad project is available here:
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
21
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
22 https://hg.sdfa3.org/hp34970-pcb
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
23
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
24
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
25 Making the USBDevice work
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
26 =========================
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
27
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
28 As described in the `previous episode <{filename}/hp34970a_5.rst>`_, I could not make
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
29 the USBDevice of the STM32F303RD work with `mbed-os <https://os.mbed.com/>`_ framework I
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
30 use to write the firmware.
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
31
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
32 The `STM32F303RD
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
33 <https://www.st.com/en/microcontrollers-microprocessors/stm32f303rd.html>`_ is not yet
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
34 officially supported by mbed-os (mainl because there is no `NUCLEO
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
35 <https://www.st.com/en/evaluation-tools/stm32-nucleo-boards.html>`_ board with
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
36 this CPU.
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
37
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
38 However the STM32F303RE is supported, at least partially. For example, the USBDevice is
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
39 not working at all in the latest version of mbed-os (6.15.0). But some `work has been
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
40 done recently <https://github.com/ARMmbed/mbed-os/pull/15116>`_ to enable USB_DEVICE on
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
41 CPUs of the STM32F3 family. But this last PR was not enoght to make the USB device work;
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
42 I have submitted a `PR <https://github.com/ARMmbed/mbed-os/pull/15132>`_ that needs to
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
43 be merged to make the USB device actually work.
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
44
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
45 Also, the difference between the 2 being (as far as I know) only the size of the flash size
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
46 (384KB vs. 512 KB).
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
47
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
48 So I had 3 problems to solve:
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
49
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
50 - compile the code for a custom board using the mbed framework in platformio,
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
51 - use a custom CPU decription,
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
52 - use a patched version of the latest version of mbed-os in platformio (while the
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
53 officially supported version at this moment is only the 6.9.0).
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
54
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
55
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
56 Custom version of mbed in platformio
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
57 ------------------------------------
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
58
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
59 Using a custom version of a framework (here mbed) in platformio is not properly
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
60 documented. But thanks to `the response
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
61 <https://community.platformio.org/t/support-for-mbed-os-6-stable-and-mature-apis-cloud-services-support-enhancements-to-the-bare-metal-profile/15079/9>`_
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
62 to my question on the `platformio forum <https://community.platformio.org/>`_, I could
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
63 make it work. Obviously, I submitted `a PR
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
64 <https://github.com/platformio/platformio-docs/pull/214>`_ to `platformio-docs
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
65 <https://github.com/platformio/platformio-docs>`_.
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
66
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
67 So now I have my (more or less) `up to date repository
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
68 <https://github.com/douardda/platformio-framework-mbed>`_ usable as `platform_packages`
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
69 config argument.
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
70
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
71 Custom board and CPU description
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
72 --------------------------------
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
73
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
74 This part I am not completely sure how it should be done. There are actually 2 parts:
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
75 - tell mbed about the CPU description,
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
76 - tell platformio about is and use it.
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
77
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
78 The platformio part is `documented here
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
79 <https://docs.platformio.org/en/latest/platforms/creating_board.html>`_
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
80
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
81 It mostly consists in creating a json file in the `boards/` directory of the platformio
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
82 project directory.
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
83
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
84 For this project, I used the description of the NUCLEO_F303RE as starting point. The
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
85 file is `boards/hp34970_fp_f303rd.json
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
86 <https://hg.sdfa3.org/hp34970-firmware/file/tip/boards/hp34970_fp_f303rd.json>`_ in the
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
87 `firmware source code repository <https://hg.sdfa3.org/hp34970-firmware/>`_.
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
88
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
89 Once the board is described, it can be used in the `platformio.ini` file:
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
90
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
91 .. code-block:: bash
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
92
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
93 ~/e/hp34970-firmware$ pio boards | grep hp34
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
94 hp34970_fp_f303rd STM32F303RDT7 72MHz 384KB 64KB HP34970 Replace Front Panel Board (STM32F303RD, 64k RAM, 384k Flash)
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
95
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
96
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
97
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
98 Then we need to tell mbed about this board. This is `documented there
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
99 <https://os.mbed.com/docs/mbed-os/v6.15/porting/porting-custom-boards.html>`_
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
100
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
101 It is a matter of creating a `custom_targets.json` file with the board description.
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
102 Again, I used the existing NUCLEO_F303RE as starting point, then added/removed what I
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
103 needed for this project:
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
104
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
105 .. code-block:: json
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
106
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
107 {
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
108 "HP34970_FP_F303RD": {
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
109 "inherits": [
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
110 "MCU_STM32F303xE"
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
111 ],
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
112 "overrides": {
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
113 "clock_source": "USE_PLL_HSE_XTAL"
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
114 },
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
115 "device_has_add": [
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
116 "USBDEVICE"
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
117 ],
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
118 "mbed_rom_size": "0x60000",
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
119 "bootloader_supported": true,
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
120 "device_name": "STM32F303RE"
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
121 }
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
122 }
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
123
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
124 Then the actual description (pins, memory config, etc.) are C files put in a
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
125 `TARGET_HP34970_FP_F303RD` directory. Here again, started from files copied from the
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
126 `STM32F303xE target
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
127 <https://github.com/ARMmbed/mbed-os/tree/master/targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303xE>`_.
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
128
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
129
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
130 End result
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
131 ==========
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
132
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
133 It took me some time, but in the end, I finally got a firmware that works OK, including
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
134 a working USB serial port. For now, this serial connection is still used only for
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
135 debugging purpose (and firmware upload in DFU mode), but it may be improved in the
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
136 future, if needs be.
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
137
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
138 So I could put the HP34970A back together (at last). I drilled a couple of small holes
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
139 for the Reset and DFU buttons and a (not so) square hole for the USB plug in the blue
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
140 glass.
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
141
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
142 The result looks very decent to me:
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
143
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
144 .. image:: {static}/images/hp34970a/finished.jpg
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
145 :alt: finished look of the device with the replacement front panel
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
146 :class: image-process-large-photo
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
147
f3070bd842cd HP34970A - part 6
David Douard <david.douard@sdfa3.org>
parents:
diff changeset
148 .. peertube:: 14d0e7e2-74d5-44fe-90e9-d6b102ae01a1

mercurial