-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhowto.html
158 lines (157 loc) · 9.05 KB
/
howto.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<H2 style="padding:0; margin:0; text-align:center;">How to....</H2>
<BR>
<h3 style="padding:0; margin:0;">Connect to the serial port.</h3>
<ul style="padding:0; margin:0;">
<li> Connect USB to MESC board and computer
<li> Power up the controller
<li> Go to Port tab
<li> Select the correct serial port on pull down menu
<li> Select the "Open" button
<li> Note the bottom tool bar has "Get" and "Set" buttons
<li> Those buttons will change color when the serial is connected
</ul>
<BR>
<h3 style="padding:0; margin:0">Debug serial port.</h3>
The MESCcal PYQT5 environment that does serial handling is very stable. If you're having trouble connecting it probably does not have to do with MESCcal. If you can't connect to the serial try:
<ul style="padding:0; margin:0;">
<li> Connecting the MESC board to your computer and THEN powering up the MESC board
<li> Checking to see if your computer sees a new port
<li> Using a different terminal program (for Macs and Linux: screen, Windows: minicom)
</ul>
If you can't view the MESC board through your serial using another terminal program you are not likely to get it to work on MESCcal either.
<BR>
<h3 style="padding:0; margin:0;">Send serial commands.</h3>
<ul style="padding:0; margin:0;">
<li> The Port tab has a send buffer
<li> To test your connection, type a simple command (e.g., "get") and hit send
<li> Results should appear in text box above the send buffer
</ul>
<br>
<h3 style="padding:0; margin:0;">Stream serial data from MESC firmware.</h3>
<ul style="padding:0; margin:0;">
<li> Select "Show json stream" radio button on Port tab
<li> A new text buffer should appear
<li> Select the "Data" button bottom toolbar
<li> The Data button will change color if json is streaming
<li> Json data will appear also in the new text buffer
<li> Note the bottom tool bar has values for Vbus, Phase Amps, etc.
<li> Those values will now be update with real time data
</ul>
<br>
<h3 style="padding:0; margin:0;">View the MESC settings.</h3>
<ul style="padding:0; margin:0;">
<li> Select the Get button on the xbottom toolbar
<li> A large stream of variables should appear in the text buffer Port tab
<li> The results also update the values in the other tabs (e.g., ESC Values, UART)
</ul>
<br>
<h3 style="padding:0; margin:0;">Change the MESC settings that I view.</h3>
The tabs that show MESC settings in this MESCcal app can be configured to show different values on the tabs. This can be controlled through a json file call app_specs.json which is located in the same directory as this python program. If you have fiddled with json, making changes should be relatively self-explanatory. :-)
<br>
<h3 style="padding:0; margin:0;">Change the MESCcal presets.</h3>
The presets tabs are configured app_specs.json located in the same directory as this python program.
<br>
<h3 style="padding:0; margin:0;">Change MESC settings on the command line.</h3>
For example, to change the number of pole pairs:
<ul style="padding:0; margin:0;">
<li> Type, "set pole_pairs 5" in the send buffer of the Port tab
<li> Hit send, or type "enter"
<li> MESC should report pole_pairs was changed in the text buffer of Port tab
</ul>
<br>
<h3 style="padding:0; margin:0;">Change MESC settings using the MESCcal interface.</h3>
For example, to change the number of pole pairs:
<ul style="padding:0; margin:0;">
<li> First update all values by selecting "Get" in the toolbar
<li> Go to the "ESC Values" tab
<li> The values for all variables will appear in small text boxes
<li> Type in a new value in the "pole_pairs" text buffer
<li> Hit the button to the left of the pole_pars buffer and the value will chnage
</ul>
<br>
<h3 style="padding:0; margin:0;">Save all MESC settings.</h3>
Changes that are made to settings are temporary, e.g., if you reboot your board the changes will not be saved. To save your settings, simply select the "Set" button in the bottom toolbar. MESC should report settings were save in the text buffer of Port tab.
<br>
<h3 style="padding:0; margin:0;">Use the hot keys.</h3>
DRAFT TEXT. Traverse between tabs: press 'a' for left, 'd' for right. Traverse between widgets on each tab: '1' left, '6' right, '8' up, and '2' down. Hitting enter on most widgets either opens them or submits a command. 'Page up' and 'page down' help will scroll pages. 'o' attempts a serial open, 'g' does the same as hitting the 'get' button.
<br>
<h3 style="padding:0; margin:0;">Run additonal apps.</h3>
<ul style="padding:0; margin:0;">
<li> Select the "Apps" tab
<li> Buttons will display the available apps, select one.
<li> This launches a stand alone window that will display data or do other things
</ul>
<br>
<h3 style="padding:0; margin:0;">Create a new app.</h3>
You can create your own apps that are launched by MESCcal if you know python and follow a few rules.
<ul style="padding:0; margin:0;">
<li> The apps directory is specified in a configuration file, currently name "app_specs.json"
<li> It is configured in the "module_directory" of that file
<li> Take a look in the apps directory, you can see a set of python modules
<li> Read the document in that directory for the basic requirements to make an app
</ul>
<br>
<h3 style="padding:0; margin:0;">Build a MESC controller.</h3>
<ul style="padding:0; margin:0;">
<li> Download the files <a href="https://github.com/badgineer/MP2-ESC" style="color: #F39C12;">from here</a>
<li> Order the boards from <a href="jlcpcb.com" style="color: #F39C12;">jlcpcb.com</a>
<li> Read the documentation to assemble the board <a href="https://github.com/badgineer/MP2-ESC/tree/main/docs" style="color: #F39C12;">from here</a>
</ul>
<br>
<h3 style="padding:0; margin:0;">Use the STM32CubeIDE debugger with MESC Firmware.</h3>
<ul style="padding:0; margin:0;">
<li> Install the <a href="https://github.com/davidmolony/MESC_Firmware" style="color: #F39C12;">MESC_firmware</a>
<li> Watch <a href="https://www.youtube.com/watch?v=OsqP2L_DqyM" style="color: #F39C12;">this video</a>
</ul>
<br>
<h3 style="padding:0; margin:0;">Flash MESC firmware.</h3>
See <a href="https://www.youtube.com/watch?v=ffT_TOowyAI" style="color: #F39C12;">this video</a>.
<br>
<h3 style="padding:0; margin:0;">Determine your motor parameters.</h3>
Read <a href="https://github.com/badgineer/MP2-ESC/blob/main/docs/MOTOR_PARAM.md" style="color: #F39C12;">this documentation</a>.
<br>
<h3 style="padding:0; margin:0;">Test your motor.</h3>
<ul style="padding:0; margin:0;">
Connections and powering your motor are a bit out of scope but provided that's done...
<li> Set your motor parameters
<li> Go to the presets tab
<li> Try some of the presets to see spin your motor
</ul>
<br>
<h3 style="padding:0; margin:0;">Understand all the MESC commands.</h3>
The MESCcal interface is simply sending commands to the MESC firmware through the serial. The interface commands were written by <a href="https://github.com/Netzpfuscher" style="color: #F39C12;">Netzpfuscher</a> who is responsible for the MESC firmware serial terminal. You can try terminal commands yourself, (see: <i>Send serial commands</i>) or users are encouraged to try it using a terminal program (screen, for Macs and linux, or minicom for Windows). In any case, the following is an incomplete list of MESC terminal commands:
<ul style="padding:0; margin:0;">
<li> <b>get</b> <i>retreives all values from MESC</i>
<li> <b>set pole_pairs 5</b> <i>sets the variable pole_pairs to 5, many other values can be set</i>
<li> <b>log -fl</b> <i>provides a burst of values from fastloop stored in a circular buffer</i>
<li> <b>status json</b> <i>provides a continuous stream MESC values in json at 10hz</i>
<li> <b>status stop</b> <i>stops the json stream</i>
<li> <b>save</b> <i>writes all your settings the MCU</i>
<li> <b>save -d</b> <i>deletes all your settings the MCU. This resets to parameters specified by the original firmware.</i>
</ul>
<br>
<h3 style="padding:0; margin:0;">Understand error codes.</h3>
The MESC firmware error codes are defined in this
<a href="https://github.com/davidmolony/MESC_Firmware/blob/master/MESC_Common/Inc/MESCerror.h" style="color: #F39C12;">header file</a>. A subset of those codes are:
<ul style="padding:0; margin:0;">
<li>OVERCURRENT_PHA :: 1
<li>OVERCURRENT_PHB :: 2
<li>OVERCURRENT_PHC :: 3
<li>OVERVOLTAGE :: 4
<li>UNDERVOLTAGE :: 5
<li>BRK :: 6
<li>OVERTEMPU :: 7
<li>OVERTEMPV :: 8
<li>OVERTEMPW :: 9
<li>OVERTEMP_MOTOR :: 10
</ul>
<br>
Error codes are passed on to the mesc "error" value. Error values are stored in "error" represent binary positions:
<ul style="padding:0; margin:0;">
<li>OVERCURRENT_PHA :: 00001 (1 position)
<li>OVERCURRENT_PHB :: 00010 (2 position, etc..)
<li>OVERCURRENT_PHC :: 00100
<li>OVERVOLTAGE :: 01000
<li>UNDERVOLTAGE :: 10000
</ul>
So for example if you get an error code 16, that correspondds to 10000, or under voltage. This enables multiple codes to be stored in the same value, so for example an error showing overtemp and undervolage would be 0010000 && 1000000 = 1010000, and would be reported as 80.