├── README.md
├── ScriptCommunicator
├── TMC2208.sce
├── TMC2208.scez
├── TMC220X.sce
├── TMC220X.scez
├── license.txt
└── scripts
│ ├── TMC2208.js
│ ├── TMC2208.ui
│ ├── TMC2208_config.xml
│ ├── TMC2208_scripts.xml
│ ├── TMC220X.js
│ ├── TMC220X.ui
│ ├── TMC220X_config.xml
│ └── TMC220X_scripts.xml
├── hardware
├── SilentStepStick-TMC2100_v10.brd
├── SilentStepStick-TMC2100_v10.jpg
├── SilentStepStick-TMC2100_v10.pdf
├── SilentStepStick-TMC2100_v10.sch
├── SilentStepStick-TMC2100_v11.brd
├── SilentStepStick-TMC2100_v11.jpg
├── SilentStepStick-TMC2100_v11.pdf
├── SilentStepStick-TMC2100_v11.sch
├── SilentStepStick-TMC2100_v12.brd
├── SilentStepStick-TMC2100_v12.jpg
├── SilentStepStick-TMC2100_v12.pdf
├── SilentStepStick-TMC2100_v12.sch
├── SilentStepStick-TMC2100_v12_5V.brd
├── SilentStepStick-TMC2100_v12_5V.jpg
├── SilentStepStick-TMC2100_v12_5V.pdf
├── SilentStepStick-TMC2100_v12_5V.sch
├── SilentStepStick-TMC2100_v13.brd
├── SilentStepStick-TMC2100_v13.jpg
├── SilentStepStick-TMC2100_v13.pdf
├── SilentStepStick-TMC2100_v13.sch
├── SilentStepStick-TMC2100_v13_5V.brd
├── SilentStepStick-TMC2100_v13_5V.jpg
├── SilentStepStick-TMC2100_v13_5V.pdf
├── SilentStepStick-TMC2100_v13_5V.sch
├── SilentStepStick-TMC2100_v20.brd
├── SilentStepStick-TMC2100_v20.pdf
├── SilentStepStick-TMC2100_v20.sch
├── SilentStepStick-TMC2100_v20_5V.brd
├── SilentStepStick-TMC2100_v20_5V.pdf
├── SilentStepStick-TMC2100_v20_5V.sch
├── SilentStepStick-TMC2130_v10.brd
├── SilentStepStick-TMC2130_v10.jpg
├── SilentStepStick-TMC2130_v10.pdf
├── SilentStepStick-TMC2130_v10.sch
├── SilentStepStick-TMC2130_v11.brd
├── SilentStepStick-TMC2130_v11.jpg
├── SilentStepStick-TMC2130_v11.pdf
├── SilentStepStick-TMC2130_v11.sch
├── SilentStepStick-TMC2130_v20.brd
├── SilentStepStick-TMC2130_v20.pdf
├── SilentStepStick-TMC2130_v20.sch
├── SilentStepStick-TMC2208_v10.brd
├── SilentStepStick-TMC2208_v10.jpg
├── SilentStepStick-TMC2208_v10.pdf
├── SilentStepStick-TMC2208_v10.sch
├── SilentStepStick-TMC2208_v11.brd
├── SilentStepStick-TMC2208_v11.jpg
├── SilentStepStick-TMC2208_v11.pdf
├── SilentStepStick-TMC2208_v11.sch
├── SilentStepStick-TMC2208_v12.brd
├── SilentStepStick-TMC2208_v12.jpg
├── SilentStepStick-TMC2208_v12.pdf
├── SilentStepStick-TMC2208_v12.sch
├── SilentStepStick-TMC2208_v13.brd
├── SilentStepStick-TMC2208_v13.jpg
├── SilentStepStick-TMC2208_v13.pdf
├── SilentStepStick-TMC2208_v13.sch
├── SilentStepStick-TMC2208_v20.brd
├── SilentStepStick-TMC2208_v20.pdf
├── SilentStepStick-TMC2208_v20.sch
├── SilentStepStick-TMC2209_v20.brd
├── SilentStepStick-TMC2209_v20.jpg
├── SilentStepStick-TMC2209_v20.pdf
├── SilentStepStick-TMC2209_v20.sch
├── SilentStepStick-TMC5160_v13.brd
├── SilentStepStick-TMC5160_v13.jpg
├── SilentStepStick-TMC5160_v13.pdf
├── SilentStepStick-TMC5160_v13.sch
├── SilentStepStick-TMC5160_v14.brd
├── SilentStepStick-TMC5160_v14.pdf
├── SilentStepStick-TMC5160_v14.sch
├── SilentStepStick-TMC5160_v15.brd
├── SilentStepStick-TMC5160_v15.pdf
├── SilentStepStick-TMC5160_v15.sch
├── StepStick-Protector_v10.brd
├── StepStick-Protector_v10.jpg
├── StepStick-Protector_v10.pdf
├── StepStick-Protector_v10.sch
├── StepStick-Protector_v11.brd
├── StepStick-Protector_v11.jpg
├── StepStick-Protector_v11.pdf
├── StepStick-Protector_v11.sch
├── StepStick-Protector_v20.brd
├── StepStick-Protector_v20.pdf
├── StepStick-Protector_v20.sch
├── StepStick-Tester_v10.brd
├── StepStick-Tester_v10.pdf
└── StepStick-Tester_v10.sch
└── software
├── TMC2100.ino
├── TMC2130.ino
├── TMC220X.ino
└── TMC5160.ino
/README.md:
--------------------------------------------------------------------------------
1 | # SilentStepStick
2 | The Silent-Step-Stick is a Stepper Motor Driver Board for 2-Phase Motors based on [Trinamic](https://www.trinamic.com) Motor Drivers.
3 |
4 | * Hardware compatible with [StepStick](https://reprap.org/wiki/StepStick) and [Pololu A4988](https://www.pololu.com/product/1182)
5 | * [Trinamic](https://www.trinamic.com) stepper motor driver (chopper drive / constant current drive) with
6 | * Automatic standby current reduction
7 | * **microPlyer** - microstep interpolator for increased smoothness of microstepping
8 | * **stealthChop** - for quiet operation and smooth motion
9 | * **spreadCycle** - highly dynamic motor control chopper
10 | * Open-Source and released under the [Creative Commons Attribution Share-Alike License](https://creativecommons.org/licenses/by-sa/4.0/).
11 | * **[Documentation on learn.watterott.com](https://learn.watterott.com)**
12 |
--------------------------------------------------------------------------------
/ScriptCommunicator/TMC2208.sce:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ScriptCommunicator/TMC2208.scez:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/ScriptCommunicator/TMC2208.scez
--------------------------------------------------------------------------------
/ScriptCommunicator/TMC220X.sce:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ScriptCommunicator/TMC220X.scez:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/ScriptCommunicator/TMC220X.scez
--------------------------------------------------------------------------------
/ScriptCommunicator/license.txt:
--------------------------------------------------------------------------------
1 | License Agreement
2 |
3 | Copyright (c) 2017-2020 Watterott electronic (www.watterott.com)
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without modification,
7 | are permitted provided that the following conditions are met:
8 |
9 | * Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright notice, this
13 | list of conditions and the following disclaimer in the documentation and/or
14 | other materials provided with the distribution.
15 |
16 | * Neither the name of the copyright holders nor the names of its contributors
17 | may be used to endorse or promote products derived from this software without
18 | specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/ScriptCommunicator/scripts/TMC2208.js:
--------------------------------------------------------------------------------
1 | // ****************** Start COM-Port ********************************
2 |
3 | var serialPort = scriptThread.createSerialPort();
4 | var baudrate = 115200; //115200 57600 9600
5 | var anticollisionTime = 3*80*1000/baudrate;
6 | var receivedData = Array();
7 | var packetsSend = 0, packetsReceived = 0;
8 |
9 | var settings = scriptThread.getMainInterfaceSerialPortSettings();
10 | UI_COMPORT_comboBox.addItem(settings.name);
11 |
12 | for(var i=1; i<50; i++)
13 | {
14 | UI_COMPORT_comboBox.addItem("COM"+i);
15 | }
16 |
17 | function connectButtonClicked()
18 | {
19 | if(UI_Connect_pushButton.text() == "Connect")
20 | {
21 | var x = UI_COMPORT_comboBox.currentText();
22 |
23 | serialPort.setPortName(UI_COMPORT_comboBox.currentText());
24 | if (serialPort.open())
25 | {
26 | serialPort.setBaudRate(baudrate);
27 | serialPort.setDataBits(8);
28 | serialPort.setParity("None");
29 | serialPort.setStopBits("1");
30 | serialPort.setFlowControl("None");
31 | serialPort.setDTR(true);
32 | serialPort.setRTS(true);
33 |
34 | UI_Connect_pushButton.setText("Disconnect");
35 |
36 | packetsSend = 0;
37 | packetsReceived = 0
38 | if(initAfterConnection())
39 | {
40 | UI_tabWidget.setEnabled(true);
41 | return; // connection successful
42 | }
43 | }
44 | else
45 | {
46 | scriptThread.messageBox("Critical", 'Error', 'Could not open serial port.');
47 | }
48 | }
49 |
50 | // disconnect or error on connection
51 | UI_DRV_STATUS_polling_checkBox.setChecked(false);
52 | DRV_STATUS_Timer.stop();
53 | TSTEP_Timer.stop();
54 | serialPort.close();
55 | UI_Connect_pushButton.setText("Connect");
56 | UI_tabWidget.setEnabled(false);
57 | }
58 |
59 | function showSendReceivedPackets()
60 | {
61 | UI_RW_label.setText("Requests send: "+packetsSend+" received: "+packetsReceived);
62 | }
63 |
64 | function waitReceived()
65 | {
66 | var timeout = 400;
67 |
68 | while(packetsSend != packetsReceived)
69 | {
70 | scriptThread.sleepFromScript(10);
71 | timeout--;
72 | if(timeout <= 0)
73 | {
74 | scriptThread.messageBox("Critical", "Error", "Sending failed. Check hardware connection and serial port.");
75 | return false;
76 | }
77 | }
78 |
79 | return true;
80 | }
81 |
82 | // ****************** End COM-Port ********************************
83 |
84 |
85 | function dialogFinished(e) //The dialog is closed.
86 | {
87 | if(UI_Connect_pushButton.text() == "Disconnect")
88 | {
89 | DRV_STATUS_Timer.stop();
90 | TSTEP_Timer.stop();
91 | serialPort.close();
92 | }
93 | scriptThread.stopScript()
94 | }
95 |
96 | function calcCRC(datagram, datagramLength)
97 | {
98 | var crc = 0;
99 | for (var i = 0; i < datagramLength; i++)
100 | {
101 | var currentByte = datagram[i];
102 | for (var j = 0; j < 8; j++)
103 | {
104 | if ((crc >> 7) ^ (currentByte & 0x01))
105 | {
106 | crc = (crc << 1) ^ 0x07;
107 | }
108 | else
109 | {
110 | crc = (crc << 1);
111 | }
112 | crc &= 0xff;
113 | currentByte = currentByte >> 1;
114 | }
115 | }
116 | return crc; //& 0xff;
117 | }
118 |
119 | function getSubBits(value32, start, len)
120 | {
121 | var mask = 0;
122 |
123 | for(var i=0; i> start) & mask;
130 | }
131 |
132 | function decimalToHex(d, padding)
133 | {
134 | var hex = (Number(d) >>> 0).toString(16); // >>> 0 makes an unsigned integer
135 | padding = typeof (padding) === "undefined" || padding === null ? padding = 2 : padding;
136 |
137 | while (hex.length < padding) {
138 | hex = "0" + hex;
139 | }
140 |
141 | return "0x" + hex;
142 | }
143 |
144 | function showRegister(register)
145 | {
146 | var value32 = register.value;
147 |
148 | var oldText = register.treeItem.text(1);
149 | var newText = decimalToHex(value32, 8);
150 | register.treeItem.setText(1, newText);
151 | if(oldText == newText)
152 | register.treeItem.setForegroundColor(1, "black");
153 | else
154 | register.treeItem.setForegroundColor(1, "red");
155 |
156 | for(var n=0; n> 2); // number of hex digits to display
163 | var newText = " " + decimalToHex(value, digits);
164 | register.bitName[n].treeItem.setText(1, newText);
165 | if(oldText == newText)
166 | register.bitName[n].treeItem.setForegroundColor(1, "black");
167 | else
168 | register.bitName[n].treeItem.setForegroundColor(1, "red");
169 |
170 | // optional callbacks to other check- or spin boxes
171 | if(register.bitName[n].checkBoxColor)
172 | {
173 | if(value)
174 | register.bitName[n].checkBoxColor.setBackgroundColor("red");
175 | else
176 | register.bitName[n].checkBoxColor.setBackgroundColor("white");
177 | }
178 |
179 | if(register.bitName[n].checkBox)
180 | {
181 | register.bitName[n].checkBox.blockSignals(true); // block clickedSignal signal to avoid recursion
182 | register.bitName[n].checkBox.setChecked(value);
183 | register.bitName[n].checkBox.blockSignals(false); // unblock clickedSignal signal
184 | }
185 |
186 | if(register.bitName[n].spinBox)
187 | {
188 | register.bitName[n].spinBox.blockSignals(true); // block valueChangedSignal signal to avoid recursion
189 | register.bitName[n].spinBox.setValue(value);
190 | register.bitName[n].spinBox.blockSignals(false); // unblock valueChangedSignal signal
191 | }
192 |
193 | if(register.bitName[n].callback)
194 | register.bitName[n].callback(value);
195 | }
196 | }
197 |
198 | function updateTreeWidget(datagram)
199 | {
200 | var regAddr = datagram[2];
201 | var value32 = (datagram[3]<<24) | (datagram[4]<<16) | (datagram[5]<<8) | datagram[6];
202 |
203 | for(var i=0; i= 4)
223 | {
224 | if((receivedData[0] & 0x0f) == 0x05)
225 | {
226 | if(receivedData[1] <= 3) // echo datagram, slaveAddr 0-3
227 | {
228 | if(receivedData[2] & 0x80) // write request
229 | {
230 | if(receivedData.length >= 8)
231 | {
232 | for(var i = 0; i < 8; i++) // remove echo datagram
233 | receivedData.shift();
234 | packetsReceived++;
235 | showSendReceivedPackets();
236 | }
237 | else
238 | return; // skip decoding, not enougth data received
239 | }
240 | else // read request
241 | {
242 | for(var i = 0; i < 4; i++) // remove echo datagram
243 | receivedData.shift();
244 | }
245 | }
246 | else // answer from TMC2208 to decode
247 | {
248 | if(receivedData.length >= 8)
249 | {
250 | var datagram = receivedData.slice(0, 8);
251 | for(var i = 0; i < 8; i++)
252 | receivedData.shift();
253 |
254 | // check reply
255 | if(datagram[1] == 0xff && datagram[7] == calcCRC(datagram, 7))
256 | {
257 | updateTreeWidget(datagram);
258 | packetsReceived++;
259 | showSendReceivedPackets();
260 | }
261 | else
262 | scriptThread.messageBox("Critical", "Error", "Wrong CRC received.");
263 | }
264 | else
265 | return; // skip decoding, not enougth data received
266 | }
267 | }
268 | else
269 | {
270 | // somthing wrong received, remove 1 byte
271 | receivedData.shift();
272 | }
273 | }
274 | }
275 |
276 | function readRegister(addr)
277 | {
278 | var datagram = [0x05, 0x00, addr, 0x00]; //sync, slaveAddr, regAddr, crc
279 |
280 | datagram[3] = calcCRC(datagram, 3);
281 |
282 | var bytesSend = serialPort.write(datagram);
283 | scriptThread.sleepFromScript(anticollisionTime);
284 |
285 | if(bytesSend != datagram.length)
286 | {
287 | scriptThread.messageBox("Critical", "Error", "Sending failed. Check hardware connection and serial port.");
288 | return false;
289 | }
290 | packetsSend++;
291 | showSendReceivedPackets();
292 | return true;
293 | }
294 |
295 | function writeRegister(addr, value32)
296 | {
297 | var datagram = [0x05, 0x00, (0x80 | addr), 0x00, 0x00, 0x00, 0x00, 0x00]; //sync, slaveAddr, write+regAddr, 4byte data, crc
298 |
299 | datagram[3] = (value32 >>> 24) & 0xff;
300 | datagram[4] = (value32 >>> 16) & 0xff;
301 | datagram[5] = (value32 >>> 8) & 0xff;
302 | datagram[6] = (value32 >>> 0) & 0xff;
303 | datagram[7] = calcCRC(datagram, 7);
304 |
305 | var bytesSend = serialPort.write(datagram);
306 | scriptThread.sleepFromScript(anticollisionTime);
307 |
308 | if(bytesSend != datagram.length)
309 | {
310 | scriptThread.messageBox("Critical", "Error", "Sending failed. Check hardware connection and serial port.");
311 | return false;
312 | }
313 | packetsSend++;
314 | showSendReceivedPackets();
315 | return true;
316 | }
317 |
318 |
319 | function readAllRegisters()
320 | {
321 | for(var i = 0; i < AllRegisters.length; i++)
322 | {
323 | if(AllRegisters[i].rw_info != "Write only")
324 | if(!readRegister(AllRegisters[i].addr))
325 | break;
326 | }
327 | }
328 |
329 | function updateRegister(addr, bit, len, value)
330 | {
331 | for(var i=0; i> 2); // number of hex digits to display
366 | var range;
367 | if (len<32)
368 | range = decimalToHex((1< 50)
813 | UI_PWM_FREQ_spinBox.setBackgroundColor("red");
814 | else
815 | UI_PWM_FREQ_spinBox.setBackgroundColor("white");
816 | UI_PWM_FREQ_Label.setText("Frequency = " + parseFloat(fpwm[value]).toFixed(1) + " kHz");
817 | }
818 |
819 | function UI_TOFF_spinBoxValueChanged(value)
820 | {
821 | setRegisterByName("TOFF", value);
822 | }
823 |
824 | function UI_TBL_spinBoxValueChanged(value)
825 | {
826 | setRegisterByName("TBL", value);
827 | }
828 |
829 | function UI_HSTRT_spinBoxValueChanged(value)
830 | {
831 | setRegisterByName("HSTRT", value);
832 | }
833 |
834 | function UI_HEND_spinBoxValueChanged(value)
835 | {
836 | setRegisterByName("HEND", value);
837 | }
838 |
839 | function UI_TPWMTHRS_spinBoxValueChanged(value)
840 | {
841 | setRegisterByName("TPWMTHRS", value);
842 | }
843 |
844 | function UI_PWM_LIM_spinBoxValueChanged(value)
845 | {
846 | setRegisterByName("PWM_LIM", value);
847 | }
848 |
849 | function UI_PWM_REG_spinBoxValueChanged(value)
850 | {
851 | setRegisterByName("PWM_REG", value);
852 | }
853 |
854 | function UI_PWM_OFS_spinBoxValueChanged(value)
855 | {
856 | setRegisterByName("PWM_OFS", value);
857 | }
858 |
859 | function UI_PWM_GRAD_spinBoxValueChanged(value)
860 | {
861 | setRegisterByName("PWM_GRAD", value);
862 | }
863 |
864 | // ****************** End StealthChop/SpreadCycle ********************************
865 |
866 |
867 | // ****************** Start DRV_STATUS polling ********************************
868 |
869 | function poll_DRV_STATUS_function()
870 | {
871 | readRegister(0x01); // GSTAT
872 | readRegister(0x6F); // DRV_STATUS
873 | }
874 |
875 | var DRV_STATUS_Timer = scriptThread.createTimer()
876 | DRV_STATUS_Timer.timeoutSignal.connect(poll_DRV_STATUS_function);
877 |
878 | function UI_DRV_STATUS_Polling_checkBox_Clicked()
879 | {
880 | var enabled = UI_DRV_STATUS_polling_checkBox.isChecked();
881 |
882 | UI_DRV_STATUS_Polling_groupBox.setEnabled(enabled);
883 | UI_GSTAT_groupBox.setEnabled(enabled);
884 |
885 | UI_checkBox_1.setEnabled(enabled);
886 | UI_checkBox_2.setEnabled(enabled);
887 | UI_checkBox_3.setEnabled(enabled);
888 | UI_checkBox_4.setEnabled(enabled);
889 | UI_checkBox_5.setEnabled(enabled);
890 | UI_checkBox_6.setEnabled(enabled);
891 | UI_checkBox_7.setEnabled(enabled);
892 | UI_checkBox_8.setEnabled(enabled);
893 | UI_checkBox_9.setEnabled(enabled);
894 | UI_checkBox_10.setEnabled(enabled);
895 | UI_checkBox_11.setEnabled(enabled);
896 | UI_checkBox_12.setEnabled(enabled);
897 | UI_checkBox_13.setEnabled(enabled);
898 | UI_checkBox_14.setEnabled(enabled);
899 | UI_checkBox_15.setEnabled(enabled);
900 | UI_checkBox_16.setEnabled(enabled);
901 |
902 | if(enabled)
903 | DRV_STATUS_Timer.start(500);
904 | else
905 | DRV_STATUS_Timer.stop();
906 | }
907 | // ****************** End DRV_STATUS polling ********************************
908 |
909 |
910 | // ****************** Start TSTEP recordng ********************************
911 |
912 | function clearButtonPressed()
913 | {
914 | plotWindow.clearGraphs();
915 | }
916 |
917 | function TSTEP_showGraph()
918 | {
919 | plotWindow.show();
920 | }
921 |
922 | function poll_TSTEP_function()
923 | {
924 | if(!readRegister(0x12)) // TSTEP
925 | TSTEPPollCounter = 1; // stop on error
926 |
927 | if(TSTEPPollCounter > 0)
928 | {
929 | TSTEPPollCounter--;
930 | if(TSTEPPollCounter == 0)
931 | {
932 | TSTEP_Timer.stop();
933 | UI_RecordingStart_pushButton.setEnabled(true);
934 | UI_RecordingStart_pushButton.setText("Start");
935 | plotWindow.show();
936 | }
937 | }
938 | }
939 |
940 | var TSTEPPollCounter = 0;
941 | var TSTEPGraphXCounter = 0;
942 | var TSTEP_Timer = scriptThread.createTimer()
943 | TSTEP_Timer.timeoutSignal.connect(poll_TSTEP_function);
944 |
945 | function TSTEP_startRecording()
946 | {
947 | var pollInterval = 50;
948 |
949 | plotWindow.clearGraphs();
950 | UI_RecordingStart_pushButton.setEnabled(false);
951 | UI_RecordingStart_pushButton.setText("Recording...");
952 | TSTEPPollCounter = UI_RecordingTime_spinBox.value()*1000 / pollInterval;
953 | TSTEPGraphXCounter = 0;
954 | TSTEP_Timer.start(pollInterval);
955 | plotWindow.show();
956 | }
957 |
958 | function setTSTEP_PollValue(value)
959 | {
960 | if(TSTEPPollCounter > 0)
961 | {
962 | if(value > 250)
963 | value = 250; // upper limit in graph
964 | plotWindow.addDataToGraph(plotWindowGraph1Index, TSTEPGraphXCounter, value);
965 | TSTEPGraphXCounter++;
966 | }
967 | }
968 |
969 | // ****************** End TSTEP recordng ********************************
970 |
971 |
972 | // ****************** Start OTP programmer ********************************
973 |
974 | function UI_OTPBYTE_spinBoxValueChanged(value)
975 | {
976 | UI_OTP_Name_label.setText("Name: otp" + UI_OTPBYTE_spinBox.value() + "." + UI_OTPBIT_spinBox.value());
977 | }
978 |
979 | function UI_OTPBIT_spinBoxValueChanged(value)
980 | {
981 | UI_OTP_Name_label.setText("Name: otp" + UI_OTPBYTE_spinBox.value() + "." + UI_OTPBIT_spinBox.value());
982 | }
983 |
984 | function UI_OTP_pushButtonClicked()
985 | {
986 | var bi = UI_OTPBIT_spinBox.value();
987 | var by = UI_OTPBYTE_spinBox.value();
988 |
989 | if(scriptThread.showYesNoDialog("Critical", "WARNING", "Setting otp" + by + "." + bi + " to '1'?\n\nAre you absolutely shure?\nYou can not undo this bit writing!"))
990 | {
991 | var value32 = 0xbd00 | (by << 4) | bi;
992 | if(scriptThread.showYesNoDialog("Critical", "WARNING", "Double check:\n\nWriting "+decimalToHex(value32, 8) + " to OTP_PROG?"))
993 | {
994 | writeRegister(0x04, value32); // OTP_PROG
995 |
996 | scriptThread.sleepFromScript(10);
997 | scriptThread.messageBox("Information", "OPT_PROG", "Bit programmed!\nRead all registers and check the result under OTP_READ.");
998 | }
999 | }
1000 | }
1001 |
1002 | // ****************** End OTP programmer ********************************
1003 |
1004 | function initAfterConnection()
1005 | {
1006 | readAllRegisters();
1007 | if(waitReceived())
1008 | {
1009 | OTP_READ_Decoder(); // setting some reset values from otp-Registers
1010 | if(waitReceived())
1011 | {
1012 | setRegisterByName("IRUN", 31); // 31 = reset default
1013 | setRegisterByName("IHOLD", OptRead.IHOLD);
1014 | setRegisterByName("IHOLDDELAY", OptRead.IHOLDDELAY);
1015 | setRegisterByName("TPOWERDOWN", 20); // 20 = reset default
1016 | setRegisterByName("TPWMTHRS", OptRead.TPWMTHRS);
1017 |
1018 | // init
1019 | setRegisterByName("PDN_DISABLE", 1);
1020 | return true;
1021 | }
1022 | }
1023 | return false;
1024 | }
1025 |
1026 |
1027 | // ********************** Signal connections *****************************
1028 |
1029 | UI_Connect_pushButton.clickedSignal.connect(connectButtonClicked);
1030 | serialPort.readyReadSignal.connect(dataReceivedSlot);
1031 |
1032 | initTreeWidget(AllRegisters, UI_GeneralTreeWidget);
1033 | UI_ReadAllButton.clickedSignal.connect(readAllRegisters);
1034 |
1035 | // Init Motor Current
1036 | UI_spinBox_I_RUN.valueChangedSignal.connect(UI_I_RUN_spinBoxValueChanged);
1037 | UI_spinBox_I_HOLD.valueChangedSignal.connect(UI_I_HOLD_spinBoxValueChanged);
1038 | UI_spinBox_I_HOLD_DELAY.valueChangedSignal.connect(UI_I_HOLD_DELAY_spinBoxValueChanged);
1039 | UI_spinBox_T_POWER_DOWN.valueChangedSignal.connect(UI_T_POWER_DOWN_spinBoxValueChanged);
1040 |
1041 | UI_EN_SPREADCYCLE_checkBox.clickedSignal.connect(UI_EN_SPREADCYCLE_checkBoxValueChanged);
1042 | UI_PWM_AUTOSCALE_checkBox.clickedSignal.connect(UI_PWM_AUTOSCALE_checkBoxValueChanged);
1043 | UI_PWM_AUTOGRAD_checkBox.clickedSignal.connect(UI_PWM_AUTOGRAD_checkBoxValueChanged);
1044 | UI_PWM_FREQ_spinBox.valueChangedSignal.connect(UI_PWM_FREQ_spinBoxValueChanged);
1045 | UI_TOFF_spinBox.valueChangedSignal.connect(UI_TOFF_spinBoxValueChanged);
1046 | UI_TBL_spinBox.valueChangedSignal.connect(UI_TBL_spinBoxValueChanged);
1047 | UI_HSTRT_spinBox.valueChangedSignal.connect(UI_HSTRT_spinBoxValueChanged);
1048 | UI_HEND_spinBox.valueChangedSignal.connect(UI_HEND_spinBoxValueChanged);
1049 | UI_TPWMTHRS_spinBox.valueChangedSignal.connect(UI_TPWMTHRS_spinBoxValueChanged);
1050 | UI_PWM_LIM_spinBox.valueChangedSignal.connect(UI_PWM_LIM_spinBoxValueChanged);
1051 | UI_PWM_REG_spinBox.valueChangedSignal.connect(UI_PWM_REG_spinBoxValueChanged);
1052 | UI_PWM_OFS_spinBox.valueChangedSignal.connect(UI_PWM_OFS_spinBoxValueChanged);
1053 | UI_PWM_GRAD_spinBox.valueChangedSignal.connect(UI_PWM_GRAD_spinBoxValueChanged);
1054 |
1055 | // DRV Status polling
1056 | UI_DRV_STATUS_polling_checkBox.clickedSignal.connect(UI_DRV_STATUS_Polling_checkBox_Clicked);
1057 |
1058 | // TSTEP recording
1059 | var plotWindow = scriptThread.createPlotWindow();
1060 | plotWindow.setWindowTitle("plot window created/used by script");
1061 | plotWindow.setAxisLabels("x axis plot 1", "y axis plot 1");
1062 | plotWindow.showLegend(true);
1063 | plotWindow.setInitialAxisRanges(100, 0, 300);
1064 | var plotWindowGraph1Index = plotWindow.addGraph("blue", "solid", "TSTEP");
1065 | plotWindow.showHelperElements(true, true, true, true, true, true, true);
1066 |
1067 | UI_RecordingShow_pushButton.clickedSignal.connect(TSTEP_showGraph);
1068 | UI_RecordingStart_pushButton.clickedSignal.connect(TSTEP_startRecording);
1069 | plotWindow.clearButtonPressedSignal.connect(clearButtonPressed);
1070 |
1071 | // OPT Programmer
1072 | UI_OTPBYTE_spinBox.valueChangedSignal.connect(UI_OTPBYTE_spinBoxValueChanged);
1073 | UI_OTPBIT_spinBox.valueChangedSignal.connect(UI_OTPBIT_spinBoxValueChanged);
1074 | UI_OTP_pushButton.clickedSignal.connect(UI_OTP_pushButtonClicked);
1075 |
1076 | UI_Dialog.finishedSignal.connect(dialogFinished);
1077 |
--------------------------------------------------------------------------------
/ScriptCommunicator/scripts/TMC2208.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Dialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 782
10 | 650
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 | SilentStepStick TMC2208 Configurator (www.watterott.com)
21 |
22 |
23 |
24 | QLayout::SetDefaultConstraint
25 |
26 | -
27 |
28 |
-
29 |
30 |
31 | Serial Port:
32 |
33 |
34 |
35 | -
36 |
37 |
38 | -
39 |
40 |
41 | Connect
42 |
43 |
44 | false
45 |
46 |
47 |
48 | -
49 |
50 |
51 |
52 |
53 |
54 |
55 | -
56 |
57 |
58 | Qt::Horizontal
59 |
60 |
61 |
62 | 40
63 | 20
64 |
65 |
66 |
67 |
68 |
69 |
70 | -
71 |
72 |
73 | false
74 |
75 |
76 | 0
77 |
78 |
79 |
80 | Tuning
81 |
82 |
83 |
84 |
85 | 20
86 | 20
87 | 431
88 | 141
89 |
90 |
91 |
92 | Motor Current Control
93 |
94 |
95 |
96 |
97 | 190
98 | 50
99 | 221
100 | 16
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 | 20
111 | 80
112 | 90
113 | 20
114 |
115 |
116 |
117 | IHOLDDELAY:
118 |
119 |
120 |
121 |
122 |
123 | 120
124 | 50
125 | 51
126 | 22
127 |
128 |
129 |
130 | 31
131 |
132 |
133 | 0
134 |
135 |
136 |
137 |
138 |
139 | 120
140 | 110
141 | 51
142 | 22
143 |
144 |
145 |
146 | 255
147 |
148 |
149 |
150 |
151 |
152 | 20
153 | 50
154 | 90
155 | 20
156 |
157 |
158 |
159 | IHOLD:
160 |
161 |
162 |
163 |
164 |
165 | 20
166 | 20
167 | 90
168 | 20
169 |
170 |
171 |
172 | IRUN:
173 |
174 |
175 |
176 |
177 |
178 | 20
179 | 110
180 | 90
181 | 20
182 |
183 |
184 |
185 | TPOWERDOWN:
186 |
187 |
188 |
189 |
190 |
191 | 120
192 | 80
193 | 51
194 | 22
195 |
196 |
197 |
198 | 15
199 |
200 |
201 |
202 |
203 |
204 | 120
205 | 20
206 | 51
207 | 22
208 |
209 |
210 |
211 | 31
212 |
213 |
214 | 0
215 |
216 |
217 |
218 |
219 |
220 | 190
221 | 20
222 | 201
223 | 16
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 | 190
234 | 110
235 | 211
236 | 16
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 | 190
247 | 80
248 | 201
249 | 16
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 | 20
261 | 170
262 | 431
263 | 391
264 |
265 |
266 |
267 | StealthChop / SpreadCycle Configuration
268 |
269 |
270 |
271 |
272 | 20
273 | 20
274 | 150
275 | 18
276 |
277 |
278 |
279 | EN_SPREADCYCLE
280 |
281 |
282 |
283 |
284 |
285 | 20
286 | 40
287 | 150
288 | 18
289 |
290 |
291 |
292 | PWM_AUTOSCALE
293 |
294 |
295 |
296 |
297 |
298 | 20
299 | 60
300 | 150
301 | 18
302 |
303 |
304 |
305 | PWM_AUTOGRAD
306 |
307 |
308 |
309 |
310 |
311 | 20
312 | 90
313 | 81
314 | 16
315 |
316 |
317 |
318 | PWM_FREQ
319 |
320 |
321 |
322 |
323 |
324 | 120
325 | 120
326 | 51
327 | 22
328 |
329 |
330 |
331 | 15
332 |
333 |
334 | 0
335 |
336 |
337 |
338 |
339 |
340 | 20
341 | 120
342 | 81
343 | 16
344 |
345 |
346 |
347 | TOFF
348 |
349 |
350 |
351 |
352 |
353 | 120
354 | 150
355 | 51
356 | 22
357 |
358 |
359 |
360 | 3
361 |
362 |
363 | 0
364 |
365 |
366 |
367 |
368 |
369 | 20
370 | 150
371 | 81
372 | 16
373 |
374 |
375 |
376 | TBL
377 |
378 |
379 |
380 |
381 |
382 | 20
383 | 180
384 | 81
385 | 16
386 |
387 |
388 |
389 | HSTRT
390 |
391 |
392 |
393 |
394 |
395 | 120
396 | 180
397 | 51
398 | 22
399 |
400 |
401 |
402 | 7
403 |
404 |
405 | 0
406 |
407 |
408 |
409 |
410 |
411 | 20
412 | 210
413 | 81
414 | 16
415 |
416 |
417 |
418 | HEND
419 |
420 |
421 |
422 |
423 |
424 | 120
425 | 210
426 | 51
427 | 22
428 |
429 |
430 |
431 | 15
432 |
433 |
434 | 0
435 |
436 |
437 |
438 |
439 |
440 | 20
441 | 240
442 | 81
443 | 16
444 |
445 |
446 |
447 | TPWMTHRS
448 |
449 |
450 |
451 |
452 |
453 | 20
454 | 270
455 | 81
456 | 16
457 |
458 |
459 |
460 | PWM_LIM
461 |
462 |
463 |
464 |
465 |
466 | 120
467 | 270
468 | 51
469 | 22
470 |
471 |
472 |
473 | 15
474 |
475 |
476 | 0
477 |
478 |
479 |
480 |
481 |
482 | 120
483 | 90
484 | 51
485 | 22
486 |
487 |
488 |
489 | 3
490 |
491 |
492 | 0
493 |
494 |
495 |
496 |
497 |
498 | 190
499 | 90
500 | 211
501 | 16
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 | 190
512 | 120
513 | 200
514 | 13
515 |
516 |
517 |
518 | 2...15 (default 3 in stealthChop)
519 |
520 |
521 |
522 |
523 |
524 | 190
525 | 150
526 | 200
527 | 13
528 |
529 |
530 |
531 | 0...3 (1-2 recommended)
532 |
533 |
534 |
535 |
536 |
537 | 190
538 | 180
539 | 200
540 | 13
541 |
542 |
543 |
544 | 1...7 (HEND+HSTRT <= 16)
545 |
546 |
547 |
548 |
549 |
550 | 190
551 | 210
552 | 200
553 | 13
554 |
555 |
556 |
557 | 1...7 (default 5 in stealthChop)
558 |
559 |
560 |
561 |
562 |
563 | 120
564 | 240
565 | 91
566 | 22
567 |
568 |
569 |
570 | 1048575
571 |
572 |
573 | 1
574 |
575 |
576 |
577 |
578 |
579 | 190
580 | 270
581 | 200
582 | 13
583 |
584 |
585 |
586 | 0...15 (default 12)
587 |
588 |
589 |
590 |
591 |
592 | 220
593 | 240
594 | 50
595 | 13
596 |
597 |
598 |
599 | 0...4000
600 |
601 |
602 |
603 |
604 |
605 | 20
606 | 300
607 | 81
608 | 16
609 |
610 |
611 |
612 | PWM_REG
613 |
614 |
615 |
616 |
617 |
618 | 20
619 | 330
620 | 81
621 | 16
622 |
623 |
624 |
625 | PWM_OFS
626 |
627 |
628 |
629 |
630 |
631 | 20
632 | 360
633 | 81
634 | 16
635 |
636 |
637 |
638 | PWM_GRAD
639 |
640 |
641 |
642 |
643 |
644 | 120
645 | 300
646 | 51
647 | 22
648 |
649 |
650 |
651 | 15
652 |
653 |
654 | 0
655 |
656 |
657 |
658 |
659 |
660 | 120
661 | 360
662 | 51
663 | 22
664 |
665 |
666 |
667 | 255
668 |
669 |
670 | 0
671 |
672 |
673 |
674 |
675 |
676 | 190
677 | 300
678 | 200
679 | 13
680 |
681 |
682 |
683 | 0...15 (default 8)
684 |
685 |
686 |
687 |
688 |
689 | 120
690 | 330
691 | 51
692 | 22
693 |
694 |
695 |
696 | 255
697 |
698 |
699 |
700 |
701 |
702 | 190
703 | 330
704 | 200
705 | 13
706 |
707 |
708 |
709 | 0...255 (default 36)
710 |
711 |
712 |
713 |
714 |
715 | 190
716 | 360
717 | 200
718 | 13
719 |
720 |
721 |
722 | 0...255 (default 14 in stealthChop)
723 |
724 |
725 |
726 |
727 |
728 | false
729 |
730 |
731 |
732 | 480
733 | 50
734 | 261
735 | 321
736 |
737 |
738 |
739 | DRV_STATUS
740 |
741 |
742 | false
743 |
744 |
745 | false
746 |
747 |
748 |
749 | false
750 |
751 |
752 |
753 | 20
754 | 20
755 | 200
756 | 18
757 |
758 |
759 |
760 | Standstill indicator
761 |
762 |
763 | false
764 |
765 |
766 |
767 |
768 | false
769 |
770 |
771 |
772 | 20
773 | 40
774 | 200
775 | 18
776 |
777 |
778 |
779 | StealthChop indicator
780 |
781 |
782 | false
783 |
784 |
785 |
786 |
787 | false
788 |
789 |
790 |
791 | 20
792 | 70
793 | 200
794 | 18
795 |
796 |
797 |
798 | 157°C comparator
799 |
800 |
801 | false
802 |
803 |
804 |
805 |
806 | false
807 |
808 |
809 |
810 | 20
811 | 90
812 | 200
813 | 18
814 |
815 |
816 |
817 | 150°C comparator
818 |
819 |
820 | false
821 |
822 |
823 |
824 |
825 | false
826 |
827 |
828 |
829 | 20
830 | 110
831 | 200
832 | 18
833 |
834 |
835 |
836 | 143°C comparator
837 |
838 |
839 | false
840 |
841 |
842 |
843 |
844 | false
845 |
846 |
847 |
848 | 20
849 | 130
850 | 200
851 | 18
852 |
853 |
854 |
855 | 120°C comparator
856 |
857 |
858 | false
859 |
860 |
861 |
862 |
863 | false
864 |
865 |
866 |
867 | 20
868 | 150
869 | 200
870 | 18
871 |
872 |
873 |
874 | Overtemperature
875 |
876 |
877 | false
878 |
879 |
880 |
881 |
882 | false
883 |
884 |
885 |
886 | 20
887 | 170
888 | 200
889 | 18
890 |
891 |
892 |
893 | Overtemperature pre-warning
894 |
895 |
896 | false
897 |
898 |
899 |
900 |
901 | false
902 |
903 |
904 |
905 | 20
906 | 200
907 | 200
908 | 18
909 |
910 |
911 |
912 | Open load indicator phase B
913 |
914 |
915 | false
916 |
917 |
918 |
919 |
920 | false
921 |
922 |
923 |
924 | 20
925 | 220
926 | 200
927 | 18
928 |
929 |
930 |
931 | Open load indicator phase A
932 |
933 |
934 | false
935 |
936 |
937 |
938 |
939 | false
940 |
941 |
942 |
943 | 20
944 | 240
945 | 200
946 | 18
947 |
948 |
949 |
950 | Low side short indicator phase B
951 |
952 |
953 | false
954 |
955 |
956 |
957 |
958 | false
959 |
960 |
961 |
962 | 20
963 | 260
964 | 200
965 | 18
966 |
967 |
968 |
969 | Low side short indicator phase A
970 |
971 |
972 | false
973 |
974 |
975 |
976 |
977 | false
978 |
979 |
980 |
981 | 20
982 | 280
983 | 200
984 | 18
985 |
986 |
987 |
988 | Short to ground indicator phase B
989 |
990 |
991 | false
992 |
993 |
994 |
995 |
996 | false
997 |
998 |
999 |
1000 | 20
1001 | 300
1002 | 200
1003 | 18
1004 |
1005 |
1006 |
1007 | Short to ground indicator phase A
1008 |
1009 |
1010 | false
1011 |
1012 |
1013 |
1014 |
1015 |
1016 |
1017 | 480
1018 | 20
1019 | 141
1020 | 18
1021 |
1022 |
1023 |
1024 | Enable status polling
1025 |
1026 |
1027 |
1028 |
1029 |
1030 | 480
1031 | 470
1032 | 261
1033 | 91
1034 |
1035 |
1036 |
1037 | TSTEP Recording
1038 |
1039 |
1040 |
1041 |
1042 | 50
1043 | 50
1044 | 75
1045 | 23
1046 |
1047 |
1048 |
1049 | Start
1050 |
1051 |
1052 |
1053 |
1054 |
1055 | 150
1056 | 50
1057 | 75
1058 | 23
1059 |
1060 |
1061 |
1062 | Show Graph
1063 |
1064 |
1065 |
1066 |
1067 |
1068 | 110
1069 | 20
1070 | 42
1071 | 22
1072 |
1073 |
1074 |
1075 | 1
1076 |
1077 |
1078 | 20
1079 |
1080 |
1081 |
1082 |
1083 |
1084 | 10
1085 | 20
1086 | 90
1087 | 16
1088 |
1089 |
1090 |
1091 | Recording Time:
1092 |
1093 |
1094 |
1095 |
1096 |
1097 | 160
1098 | 20
1099 | 50
1100 | 13
1101 |
1102 |
1103 |
1104 | s
1105 |
1106 |
1107 |
1108 |
1109 |
1110 | false
1111 |
1112 |
1113 |
1114 | 480
1115 | 390
1116 | 261
1117 | 61
1118 |
1119 |
1120 |
1121 | GSTAT
1122 |
1123 |
1124 |
1125 | false
1126 |
1127 |
1128 |
1129 | 20
1130 | 20
1131 | 200
1132 | 18
1133 |
1134 |
1135 |
1136 | Overtemperature or short circuit
1137 |
1138 |
1139 | false
1140 |
1141 |
1142 |
1143 |
1144 | false
1145 |
1146 |
1147 |
1148 | 20
1149 | 40
1150 | 200
1151 | 18
1152 |
1153 |
1154 |
1155 | Undervoltage charge pump
1156 |
1157 |
1158 | false
1159 |
1160 |
1161 |
1162 |
1163 |
1164 |
1165 | Register Settings
1166 |
1167 |
1168 |
-
1169 |
1170 |
-
1171 |
1172 |
1173 | 200
1174 |
1175 |
1176 |
1177 | Register
1178 |
1179 |
1180 |
1181 |
1182 | Value
1183 |
1184 |
1185 |
1186 |
1187 | Info
1188 |
1189 |
1190 |
1191 |
1192 | -
1193 |
1194 |
-
1195 |
1196 |
1197 | Read all Registers
1198 |
1199 |
1200 |
1201 | -
1202 |
1203 |
1204 | Qt::Vertical
1205 |
1206 |
1207 |
1208 | 20
1209 | 40
1210 |
1211 |
1212 |
1213 |
1214 |
1215 |
1216 |
1217 |
1218 |
1219 |
1220 |
1221 |
1222 | OTP Programmer
1223 |
1224 |
1225 |
1226 |
1227 | 30
1228 | 20
1229 | 691
1230 | 61
1231 |
1232 |
1233 |
1234 | <html><head></head><body><p align="center"><span style=" font-size:18pt; font-weight:600; color:#ff0000;">WARNING!</span></p><p><span style=" font-size:9pt;">Write OTP memory (one bit at a time). Please refer to the TMC2208 datasheet.</span></p></body></html>
1235 |
1236 |
1237 |
1238 |
1239 |
1240 | 30
1241 | 90
1242 | 691
1243 | 171
1244 |
1245 |
1246 |
1247 | OTP Writer
1248 |
1249 |
1250 |
1251 |
1252 | 50
1253 | 130
1254 | 161
1255 | 23
1256 |
1257 |
1258 |
1259 | Write 1-bit to OTP memory
1260 |
1261 |
1262 |
1263 |
1264 |
1265 | 30
1266 | 30
1267 | 50
1268 | 13
1269 |
1270 |
1271 |
1272 | OTP BYTE:
1273 |
1274 |
1275 |
1276 |
1277 |
1278 | 90
1279 | 60
1280 | 42
1281 | 22
1282 |
1283 |
1284 |
1285 | 7
1286 |
1287 |
1288 |
1289 |
1290 |
1291 | 90
1292 | 30
1293 | 42
1294 | 22
1295 |
1296 |
1297 |
1298 | 2
1299 |
1300 |
1301 |
1302 |
1303 |
1304 | 30
1305 | 60
1306 | 50
1307 | 13
1308 |
1309 |
1310 |
1311 | OTP BIT:
1312 |
1313 |
1314 |
1315 |
1316 |
1317 | 150
1318 | 60
1319 | 50
1320 | 13
1321 |
1322 |
1323 |
1324 | 0..7
1325 |
1326 |
1327 |
1328 |
1329 |
1330 | 150
1331 | 30
1332 | 50
1333 | 13
1334 |
1335 |
1336 |
1337 | 0..2
1338 |
1339 |
1340 |
1341 |
1342 |
1343 | 90
1344 | 100
1345 | 91
1346 | 16
1347 |
1348 |
1349 |
1350 | Name: otp0.0
1351 |
1352 |
1353 |
1354 |
1355 |
1356 | 250
1357 | 30
1358 | 430
1359 | 100
1360 |
1361 |
1362 |
1363 | <html><head/><body><p><span style=" font-size:9pt; font-weight:600;">otp2.7=1</span><span style=" font-size:9pt;"> enables spreadCycle mode<br/><br/></span><span style=" font-size:9pt; font-weight:600;">otp1.0...otp1.3</span><span style=" font-size:9pt;"> sets TOFF in spreadCycle (default 0, driver disabled)<br/></span><span style=" font-size:9pt; font-weight:600;">otp1.1=1</span><span style=" font-size:9pt;"> sets TOFF=2<br/></span><span style=" font-size:9pt; font-weight:600;">otp1.0=1 + otp1.1=1</span><span style=" font-size:9pt;"> sets TOFF=3<br/></span></p></body></html>
1364 |
1365 |
1366 |
1367 |
1368 |
1369 |
1370 | -
1371 |
1372 |
1373 | Qt::Horizontal
1374 |
1375 |
1376 |
1377 |
1378 |
1379 |
1380 | spinBox_I_RUN
1381 | spinBox_I_HOLD
1382 | spinBox_I_HOLD_DELAY
1383 | spinBox_T_POWER_DOWN
1384 | EN_SPREADCYCLE_checkBox
1385 | PWM_AUTOSCALE_checkBox
1386 | PWM_AUTOGRAD_checkBox
1387 | PWM_FREQ_spinBox
1388 | TOFF_spinBox
1389 | TBL_spinBox
1390 | HSTRT_spinBox
1391 | HEND_spinBox
1392 | PWM_LIM_spinBox
1393 | GeneralTreeWidget
1394 | ReadAllButton
1395 |
1396 |
1397 |
1398 |
1399 |
--------------------------------------------------------------------------------
/ScriptCommunicator/scripts/TMC2208_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ScriptCommunicator/scripts/TMC2208_scripts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ScriptCommunicator/scripts/TMC220X.js:
--------------------------------------------------------------------------------
1 | /* jshint undef: false, unused: true */
2 |
3 | // ****************** Start COM-Port ********************************
4 |
5 | var serialPort = scriptThread.createSerialPort();
6 | var baudrate = 115200; //115200 57600 9600
7 | var anticollisionTime = 3 * 80 * 1000 / baudrate;
8 | var receivedData = [];
9 | var packetsSend = 0,
10 | packetsReceived = 0;
11 |
12 | var chip = {
13 | TMC2208: "TMC2208",
14 | TMC2209: "TMC2209"
15 | };
16 |
17 | var currChip = chip.TMC2208;
18 |
19 | var settings = scriptThread.getMainInterfaceSerialPortSettings();
20 | UI_COMPORT_comboBox.addItem(settings.name);
21 |
22 | for (var i = 1; i < 50; i++) {
23 | UI_COMPORT_comboBox.addItem("COM" + i);
24 | }
25 |
26 | function chipChanged() {
27 | currChip = UI_Chip_comboBox.currentText();
28 | initTreeWidget(AllRegisters, UI_GeneralTreeWidget);
29 | UI_StallGuard_groupBox.setEnabled(currChip === chip.TMC2209);
30 | }
31 |
32 | function connectButtonClicked() {
33 | if (UI_Connect_pushButton.text() === "Connect") {
34 | //var x = UI_COMPORT_comboBox.currentText();
35 |
36 | serialPort.setPortName(UI_COMPORT_comboBox.currentText());
37 | if (serialPort.open()) {
38 | serialPort.setBaudRate(baudrate);
39 | serialPort.setDataBits(8);
40 | serialPort.setParity("None");
41 | serialPort.setStopBits("1");
42 | serialPort.setFlowControl("None");
43 | serialPort.setDTR(true);
44 | serialPort.setRTS(true);
45 |
46 | UI_Connect_pushButton.setText("Disconnect");
47 |
48 | UI_Chip_comboBox.setEnabled(false);
49 |
50 | packetsSend = 0;
51 | packetsReceived = 0;
52 | if (initAfterConnection()) {
53 | UI_tabWidget.setEnabled(true);
54 | return; // connection successful
55 | }
56 | } else {
57 | scriptThread.messageBox("Critical", "Error", "Could not open serial port.");
58 | }
59 | }
60 |
61 | // disconnect or error on connection
62 | UI_DRV_STATUS_polling_checkBox.setChecked(false);
63 | DRV_STATUS_Timer.stop();
64 | TSTEP_Timer.stop();
65 | serialPort.close();
66 | UI_Connect_pushButton.setText("Connect");
67 | UI_tabWidget.setEnabled(false);
68 | UI_Chip_comboBox.setEnabled(true);
69 | }
70 |
71 | function showSendReceivedPackets() {
72 | UI_RW_label.setText("Requests send: " + packetsSend + " received: " + packetsReceived);
73 | }
74 |
75 | function waitReceived() {
76 | var timeout = 400;
77 |
78 | while (packetsSend !== packetsReceived) {
79 | scriptThread.sleepFromScript(10);
80 | timeout -= 1;
81 | if (timeout <= 0) {
82 | scriptThread.messageBox("Critical", "Error", "Sending failed. Check hardware connection and serial port.");
83 | return false;
84 | }
85 | }
86 |
87 | return true;
88 | }
89 |
90 | // ****************** End COM-Port ********************************
91 |
92 | //The dialog is closed.
93 | function dialogFinished(e) {
94 | if (UI_Connect_pushButton.text() == "Disconnect") {
95 | DRV_STATUS_Timer.stop();
96 | TSTEP_Timer.stop();
97 | serialPort.close();
98 | }
99 | scriptThread.stopScript();
100 | }
101 |
102 | function calcCRC(datagram, datagramLength) {
103 | var crc = 0;
104 | for (var i = 0; i < datagramLength; i++) {
105 | var currentByte = datagram[i];
106 | for (var j = 0; j < 8; j++) {
107 | if ((crc >> 7) ^ (currentByte & 0x01)) {
108 | crc = (crc << 1) ^ 0x07;
109 | } else {
110 | crc = (crc << 1);
111 | }
112 | crc &= 0xff;
113 | currentByte = currentByte >> 1;
114 | }
115 | }
116 | return crc; //& 0xff;
117 | }
118 |
119 | function getSubBits(value32, start, len) {
120 | var mask = 0;
121 |
122 | for (var i = 0; i < len; i++) {
123 | mask <<= 1;
124 | mask |= 0x01;
125 | }
126 |
127 | return (value32 >> start) & mask;
128 | }
129 |
130 | function decimalToHex(d, padding) {
131 | var hex = (Number(d) >>> 0).toString(16); // >>> 0 makes an unsigned integer
132 | padding = typeof (padding) === "undefined" || padding === null ? padding = 2 : padding;
133 |
134 | while (hex.length < padding) {
135 | hex = "0" + hex;
136 | }
137 |
138 | return "0x" + hex;
139 | }
140 |
141 | function showRegister(register) {
142 | var value32 = register.value;
143 |
144 | var oldText = register.treeItem.text(1);
145 | var newText = decimalToHex(value32, 8);
146 | register.treeItem.setText(1, newText);
147 | if (oldText == newText)
148 | register.treeItem.setForegroundColor(1, "black");
149 | else
150 | register.treeItem.setForegroundColor(1, "red");
151 |
152 | for (var n = 0; n < register.bitName.length; n++) {
153 | var value = getSubBits(value32, register.bitName[n].bit, register.bitName[n].len);
154 | register.bitName[n].value = value;
155 |
156 | oldText = register.bitName[n].treeItem.text(1);
157 | var digits = 1 + ((register.bitName[n].len - 1) >> 2); // number of hex digits to display
158 | newText = " " + decimalToHex(value, digits);
159 | register.bitName[n].treeItem.setText(1, newText);
160 | if (oldText == newText)
161 | register.bitName[n].treeItem.setForegroundColor(1, "black");
162 | else
163 | register.bitName[n].treeItem.setForegroundColor(1, "red");
164 |
165 | // optional callbacks to other check- or spin boxes
166 | if (register.bitName[n].checkBoxColor) {
167 | if (value)
168 | register.bitName[n].checkBoxColor.setBackgroundColor("red");
169 | else
170 | register.bitName[n].checkBoxColor.setBackgroundColor("white");
171 | }
172 |
173 | if (register.bitName[n].checkBox) {
174 | register.bitName[n].checkBox.blockSignals(true); // block clickedSignal signal to avoid recursion
175 | register.bitName[n].checkBox.setChecked(value);
176 | register.bitName[n].checkBox.blockSignals(false); // unblock clickedSignal signal
177 | }
178 |
179 | if (register.bitName[n].spinBox) {
180 | register.bitName[n].spinBox.blockSignals(true); // block valueChangedSignal signal to avoid recursion
181 | register.bitName[n].spinBox.setValue(value);
182 | register.bitName[n].spinBox.blockSignals(false); // unblock valueChangedSignal signal
183 | }
184 |
185 | if (register.bitName[n].callback)
186 | register.bitName[n].callback(value);
187 | }
188 | }
189 |
190 | function updateTreeWidget(datagram) {
191 | var regAddr = datagram[2];
192 | var value32 = (datagram[3] << 24) | (datagram[4] << 16) | (datagram[5] << 8) | datagram[6];
193 |
194 | for (var i = 0; i < AllRegisters.length; i++) {
195 | if (AllRegisters[i].addr == regAddr) {
196 | AllRegisters[i].value = value32;
197 | showRegister(AllRegisters[i]);
198 | break;
199 | }
200 | }
201 | }
202 |
203 | function dataReceivedSlot() {
204 | var i;
205 | var data = serialPort.readAll();
206 | for (i = 0; i < data.length; i++) {
207 | receivedData.push(data[i]);
208 | }
209 |
210 | while (receivedData.length >= 4) {
211 | if ((receivedData[0] & 0x0f) == 0x05) {
212 | if (receivedData[1] <= 3) // echo datagram, slaveAddr 0-3
213 | {
214 | if (receivedData[2] & 0x80) // write request
215 | {
216 | if (receivedData.length >= 8) {
217 | for (i = 0; i < 8; i++) // remove echo datagram
218 | receivedData.shift();
219 | packetsReceived++;
220 | showSendReceivedPackets();
221 | } else
222 | return; // skip decoding, not enougth data received
223 | } else // read request
224 | {
225 | for (i = 0; i < 4; i++) // remove echo datagram
226 | receivedData.shift();
227 | }
228 | } else // answer from TMC2208 to decode
229 | {
230 | if (receivedData.length >= 8) {
231 | var datagram = receivedData.slice(0, 8);
232 | for (i = 0; i < 8; i++)
233 | receivedData.shift();
234 |
235 | // check reply
236 | if (datagram[1] == 0xff && datagram[7] == calcCRC(datagram, 7)) {
237 | updateTreeWidget(datagram);
238 | packetsReceived++;
239 | showSendReceivedPackets();
240 | } else
241 | scriptThread.messageBox("Critical", "Error", "Wrong CRC");
242 | } else
243 | return; // skip decoding, not enougth data received
244 | }
245 | } else {
246 | // somthing wrong received, remove 1 byte
247 | receivedData.shift();
248 | }
249 | }
250 | }
251 |
252 | function readRegister(addr) {
253 | var datagram = [0x05, 0x00, addr, 0x00]; //sync, slaveAddr, regAddr, crc
254 |
255 | datagram[3] = calcCRC(datagram, 3);
256 |
257 | var bytesSend = serialPort.write(datagram);
258 | scriptThread.sleepFromScript(anticollisionTime);
259 |
260 | if (bytesSend != datagram.length) {
261 | scriptThread.messageBox("Critical", "Error", "Sending failed. Check hardware connection and serial port.");
262 | return false;
263 | }
264 | packetsSend++;
265 | showSendReceivedPackets();
266 | return true;
267 | }
268 |
269 | function writeRegister(addr, value32) {
270 | var datagram = [0x05, 0x00, (0x80 | addr), 0x00, 0x00, 0x00, 0x00, 0x00]; //sync, slaveAddr, write+regAddr, 4byte data, crc
271 |
272 | datagram[3] = (value32 >>> 24) & 0xff;
273 | datagram[4] = (value32 >>> 16) & 0xff;
274 | datagram[5] = (value32 >>> 8) & 0xff;
275 | datagram[6] = (value32 >>> 0) & 0xff;
276 | datagram[7] = calcCRC(datagram, 7);
277 |
278 | var bytesSend = serialPort.write(datagram);
279 | scriptThread.sleepFromScript(anticollisionTime);
280 |
281 | if (bytesSend != datagram.length) {
282 | scriptThread.messageBox("Critical", "Error", "Sending failed. Check hardware connection and serial port.");
283 | return false;
284 | }
285 | packetsSend++;
286 | showSendReceivedPackets();
287 | return true;
288 | }
289 |
290 |
291 | function readAllRegisters() {
292 | for (var i = 0; i < AllRegisters.length; i++) {
293 | if (AllRegisters[i].rw_info != "Write only" && (AllRegisters[i].chips && AllRegisters[i].chips.indexOf(currChip) >= 0))
294 | if (!readRegister(AllRegisters[i].addr))
295 | break;
296 | }
297 | }
298 |
299 | function updateRegister(addr, bit, len, value) {
300 | for (var i = 0; i < AllRegisters.length; i++) {
301 | if (AllRegisters[i].addr == addr) {
302 | var newValue = AllRegisters[i].value;
303 |
304 | var mask = (1 << bit);
305 | for (var b = 0; b < len; b++) {
306 | newValue &= ~mask; // clear the bit
307 | if (value & (1 << b))
308 | newValue |= mask; // set the bit
309 | mask <<= 1;
310 | }
311 |
312 | AllRegisters[i].value = newValue;
313 | showRegister(AllRegisters[i]);
314 | writeRegister(addr, newValue);
315 | break;
316 | }
317 | }
318 | }
319 |
320 | function treeWidgetItemClicked(item, column) {
321 | if (column == 1) {
322 | var i = item.text(column).trim();
323 | var addr = item.data(1, 0);
324 | var bit = item.data(1, 1);
325 | var len = item.data(1, 2);
326 |
327 | if (i !== "") {
328 | var digits = 1 + ((len - 1) >> 2); // number of hex digits to display
329 | var range;
330 | if (len < 32)
331 | range = decimalToHex((1 << len) - 1, digits);
332 | else
333 | range = "0xffffffff";
334 |
335 | var input = scriptThread.showTextInputDialog("Change Register", "Value range: 0x0..." + range + "", i);
336 | if (input !== "") {
337 | var value = parseInt(input);
338 | if (value != Number.NaN) {
339 | updateRegister(addr, bit, len, value);
340 | }
341 | }
342 | }
343 | }
344 | }
345 |
346 | function getRegisterByName(regName) {
347 | regName = regName.toUpperCase();
348 |
349 | for (var i = 0; i < AllRegisters.length; i++) {
350 | if (AllRegisters[i].name.toUpperCase() == regName) {
351 | return getSubBits(AllRegisters[i].value, 0, 32);
352 | } else {
353 | for (var n = 0; n < AllRegisters[i].bitName.length; n++) {
354 | if (AllRegisters[i].bitName[n].name.toUpperCase() == regName) {
355 | return AllRegisters[i].bitName[n].value; //getSubBits(AllRegisters[i].bitName[n].value, AllRegisters[i].bitName[n].bit, AllRegisters[i].bitName[n].len);
356 | }
357 | }
358 | }
359 | }
360 | }
361 |
362 | function setRegisterByName(regName, value) {
363 | regName = regName.toUpperCase();
364 |
365 | for (var i = 0; i < AllRegisters.length; i++) {
366 | if (AllRegisters[i].name.toUpperCase() == regName) {
367 | updateRegister(AllRegisters[i].addr, 0, 32, value);
368 | return true;
369 | } else {
370 | for (var n = 0; n < AllRegisters[i].bitName.length; n++) {
371 | if (AllRegisters[i].bitName[n].name.toUpperCase() == regName) {
372 | updateRegister(AllRegisters[i].addr, AllRegisters[i].bitName[n].bit, AllRegisters[i].bitName[n].len, value);
373 | return true;
374 | }
375 | }
376 | }
377 | }
378 | return false;
379 | }
380 |
381 | function clearTreeWidget(treeWidget) {
382 | var n = treeWidget.topLevelItemCount();
383 | for (var i = 0; i < n; i++) {
384 | treeWidget.takeTopLevelItem(0);
385 | }
386 | }
387 |
388 | function initTreeWidget(Registers, treeWidget) {
389 | clearTreeWidget(treeWidget);
390 | for (var i = 0; i < Registers.length; i++) {
391 |
392 | if (Registers[i].chips && Registers[i].chips.indexOf(currChip) >= 0) {
393 | var treeItem1 = treeWidget.createScriptTreeWidgetItem();
394 | Registers[i].treeItem = treeItem1;
395 | treeItem1.setText(0, Registers[i].name.toUpperCase() + " (" + decimalToHex(Registers[i].addr, 2) + ")");
396 | treeItem1.setText(1, "");
397 | treeItem1.setText(2, Registers[i].rw_info);
398 | treeItem1.setData(1, 0, Registers[i].addr.toString());
399 | treeItem1.setData(1, 1, 0); // bit
400 | treeItem1.setData(1, 2, 32); // len
401 |
402 | for (var n = 0; n < Registers[i].bitName.length; n++) {
403 | var treeItem2 = treeWidget.createScriptTreeWidgetItem();
404 | treeItem2.setText(0, Registers[i].bitName[n].name.toUpperCase());
405 | treeItem2.setData(1, 0, Registers[i].addr.toString());
406 | treeItem2.setData(1, 1, Registers[i].bitName[n].bit.toString()); // bit
407 | treeItem2.setData(1, 2, Registers[i].bitName[n].len.toString()); // len
408 | Registers[i].bitName[n].treeItem = treeItem2;
409 | treeItem1.addChild(treeItem2);
410 | }
411 |
412 | treeWidget.addTopLevelItem(treeItem1);
413 | //treeWidget.expandItem(treeItem1);
414 | }
415 | }
416 | //UI_treeWidget.setColumnWidth(0, 200);
417 | treeWidget.itemClickedSignal.connect(treeWidgetItemClicked);
418 | }
419 |
420 | var OptRead = {
421 | otp_en_spreadCycle: 0,
422 | IHOLD: 0,
423 | IHOLDDELAY: 0,
424 | TPWMTHRS: 0,
425 | };
426 |
427 | // calculates the reset values from OTP_READ register
428 | function OTP_READ_Decoder() {
429 | OptRead.otp_en_spreadCycle = getRegisterByName("OTP_EN_SPREADCYCLE");
430 |
431 | var IHOLD_const = [16, 2, 8, 24];
432 | OptRead.IHOLD = IHOLD_const[getRegisterByName("OTP_IHOLD")];
433 | OptRead.IHOLDDELAY = 1 << getRegisterByName("OPT_IHOLDDELAY");
434 | if (OptRead.otp_en_spreadCycle === 0) {
435 | var TPWMTHRS_const = [0, 200, 300, 400, 500, 800, 1200, 4000];
436 | OptRead.TPWMTHRS = TPWMTHRS_const[getRegisterByName("OTP_TPWMTHRS")];
437 | }
438 | }
439 |
440 |
441 | var AllRegisters = [
442 | //********************* GeneralRegisters ******************
443 | {
444 | name: "GCONF",
445 | addr: 0x00,
446 | bitName: [
447 | {
448 | name: "I_SCALE_ANALOG",
449 | bit: 0,
450 | len: 1
451 | },
452 | {
453 | name: "INTERNAL_RSENSE",
454 | bit: 1,
455 | len: 1
456 | },
457 | {
458 | name: "EN_SPREADCYCLE",
459 | bit: 2,
460 | len: 1,
461 | checkBox: UI_EN_SPREADCYCLE_checkBox
462 | },
463 | {
464 | name: "SHAFT",
465 | bit: 3,
466 | len: 1
467 | },
468 | {
469 | name: "INDEX_OTPW",
470 | bit: 4,
471 | len: 1
472 | },
473 | {
474 | name: "INDEX_STEP",
475 | bit: 5,
476 | len: 1
477 | },
478 | {
479 | name: "PDN_DISABLE",
480 | bit: 6,
481 | len: 1
482 | },
483 | {
484 | name: "MSTEP_REG_SELECT",
485 | bit: 7,
486 | len: 1
487 | },
488 | {
489 | name: "MULTISTEP_FILT",
490 | bit: 8,
491 | len: 1
492 | },
493 | {
494 | name: "TEST_MODE",
495 | bit: 9,
496 | len: 1
497 | },
498 | ],
499 | rw_info: "R/W",
500 | chips: [chip.TMC2208, chip.TMC2209]
501 | },
502 | {
503 | name: "GSTAT",
504 | addr: 0x01,
505 | bitName: [
506 | {
507 | name: "RESET",
508 | bit: 0,
509 | len: 1
510 | },
511 | {
512 | name: "DRV_ERR",
513 | bit: 1,
514 | len: 1,
515 | checkBoxColor: UI_checkBox_15
516 | },
517 | {
518 | name: "UV_CP",
519 | bit: 2,
520 | len: 1,
521 | checkBoxColor: UI_checkBox_16
522 | },
523 | ],
524 | rw_info: "R/W Clear",
525 | chips: [chip.TMC2208, chip.TMC2209]
526 | },
527 | {
528 | name: "IFCNT",
529 | addr: 0x02,
530 | bitName: [
531 | {
532 | name: "IFCNT",
533 | bit: 0,
534 | len: 8
535 | },
536 | ],
537 | rw_info: "Read only",
538 | chips: [chip.TMC2208, chip.TMC2209]
539 | },
540 | {
541 | name: "SLAVECONF",
542 | addr: 0x03,
543 | bitName: [
544 | {
545 | name: "SENDDELAY",
546 | bit: 8,
547 | len: 4
548 | },
549 | ],
550 | rw_info: "Write only",
551 | chips: [chip.TMC2208, chip.TMC2209]
552 | },
553 | {
554 | name: "OTP_PROG",
555 | addr: 0x04,
556 | bitName: [
557 | {
558 | name: "OTPBIT",
559 | bit: 0,
560 | len: 3
561 | },
562 | {
563 | name: "OTPBYTE",
564 | bit: 4,
565 | len: 2
566 | },
567 | {
568 | name: "OTPMAGIC",
569 | bit: 8,
570 | len: 8
571 | },
572 | ],
573 | rw_info: "Write only",
574 | chips: [chip.TMC2208, chip.TMC2209]
575 | },
576 | {
577 | name: "OTP_READ",
578 | addr: 0x05,
579 | bitName: [
580 | {
581 | name: "OTP_EN_SPREADCYCLE",
582 | bit: 23,
583 | len: 1
584 | },
585 | {
586 | name: "OTP_IHOLD",
587 | bit: 21,
588 | len: 2
589 | },
590 | {
591 | name: "OTP_IHOLDDELAY",
592 | bit: 19,
593 | len: 2
594 | },
595 | {
596 | name: "OTP_PWM_FREQ",
597 | bit: 18,
598 | len: 1
599 | },
600 | {
601 | name: "OTP_PWM_REG",
602 | bit: 17,
603 | len: 1
604 | },
605 | {
606 | name: "OTP_PWM_OFS",
607 | bit: 16,
608 | len: 1
609 | },
610 | {
611 | name: "OTP_TPWMTHRS",
612 | bit: 13,
613 | len: 3
614 | },
615 | {
616 | name: "OTP_PWM_AUTOGRAD",
617 | bit: 12,
618 | len: 1
619 | },
620 | {
621 | name: "OTP_PWM_GRAD",
622 | bit: 8,
623 | len: 4
624 | },
625 | {
626 | name: "OTP_TBL",
627 | bit: 7,
628 | len: 1
629 | },
630 | {
631 | name: "OTP_INTERNALRSENSE",
632 | bit: 6,
633 | len: 1
634 | },
635 | {
636 | name: "otp_OTTRIM",
637 | bit: 5,
638 | len: 1
639 | },
640 | {
641 | name: "OTP_FCLKTRIM",
642 | bit: 0,
643 | len: 5
644 | },
645 | ],
646 | rw_info: "Read only",
647 | chips: [chip.TMC2208, chip.TMC2209]
648 | },
649 | {
650 | name: "IOIN",
651 | addr: 0x06,
652 | bitName: [
653 | {
654 | name: "ENN",
655 | bit: 0,
656 | len: 1
657 | },
658 | // { name: "-", bit: 1, len: 1},
659 | {
660 | name: "MS1",
661 | bit: 2,
662 | len: 1
663 | },
664 | {
665 | name: "MS2",
666 | bit: 3,
667 | len: 1
668 | },
669 | {
670 | name: "DIAG",
671 | bit: 4,
672 | len: 1
673 | },
674 | // { name: "-", bit: 5, len: 1},
675 | {
676 | name: "PDN_UART",
677 | bit: 6,
678 | len: 1
679 | },
680 | {
681 | name: "STEP",
682 | bit: 7,
683 | len: 1
684 | },
685 | {
686 | name: "SEL_A",
687 | bit: 8,
688 | len: 1
689 | },
690 | {
691 | name: "DIR",
692 | bit: 9,
693 | len: 1
694 | },
695 | {
696 | name: "VERSION",
697 | bit: 24,
698 | len: 8
699 | },
700 | ],
701 | rw_info: "Read only",
702 | chips: [chip.TMC2208, chip.TMC2209]
703 | },
704 | {
705 | name: "FACTORY_CONF",
706 | addr: 0x07,
707 | bitName: [
708 | {
709 | name: "FCLKTRIM",
710 | bit: 0,
711 | len: 5
712 | },
713 | {
714 | name: "OTTRIM",
715 | bit: 8,
716 | len: 2
717 | },
718 | ],
719 | rw_info: "R/W",
720 | chips: [chip.TMC2208, chip.TMC2209]
721 | },
722 |
723 | // *************** VelocityRegisters *****************
724 | {
725 | name: "IHOLD_IRUN",
726 | addr: 0x10,
727 | bitName: [
728 | {
729 | name: "IHOLD",
730 | bit: 0,
731 | len: 5,
732 | spinBox: UI_spinBox_I_HOLD,
733 | callback: UI_I_HOLD_callback
734 | },
735 | {
736 | name: "IRUN",
737 | bit: 8,
738 | len: 5,
739 | spinBox: UI_spinBox_I_RUN,
740 | callback: UI_I_RUN_callback
741 | },
742 | {
743 | name: "IHOLDDELAY",
744 | bit: 16,
745 | len: 4,
746 | spinBox: UI_spinBox_I_HOLD_DELAY,
747 | callback: UI_I_HOLD_DELAY_callback
748 | },
749 | ],
750 | rw_info: "Write only",
751 | chips: [chip.TMC2208, chip.TMC2209]
752 | },
753 | {
754 | name: "TPOWERDOWN",
755 | addr: 0x11,
756 | bitName: [
757 | {
758 | name: "TPOWERDOWN",
759 | bit: 0,
760 | len: 8,
761 | spinBox: UI_spinBox_T_POWER_DOWN,
762 | callback: UI_TPOWERDOWN_callback
763 | },
764 | ],
765 | rw_info: "Write only",
766 | chips: [chip.TMC2208, chip.TMC2209]
767 | },
768 | {
769 | name: "TSTEP",
770 | addr: 0x12,
771 | bitName: [
772 | {
773 | name: "TSTEP",
774 | bit: 0,
775 | len: 20,
776 | callback: setTSTEP_PollValue
777 | },
778 | ],
779 | rw_info: "Read only",
780 | chips: [chip.TMC2208, chip.TMC2209]
781 | },
782 | {
783 | name: "TPWMTHRS",
784 | addr: 0x13,
785 | bitName: [
786 | {
787 | name: "TPWMTHRS",
788 | bit: 0,
789 | len: 20,
790 | spinBox: UI_TPWMTHRS_spinBox
791 | },
792 | ],
793 | rw_info: "Write only",
794 | chips: [chip.TMC2208, chip.TMC2209]
795 | },
796 | {
797 | name: "VACTUAL",
798 | addr: 0x22,
799 | bitName: [
800 | {
801 | name: "VACTUAL",
802 | bit: 0,
803 | len: 24
804 | },
805 | ],
806 | rw_info: "Write only",
807 | chips: [chip.TMC2208, chip.TMC2209]
808 | },
809 |
810 | // **************** StallGuard Control **************
811 | {
812 | name: "TCOOLTHRS",
813 | addr: 0x14,
814 | bitName: [
815 | {
816 | name: "TCOOLTHRS",
817 | bit: 0,
818 | len: 20
819 | },
820 | ],
821 | rw_info: "Write only",
822 | chips: [chip.TMC2209]
823 | },
824 | {
825 | name: "SGTHRS",
826 | addr: 0x40,
827 | bitName: [
828 | {
829 | name: "SGTHRS",
830 | bit: 0,
831 | len: 8
832 | },
833 | ],
834 | rw_info: "Write only",
835 | chips: [chip.TMC2209]
836 | },
837 | {
838 | name: "SG_RESULT",
839 | addr: 0x41,
840 | bitName: [
841 | {
842 | name: "SG_RESULT",
843 | bit: 0,
844 | len: 10
845 | },
846 | ],
847 | rw_info: "Read only",
848 | chips: [chip.TMC2209]
849 | },
850 | {
851 | name: "COOLCONF",
852 | addr: 0x42,
853 | bitName: [
854 | {
855 | name: "SEMIN",
856 | bit: 0,
857 | len: 4
858 | },
859 | {
860 | name: "SEUP",
861 | bit: 5,
862 | len: 2
863 | },
864 | {
865 | name: "SEMAX",
866 | bit: 8,
867 | len: 4
868 | },
869 | {
870 | name: "SEDN",
871 | bit: 13,
872 | len: 2
873 | },
874 | {
875 | name: "SEIMIN",
876 | bit: 15,
877 | len: 1
878 | },
879 | ],
880 | rw_info: "Write only",
881 | chips: [chip.TMC2209]
882 | },
883 |
884 | // **************** SequencerRegisters **************
885 | {
886 | name: "MSCNT",
887 | addr: 0x6A,
888 | bitName: [
889 | {
890 | name: "MSCNT",
891 | bit: 0,
892 | len: 10
893 | },
894 | ],
895 | rw_info: "Read only",
896 | chips: [chip.TMC2208, chip.TMC2209]
897 | },
898 | {
899 | name: "MSCURACT",
900 | addr: 0x6B,
901 | bitName: [
902 | {
903 | name: "CUR_A",
904 | bit: 0,
905 | len: 9
906 | },
907 | {
908 | name: "CUR_B",
909 | bit: 16,
910 | len: 9
911 | },
912 | ],
913 | rw_info: "Read only",
914 | chips: [chip.TMC2208, chip.TMC2209]
915 | },
916 |
917 | //******************* ChopperRegisters *****************
918 | {
919 | name: "CHOPCONF",
920 | addr: 0x6C,
921 | bitName: [
922 | {
923 | name: "DISS2VS",
924 | bit: 31,
925 | len: 1
926 | },
927 | {
928 | name: "DISS2G",
929 | bit: 30,
930 | len: 1
931 | },
932 | {
933 | name: "DEDGE",
934 | bit: 29,
935 | len: 1
936 | },
937 | {
938 | name: "INTPOL",
939 | bit: 28,
940 | len: 1
941 | },
942 | {
943 | name: "MRES",
944 | bit: 24,
945 | len: 4
946 | },
947 | // { name: "-", bit: 18, len: 6},
948 | {
949 | name: "VSENSE",
950 | bit: 17,
951 | len: 1
952 | },
953 | {
954 | name: "TBL",
955 | bit: 15,
956 | len: 2,
957 | spinBox: UI_TBL_spinBox
958 | },
959 | // { name: "-", bit: 11, len: 4},
960 | {
961 | name: "HEND",
962 | bit: 7,
963 | len: 4,
964 | spinBox: UI_HEND_spinBox
965 | },
966 | {
967 | name: "HSTRT",
968 | bit: 4,
969 | len: 3,
970 | spinBox: UI_HSTRT_spinBox
971 | },
972 | {
973 | name: "TOFF",
974 | bit: 0,
975 | len: 4,
976 | spinBox: UI_TOFF_spinBox
977 | },
978 | ],
979 | rw_info: "R/W",
980 | chips: [chip.TMC2208, chip.TMC2209]
981 | },
982 | {
983 | name: "DRV_STATUS",
984 | addr: 0x6F,
985 | bitName: [
986 | {
987 | name: "STST",
988 | bit: 31,
989 | len: 1,
990 | checkBoxColor: UI_checkBox_1
991 | },
992 | {
993 | name: "STEALTH",
994 | bit: 30,
995 | len: 1,
996 | checkBoxColor: UI_checkBox_2
997 | },
998 | // { name: "-", bit: 24, len: 6},
999 | // { name: "-", bit: 21, len: 3},
1000 | {
1001 | name: "CS_ACTUAL",
1002 | bit: 16,
1003 | len: 5
1004 | },
1005 | // { name: "-", bit: 12, len: 4},
1006 | {
1007 | name: "T157",
1008 | bit: 11,
1009 | len: 1,
1010 | checkBoxColor: UI_checkBox_3
1011 | },
1012 | {
1013 | name: "T150",
1014 | bit: 10,
1015 | len: 1,
1016 | checkBoxColor: UI_checkBox_4
1017 | },
1018 | {
1019 | name: "T143",
1020 | bit: 9,
1021 | len: 1,
1022 | checkBoxColor: UI_checkBox_5
1023 | },
1024 | {
1025 | name: "T120",
1026 | bit: 8,
1027 | len: 1,
1028 | checkBoxColor: UI_checkBox_6
1029 | },
1030 | {
1031 | name: "OLB",
1032 | bit: 7,
1033 | len: 1,
1034 | checkBoxColor: UI_checkBox_9
1035 | },
1036 | {
1037 | name: "OLA",
1038 | bit: 6,
1039 | len: 1,
1040 | checkBoxColor: UI_checkBox_10
1041 | },
1042 | {
1043 | name: "S2VSB",
1044 | bit: 5,
1045 | len: 1,
1046 | checkBoxColor: UI_checkBox_11
1047 | },
1048 | {
1049 | name: "S2VSA",
1050 | bit: 4,
1051 | len: 1,
1052 | checkBoxColor: UI_checkBox_12
1053 | },
1054 | {
1055 | name: "S2GB",
1056 | bit: 3,
1057 | len: 1,
1058 | checkBoxColor: UI_checkBox_13
1059 | },
1060 | {
1061 | name: "S2GA",
1062 | bit: 2,
1063 | len: 1,
1064 | checkBoxColor: UI_checkBox_14
1065 | },
1066 | {
1067 | name: "OT",
1068 | bit: 1,
1069 | len: 1,
1070 | checkBoxColor: UI_checkBox_7
1071 | },
1072 | {
1073 | name: "OTPW",
1074 | bit: 0,
1075 | len: 1,
1076 | checkBoxColor: UI_checkBox_8
1077 | }
1078 | ],
1079 | rw_info: "Read only",
1080 | chips: [chip.TMC2208, chip.TMC2209]
1081 | },
1082 | {
1083 | name: "PWMCONF",
1084 | addr: 0x70,
1085 | bitName: [
1086 | {
1087 | name: "PWM_LIM",
1088 | bit: 28,
1089 | len: 4,
1090 | spinBox: UI_PWM_LIM_spinBox
1091 | },
1092 | {
1093 | name: "PWM_REG",
1094 | bit: 24,
1095 | len: 4,
1096 | spinBox: UI_PWM_REG_spinBox
1097 | },
1098 | // { name: "-", bit: 23, len: 1},
1099 | // { name: "-", bit: 22, len: 1},
1100 | {
1101 | name: "FREEWHEEL",
1102 | bit: 20,
1103 | len: 2
1104 | },
1105 | {
1106 | name: "PWM_AUTOGRAD",
1107 | bit: 19,
1108 | len: 1,
1109 | checkBox: UI_PWM_AUTOGRAD_checkBox
1110 | },
1111 | {
1112 | name: "PWM_AUTOSCALE",
1113 | bit: 18,
1114 | len: 1,
1115 | checkBox: UI_PWM_AUTOSCALE_checkBox
1116 | },
1117 | {
1118 | name: "PWM_FREQ",
1119 | bit: 16,
1120 | len: 2,
1121 | spinBox: UI_PWM_FREQ_spinBox,
1122 | callback: UI_PWM_FREQ_callback
1123 | },
1124 | {
1125 | name: "PWM_GRAD",
1126 | bit: 8,
1127 | len: 8,
1128 | spinBox: UI_PWM_GRAD_spinBox
1129 | },
1130 | {
1131 | name: "PWM_OFS",
1132 | bit: 0,
1133 | len: 8,
1134 | spinBox: UI_PWM_OFS_spinBox
1135 | }
1136 | ],
1137 | rw_info: "R/W",
1138 | chips: [chip.TMC2208, chip.TMC2209]
1139 | },
1140 | {
1141 | name: "PWM_SCALE",
1142 | addr: 0x71,
1143 | bitName: [
1144 | {
1145 | name: "PWM_SCALE_SUM",
1146 | bit: 0,
1147 | len: 8
1148 | },
1149 | {
1150 | name: "PWM_SCALE_AUTO",
1151 | bit: 16,
1152 | len: 9
1153 | },
1154 | ],
1155 | rw_info: "Read only",
1156 | chips: [chip.TMC2208, chip.TMC2209]
1157 | },
1158 | {
1159 | name: "PWM_AUTO",
1160 | addr: 0x72,
1161 | bitName: [
1162 | {
1163 | name: "PWM_OFS_AUTO",
1164 | bit: 0,
1165 | len: 8
1166 | },
1167 | {
1168 | name: "PWM_GRAD_AUTO",
1169 | bit: 16,
1170 | len: 8
1171 | },
1172 | ],
1173 | rw_info: "Read only",
1174 | chips: [chip.TMC2208, chip.TMC2209]
1175 | }
1176 | ];
1177 |
1178 |
1179 | // ****************** Start Motor Current ********************************
1180 |
1181 | function UI_I_RUN_spinBoxValueChanged(value) {
1182 | setRegisterByName("IRUN", value);
1183 | UI_I_RUN_callback(value);
1184 | }
1185 |
1186 | function UI_I_RUN_callback(value) {
1187 | UI_I_RUN_Label.setText("Run current = " + parseFloat(((value + 1.0) / 32) * (0.325 / (0.110 + 0.020)) * 0.707).toFixed(2) + " A RMS");
1188 | }
1189 |
1190 | function UI_I_HOLD_spinBoxValueChanged(value) {
1191 | setRegisterByName("IHOLD", value);
1192 | UI_I_HOLD_callback(value);
1193 | }
1194 |
1195 | function UI_I_HOLD_callback(value) {
1196 | UI_I_HOLD_Label.setText("Hold current = " + parseFloat(((value + 1.0) / 32) * (0.325 / (0.110 + 0.020)) * 0.707).toFixed(2) + " A RMS");
1197 | }
1198 |
1199 | function UI_I_HOLD_DELAY_spinBoxValueChanged(value) {
1200 | setRegisterByName("IHOLDDELAY", value);
1201 | UI_I_HOLD_DELAY_callback(value);
1202 | }
1203 |
1204 | function UI_I_HOLD_DELAY_callback(value) {
1205 | UI_IHOLDDELAY_Label.setText("Hold delay = " + parseFloat(value * (1 << 18) / 12e6).toFixed(3) + " s per step");
1206 | }
1207 |
1208 | function UI_T_POWER_DOWN_spinBoxValueChanged(value) {
1209 | setRegisterByName("TPOWERDOWN", value);
1210 | UI_TPOWERDOWN_callback(value);
1211 | }
1212 |
1213 | function UI_TPOWERDOWN_callback(value) {
1214 | UI_TPOWERDOWN_Label.setText("Time = " + parseFloat(value * (1 << 18) / 12e6).toFixed(3) + " s");
1215 | }
1216 |
1217 | // ****************** End Motor Current ********************************
1218 |
1219 |
1220 | // ****************** Start StealthChop/SpreadCycle ********************************
1221 |
1222 | function UI_EN_SPREADCYCLE_checkBoxValueChanged() {
1223 | setRegisterByName("EN_SPREADCYCLE", UI_EN_SPREADCYCLE_checkBox.isChecked() ? 1 : 0);
1224 | }
1225 |
1226 | function UI_PWM_AUTOSCALE_checkBoxValueChanged() {
1227 | setRegisterByName("PWM_AUTOSCALE", UI_PWM_AUTOSCALE_checkBox.isChecked() ? 1 : 0);
1228 | }
1229 |
1230 | function UI_PWM_AUTOGRAD_checkBoxValueChanged() {
1231 | setRegisterByName("PWM_AUTOGRAD", UI_PWM_AUTOGRAD_checkBox.isChecked() ? 1 : 0);
1232 | }
1233 |
1234 | function UI_PWM_FREQ_spinBoxValueChanged(value) {
1235 | setRegisterByName("PWM_FREQ", value);
1236 | UI_PWM_FREQ_callback(value);
1237 | }
1238 |
1239 | function UI_PWM_FREQ_callback(value) {
1240 | var fpwm = [2 / 1024 * 12e3, 2 / 683 * 12e3, 2 / 512 * 12e3, 2 / 410 * 12e3];
1241 | if (fpwm[value] < 20 || fpwm[value] > 50)
1242 | UI_PWM_FREQ_spinBox.setBackgroundColor("red");
1243 | else
1244 | UI_PWM_FREQ_spinBox.setBackgroundColor("white");
1245 | UI_PWM_FREQ_Label.setText("Frequency = " + parseFloat(fpwm[value]).toFixed(1) + " kHz");
1246 | }
1247 |
1248 | function UI_TOFF_spinBoxValueChanged(value) {
1249 | setRegisterByName("TOFF", value);
1250 | }
1251 |
1252 | function UI_TBL_spinBoxValueChanged(value) {
1253 | setRegisterByName("TBL", value);
1254 | }
1255 |
1256 | function UI_HSTRT_spinBoxValueChanged(value) {
1257 | setRegisterByName("HSTRT", value);
1258 | }
1259 |
1260 | function UI_HEND_spinBoxValueChanged(value) {
1261 | setRegisterByName("HEND", value);
1262 | }
1263 |
1264 | function UI_TPWMTHRS_spinBoxValueChanged(value) {
1265 | setRegisterByName("TPWMTHRS", value);
1266 | }
1267 |
1268 | function UI_PWM_LIM_spinBoxValueChanged(value) {
1269 | setRegisterByName("PWM_LIM", value);
1270 | }
1271 |
1272 | function UI_PWM_REG_spinBoxValueChanged(value) {
1273 | setRegisterByName("PWM_REG", value);
1274 | }
1275 |
1276 | function UI_PWM_OFS_spinBoxValueChanged(value) {
1277 | setRegisterByName("PWM_OFS", value);
1278 | }
1279 |
1280 | function UI_PWM_GRAD_spinBoxValueChanged(value) {
1281 | setRegisterByName("PWM_GRAD", value);
1282 | }
1283 |
1284 | // ****************** End StealthChop/SpreadCycle ********************************
1285 |
1286 | // ****************** Start StallGuard ********************************
1287 |
1288 | function UI_TCOOLTHRS_spinBoxValueChanged(value) {
1289 | setRegisterByName("TCOOLTHRS", value);
1290 | }
1291 |
1292 | function UI_SGTHRS_spinBoxValueChanged(value) {
1293 | setRegisterByName("SGTHRS", value);
1294 | }
1295 |
1296 | function UI_SEIMIN_spinBoxValueChanged(value) {
1297 | setRegisterByName("SEIMIN", value);
1298 | }
1299 |
1300 | function UI_SEDN_spinBoxValueChanged(value) {
1301 | setRegisterByName("SEDN", value);
1302 | }
1303 |
1304 | function UI_SEMAX_spinBoxValueChanged(value) {
1305 | setRegisterByName("SEMAX", value);
1306 | }
1307 |
1308 | function UI_SEUP_spinBoxValueChanged(value) {
1309 | setRegisterByName("SEUP", value);
1310 | }
1311 |
1312 | function UI_SEMIN_spinBoxValueChanged(value) {
1313 | setRegisterByName("SEMIN", value);
1314 | }
1315 |
1316 | // ****************** End StallGuard ********************************
1317 |
1318 |
1319 | // ****************** Start DRV_STATUS polling ********************************
1320 |
1321 | function poll_DRV_STATUS_function() {
1322 | readRegister(0x01); // GSTAT
1323 | readRegister(0x6F); // DRV_STATUS
1324 | }
1325 |
1326 | var DRV_STATUS_Timer = scriptThread.createTimer();
1327 | DRV_STATUS_Timer.timeoutSignal.connect(poll_DRV_STATUS_function);
1328 |
1329 | function UI_DRV_STATUS_Polling_checkBox_Clicked() {
1330 | var enabled = UI_DRV_STATUS_polling_checkBox.isChecked();
1331 |
1332 | UI_DRV_STATUS_Polling_groupBox.setEnabled(enabled);
1333 | UI_GSTAT_groupBox.setEnabled(enabled);
1334 |
1335 | UI_checkBox_1.setEnabled(enabled);
1336 | UI_checkBox_2.setEnabled(enabled);
1337 | UI_checkBox_3.setEnabled(enabled);
1338 | UI_checkBox_4.setEnabled(enabled);
1339 | UI_checkBox_5.setEnabled(enabled);
1340 | UI_checkBox_6.setEnabled(enabled);
1341 | UI_checkBox_7.setEnabled(enabled);
1342 | UI_checkBox_8.setEnabled(enabled);
1343 | UI_checkBox_9.setEnabled(enabled);
1344 | UI_checkBox_10.setEnabled(enabled);
1345 | UI_checkBox_11.setEnabled(enabled);
1346 | UI_checkBox_12.setEnabled(enabled);
1347 | UI_checkBox_13.setEnabled(enabled);
1348 | UI_checkBox_14.setEnabled(enabled);
1349 | UI_checkBox_15.setEnabled(enabled);
1350 | UI_checkBox_16.setEnabled(enabled);
1351 |
1352 | if (enabled)
1353 | DRV_STATUS_Timer.start(500);
1354 | else
1355 | DRV_STATUS_Timer.stop();
1356 | }
1357 | // ****************** End DRV_STATUS polling ********************************
1358 |
1359 |
1360 | // ****************** Start TSTEP recordng ********************************
1361 |
1362 | function clearButtonPressed() {
1363 | plotWindow.clearGraphs();
1364 | }
1365 |
1366 | function TSTEP_showGraph() {
1367 | plotWindow.show();
1368 | }
1369 |
1370 | function poll_TSTEP_function() {
1371 | if (!readRegister(0x12)) // TSTEP
1372 | TSTEPPollCounter = 1; // stop on error
1373 |
1374 | if (TSTEPPollCounter > 0) {
1375 | TSTEPPollCounter--;
1376 | if (TSTEPPollCounter === 0) {
1377 | TSTEP_Timer.stop();
1378 | UI_RecordingStart_pushButton.setEnabled(true);
1379 | UI_RecordingStart_pushButton.setText("Start");
1380 | plotWindow.show();
1381 | }
1382 | }
1383 | }
1384 |
1385 | var TSTEPPollCounter = 0;
1386 | var TSTEPGraphXCounter = 0;
1387 | var TSTEP_Timer = scriptThread.createTimer();
1388 | TSTEP_Timer.timeoutSignal.connect(poll_TSTEP_function);
1389 |
1390 | function TSTEP_startRecording() {
1391 | var pollInterval = 50;
1392 |
1393 | plotWindow.clearGraphs();
1394 | UI_RecordingStart_pushButton.setEnabled(false);
1395 | UI_RecordingStart_pushButton.setText("Recording...");
1396 | TSTEPPollCounter = UI_RecordingTime_spinBox.value() * 1000 / pollInterval;
1397 | TSTEPGraphXCounter = 0;
1398 | TSTEP_Timer.start(pollInterval);
1399 | plotWindow.show();
1400 | }
1401 |
1402 | function setTSTEP_PollValue(value) {
1403 | if (TSTEPPollCounter > 0) {
1404 | if (value > 250)
1405 | value = 250; // upper limit in graph
1406 | plotWindow.addDataToGraph(plotWindowGraph1Index, TSTEPGraphXCounter, value);
1407 | TSTEPGraphXCounter++;
1408 | }
1409 | }
1410 |
1411 | // ****************** End TSTEP recordng ********************************
1412 |
1413 |
1414 | // ****************** Start OTP programmer ********************************
1415 |
1416 | function UI_OTPBYTE_spinBoxValueChanged(value) {
1417 | UI_OTP_Name_label.setText("Name: otp" + UI_OTPBYTE_spinBox.value() + "." + UI_OTPBIT_spinBox.value());
1418 | }
1419 |
1420 | function UI_OTPBIT_spinBoxValueChanged(value) {
1421 | UI_OTP_Name_label.setText("Name: otp" + UI_OTPBYTE_spinBox.value() + "." + UI_OTPBIT_spinBox.value());
1422 | }
1423 |
1424 | function UI_OTP_pushButtonClicked() {
1425 | var bi = UI_OTPBIT_spinBox.value();
1426 | var by = UI_OTPBYTE_spinBox.value();
1427 |
1428 | if (scriptThread.showYesNoDialog("Critical", "WARNING", "Setting otp" + by + "." + bi + " to '1'?\n\nAre you absolutely shure?\nYou can not undo this bit writing!")) {
1429 | var value32 = 0xbd00 | (by << 4) | bi;
1430 | if (scriptThread.showYesNoDialog("Critical", "WARNING", "Double check:\n\nWriting " + decimalToHex(value32, 8) + " to OTP_PROG?")) {
1431 | writeRegister(0x04, value32); // OTP_PROG
1432 |
1433 | scriptThread.sleepFromScript(10);
1434 | scriptThread.messageBox("Information", "OPT_PROG", "Bit programmed!\nRead all registers and check the result under OTP_READ.");
1435 | }
1436 | }
1437 | }
1438 |
1439 | // ****************** End OTP programmer ********************************
1440 |
1441 | function initAfterConnection() {
1442 | readAllRegisters();
1443 | if (waitReceived()) {
1444 | OTP_READ_Decoder(); // setting some reset values from otp-Registers
1445 | if (waitReceived()) {
1446 | setRegisterByName("IRUN", 31); // 31 = reset default
1447 | setRegisterByName("IHOLD", OptRead.IHOLD);
1448 | setRegisterByName("IHOLDDELAY", OptRead.IHOLDDELAY);
1449 | setRegisterByName("TPOWERDOWN", 20); // 20 = reset default
1450 | setRegisterByName("TPWMTHRS", OptRead.TPWMTHRS);
1451 |
1452 | // init
1453 | setRegisterByName("PDN_DISABLE", 1);
1454 | return true;
1455 | }
1456 | }
1457 | return false;
1458 | }
1459 |
1460 |
1461 | // ********************** Signal connections *****************************
1462 |
1463 | initTreeWidget(AllRegisters, UI_GeneralTreeWidget);
1464 | UI_Chip_comboBox.currentTextChangedSignal.connect(chipChanged);
1465 |
1466 | UI_Connect_pushButton.clickedSignal.connect(connectButtonClicked);
1467 | serialPort.readyReadSignal.connect(dataReceivedSlot);
1468 |
1469 | UI_ReadAllButton.clickedSignal.connect(readAllRegisters);
1470 |
1471 | // Init Motor Current
1472 | UI_spinBox_I_RUN.valueChangedSignal.connect(UI_I_RUN_spinBoxValueChanged);
1473 | UI_spinBox_I_HOLD.valueChangedSignal.connect(UI_I_HOLD_spinBoxValueChanged);
1474 | UI_spinBox_I_HOLD_DELAY.valueChangedSignal.connect(UI_I_HOLD_DELAY_spinBoxValueChanged);
1475 | UI_spinBox_T_POWER_DOWN.valueChangedSignal.connect(UI_T_POWER_DOWN_spinBoxValueChanged);
1476 |
1477 | UI_EN_SPREADCYCLE_checkBox.clickedSignal.connect(UI_EN_SPREADCYCLE_checkBoxValueChanged);
1478 | UI_PWM_AUTOSCALE_checkBox.clickedSignal.connect(UI_PWM_AUTOSCALE_checkBoxValueChanged);
1479 | UI_PWM_AUTOGRAD_checkBox.clickedSignal.connect(UI_PWM_AUTOGRAD_checkBoxValueChanged);
1480 | UI_PWM_FREQ_spinBox.valueChangedSignal.connect(UI_PWM_FREQ_spinBoxValueChanged);
1481 | UI_TOFF_spinBox.valueChangedSignal.connect(UI_TOFF_spinBoxValueChanged);
1482 | UI_TBL_spinBox.valueChangedSignal.connect(UI_TBL_spinBoxValueChanged);
1483 | UI_HSTRT_spinBox.valueChangedSignal.connect(UI_HSTRT_spinBoxValueChanged);
1484 | UI_HEND_spinBox.valueChangedSignal.connect(UI_HEND_spinBoxValueChanged);
1485 | UI_TPWMTHRS_spinBox.valueChangedSignal.connect(UI_TPWMTHRS_spinBoxValueChanged);
1486 | UI_PWM_LIM_spinBox.valueChangedSignal.connect(UI_PWM_LIM_spinBoxValueChanged);
1487 | UI_PWM_REG_spinBox.valueChangedSignal.connect(UI_PWM_REG_spinBoxValueChanged);
1488 | UI_PWM_OFS_spinBox.valueChangedSignal.connect(UI_PWM_OFS_spinBoxValueChanged);
1489 | UI_PWM_GRAD_spinBox.valueChangedSignal.connect(UI_PWM_GRAD_spinBoxValueChanged);
1490 |
1491 | // StallGuard
1492 | UI_TCOOLTHRS_spinBox.valueChangedSignal.connect(UI_TCOOLTHRS_spinBoxValueChanged);
1493 | UI_SGTHRS_spinBox.valueChangedSignal.connect(UI_SGTHRS_spinBoxValueChanged);
1494 | UI_SEIMIN_spinBox.valueChangedSignal.connect(UI_SEIMIN_spinBoxValueChanged);
1495 | UI_SEDN_spinBox.valueChangedSignal.connect(UI_SEDN_spinBoxValueChanged);
1496 | UI_SEMAX_spinBox.valueChangedSignal.connect(UI_SEMAX_spinBoxValueChanged);
1497 | UI_SEUP_spinBox.valueChangedSignal.connect(UI_SEUP_spinBoxValueChanged);
1498 | UI_SEMIN_spinBox.valueChangedSignal.connect(UI_SEMIN_spinBoxValueChanged);
1499 |
1500 | // DRV Status polling
1501 | UI_DRV_STATUS_polling_checkBox.clickedSignal.connect(UI_DRV_STATUS_Polling_checkBox_Clicked);
1502 |
1503 | // TSTEP recording
1504 | var plotWindow = scriptThread.createPlotWindow();
1505 | plotWindow.setWindowTitle("plot window created/used by script");
1506 | plotWindow.setAxisLabels("x axis plot 1", "y axis plot 1");
1507 | plotWindow.showLegend(true);
1508 | plotWindow.setInitialAxisRanges(100, 0, 300);
1509 | var plotWindowGraph1Index = plotWindow.addGraph("blue", "solid", "TSTEP");
1510 | plotWindow.showHelperElements(true, true, true, true, true, true, true);
1511 |
1512 | UI_RecordingShow_pushButton.clickedSignal.connect(TSTEP_showGraph);
1513 | UI_RecordingStart_pushButton.clickedSignal.connect(TSTEP_startRecording);
1514 | plotWindow.clearButtonPressedSignal.connect(clearButtonPressed);
1515 |
1516 | // OPT Programmer
1517 | UI_OTPBYTE_spinBox.valueChangedSignal.connect(UI_OTPBYTE_spinBoxValueChanged);
1518 | UI_OTPBIT_spinBox.valueChangedSignal.connect(UI_OTPBIT_spinBoxValueChanged);
1519 | UI_OTP_pushButton.clickedSignal.connect(UI_OTP_pushButtonClicked);
1520 |
1521 | UI_Dialog.finishedSignal.connect(dialogFinished);
1522 |
--------------------------------------------------------------------------------
/ScriptCommunicator/scripts/TMC220X_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ScriptCommunicator/scripts/TMC220X_scripts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2100_v10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2100_v10.jpg
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2100_v10.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2100_v10.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2100_v11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2100_v11.jpg
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2100_v11.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2100_v11.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2100_v12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2100_v12.jpg
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2100_v12.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2100_v12.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2100_v12_5V.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2100_v12_5V.jpg
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2100_v12_5V.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2100_v12_5V.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2100_v13.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2100_v13.jpg
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2100_v13.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2100_v13.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2100_v13_5V.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2100_v13_5V.jpg
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2100_v13_5V.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2100_v13_5V.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2100_v20.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2100_v20.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2100_v20_5V.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2100_v20_5V.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2130_v10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2130_v10.jpg
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2130_v10.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2130_v10.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2130_v11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2130_v11.jpg
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2130_v11.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2130_v11.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2130_v20.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2130_v20.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2208_v10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2208_v10.jpg
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2208_v10.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2208_v10.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2208_v11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2208_v11.jpg
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2208_v11.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2208_v11.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2208_v12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2208_v12.jpg
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2208_v12.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2208_v12.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2208_v13.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2208_v13.jpg
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2208_v13.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2208_v13.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2208_v20.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2208_v20.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2209_v20.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2209_v20.jpg
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC2209_v20.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC2209_v20.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC5160_v13.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC5160_v13.jpg
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC5160_v13.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC5160_v13.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC5160_v14.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC5160_v14.pdf
--------------------------------------------------------------------------------
/hardware/SilentStepStick-TMC5160_v15.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/SilentStepStick-TMC5160_v15.pdf
--------------------------------------------------------------------------------
/hardware/StepStick-Protector_v10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/StepStick-Protector_v10.jpg
--------------------------------------------------------------------------------
/hardware/StepStick-Protector_v10.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/StepStick-Protector_v10.pdf
--------------------------------------------------------------------------------
/hardware/StepStick-Protector_v11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/StepStick-Protector_v11.jpg
--------------------------------------------------------------------------------
/hardware/StepStick-Protector_v11.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/StepStick-Protector_v11.pdf
--------------------------------------------------------------------------------
/hardware/StepStick-Protector_v20.brd:
--------------------------------------------------------------------------------
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 | SilentStepStick
82 | Protector
83 | VM
84 | GND
85 | GND
86 | M2B
87 | M2A
88 | M1A
89 | M1B
90 | VIO
91 | DIR
92 | STEP
93 | 3
94 | 2
95 | 1
96 | ---CFG---
97 | www.watterott.com
98 | Silkscreen: 22 bPlace
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 | Arduino, Raspberry Pi...
111 |
112 |
113 | 21 tPlace
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 | >NAME
138 | >VALUE
139 |
140 |
141 |
142 |
143 | R, C, L, Pot, Jumper, Diodes, Crystals
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 | >NAME
154 | >VALUE
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 | >NAME
163 | >VALUE
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 | Jumper without cream
177 |
178 |
179 | >NAME
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 | Symbols, Logos...
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 | 4 x 2 mm
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 | <b>2 Layer PCB Design Rules</b>
386 | <b>2 Layer PCB Design Rules</b>
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
--------------------------------------------------------------------------------
/hardware/StepStick-Protector_v20.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/StepStick-Protector_v20.pdf
--------------------------------------------------------------------------------
/hardware/StepStick-Tester_v10.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/watterott/SilentStepStick/098b7518b0de31e6a12fda78c68ae2666b81fbb6/hardware/StepStick-Tester_v10.pdf
--------------------------------------------------------------------------------
/software/TMC2100.ino:
--------------------------------------------------------------------------------
1 | /*
2 | SilentStepStick TMC2100 Example
3 | Rsense: 0.11 Ohm
4 |
5 | Example source code free to use.
6 | Further information: https://learn.watterott.com/license/
7 | */
8 |
9 | // Note: You also have to connect GND, 5V/VIO and VM.
10 | // A connection diagram can be found in the schematics.
11 | #define EN_PIN 7 //enable (CFG6)
12 | #define DIR_PIN 8 //direction
13 | #define STEP_PIN 9 //step
14 |
15 | void setup()
16 | {
17 | //set pin modes
18 | pinMode(EN_PIN, OUTPUT);
19 | digitalWrite(EN_PIN, HIGH); //deactivate driver (LOW active)
20 | pinMode(DIR_PIN, OUTPUT);
21 | digitalWrite(DIR_PIN, LOW); //LOW or HIGH
22 | pinMode(STEP_PIN, OUTPUT);
23 | digitalWrite(STEP_PIN, LOW);
24 |
25 | digitalWrite(EN_PIN, LOW); //activate driver
26 | }
27 |
28 | void loop()
29 | {
30 | //make steps
31 | digitalWrite(STEP_PIN, HIGH);
32 | delay(2);
33 | digitalWrite(STEP_PIN, LOW);
34 | delay(2);
35 | }
36 |
--------------------------------------------------------------------------------
/software/TMC2130.ino:
--------------------------------------------------------------------------------
1 | /*
2 | SilentStepStick TMC2130 Example
3 | Rsense: 0.11 Ohm
4 |
5 | Other examples/libraries can be found here:
6 | https://github.com/teemuatlut/TMCStepper
7 | https://github.com/trinamic/TMC-API
8 | https://github.com/janelia-arduino/TMC2130
9 | https://github.com/makertum/Trinamic_TMC2130
10 |
11 | Example source code free to use.
12 | Further information: https://learn.watterott.com/license/
13 | */
14 |
15 | #include
16 |
17 | // Note: You also have to connect GND, 5V/VIO and VM.
18 | // A connection diagram can be found in the schematics.
19 | #define EN_PIN 7 //enable (CFG6)
20 | #define DIR_PIN 8 //direction
21 | #define STEP_PIN 9 //step
22 |
23 | #define CS_PIN 10 //CS chip select
24 | #define MOSI_PIN 11 //SDI/MOSI (ICSP: 4, Uno: 11, Mega: 51)
25 | #define MISO_PIN 12 //SDO/MISO (ICSP: 1, Uno: 12, Mega: 50)
26 | #define SCK_PIN 13 //CLK/SCK (ICSP: 3, Uno: 13, Mega: 52)
27 |
28 | //TMC2130 registers
29 | #define WRITE_FLAG (1<<7) //write flag
30 | #define READ_FLAG (0<<7) //read flag
31 | #define REG_GCONF 0x00
32 | #define REG_GSTAT 0x01
33 | #define REG_IHOLD_IRUN 0x10
34 | #define REG_CHOPCONF 0x6C
35 | #define REG_COOLCONF 0x6D
36 | #define REG_DCCTRL 0x6E
37 | #define REG_DRVSTATUS 0x6F
38 |
39 | uint8_t tmc_write(uint8_t cmd, uint32_t data)
40 | {
41 | uint8_t s;
42 |
43 | digitalWrite(CS_PIN, LOW);
44 |
45 | s = SPI.transfer(cmd);
46 | SPI.transfer((data>>24UL)&0xFF);
47 | SPI.transfer((data>>16UL)&0xFF);
48 | SPI.transfer((data>> 8UL)&0xFF);
49 | SPI.transfer((data>> 0UL)&0xFF);
50 |
51 | digitalWrite(CS_PIN, HIGH);
52 |
53 | return s;
54 | }
55 |
56 | uint8_t tmc_read(uint8_t cmd, uint32_t *data)
57 | {
58 | uint8_t s;
59 |
60 | tmc_write(cmd, 0UL); //set read address
61 |
62 | digitalWrite(CS_PIN, LOW);
63 |
64 | s = SPI.transfer(cmd);
65 | *data = SPI.transfer(0x00)&0xFF;
66 | *data <<=8;
67 | *data |= SPI.transfer(0x00)&0xFF;
68 | *data <<=8;
69 | *data |= SPI.transfer(0x00)&0xFF;
70 | *data <<=8;
71 | *data |= SPI.transfer(0x00)&0xFF;
72 |
73 | digitalWrite(CS_PIN, HIGH);
74 |
75 | return s;
76 | }
77 |
78 | void setup()
79 | {
80 | //set pins
81 | pinMode(EN_PIN, OUTPUT);
82 | digitalWrite(EN_PIN, HIGH); //deactivate driver (LOW active)
83 | pinMode(DIR_PIN, OUTPUT);
84 | digitalWrite(DIR_PIN, LOW); //LOW or HIGH
85 | pinMode(STEP_PIN, OUTPUT);
86 | digitalWrite(STEP_PIN, LOW);
87 |
88 | pinMode(CS_PIN, OUTPUT);
89 | digitalWrite(CS_PIN, HIGH);
90 | pinMode(MOSI_PIN, OUTPUT);
91 | digitalWrite(MOSI_PIN, LOW);
92 | pinMode(MISO_PIN, INPUT);
93 | digitalWrite(MISO_PIN, HIGH);
94 | pinMode(SCK_PIN, OUTPUT);
95 | digitalWrite(SCK_PIN, LOW);
96 |
97 | //init serial port
98 | Serial.begin(9600); //init serial port and set baudrate
99 | while(!Serial); //wait for serial port to connect (needed for Leonardo only)
100 | Serial.println("\nStart...");
101 |
102 | //init SPI
103 | SPI.begin();
104 | //SPI.setDataMode(SPI_MODE3); //SPI Mode 3
105 | //SPI.setBitOrder(MSBFIRST); //MSB first
106 | //SPI.setClockDivider(SPI_CLOCK_DIV128); //clk=Fcpu/128
107 | SPI.beginTransaction(SPISettings(1000000UL, MSBFIRST, SPI_MODE3));
108 |
109 | //set TMC2130 config
110 | tmc_write(WRITE_FLAG|REG_GCONF, 0x00000001UL); //voltage on AIN is current reference
111 | tmc_write(WRITE_FLAG|REG_IHOLD_IRUN, 0x00001010UL); //IHOLD=0x10, IRUN=0x10
112 | tmc_write(WRITE_FLAG|REG_CHOPCONF, 0x00008008UL); //native 256 microsteps, MRES=0, TBL=1=24, TOFF=8
113 | //tmc_write(WRITE_FLAG|REG_CHOPCONF, 0x01008008UL); //128 microsteps, MRES=0, TBL=1=24, TOFF=8
114 | //tmc_write(WRITE_FLAG|REG_CHOPCONF, 0x02008008UL); // 64 microsteps, MRES=0, TBL=1=24, TOFF=8
115 | //tmc_write(WRITE_FLAG|REG_CHOPCONF, 0x03008008UL); // 32 microsteps, MRES=0, TBL=1=24, TOFF=8
116 | //tmc_write(WRITE_FLAG|REG_CHOPCONF, 0x04008008UL); // 16 microsteps, MRES=0, TBL=1=24, TOFF=8
117 | //tmc_write(WRITE_FLAG|REG_CHOPCONF, 0x05008008UL); // 8 microsteps, MRES=0, TBL=1=24, TOFF=8
118 | //tmc_write(WRITE_FLAG|REG_CHOPCONF, 0x06008008UL); // 4 microsteps, MRES=0, TBL=1=24, TOFF=8
119 | //tmc_write(WRITE_FLAG|REG_CHOPCONF, 0x07008008UL); // 2 microsteps, MRES=0, TBL=1=24, TOFF=8
120 | //tmc_write(WRITE_FLAG|REG_CHOPCONF, 0x08008008UL); // 1 microsteps, MRES=0, TBL=1=24, TOFF=8
121 |
122 | //outputs on (LOW active)
123 | digitalWrite(EN_PIN, LOW);
124 | }
125 |
126 | void loop()
127 | {
128 | static uint32_t last_time=0;
129 | uint32_t ms = millis();
130 | uint32_t data;
131 | uint8_t s;
132 |
133 | if((ms-last_time) > 1000) //run every 1s
134 | {
135 | last_time = ms;
136 |
137 | //show REG_GSTAT
138 | s = tmc_read(REG_GSTAT, &data);
139 | Serial.print("GSTAT: 0x0");
140 | Serial.print(data, HEX);
141 | Serial.print("\t - ");
142 | Serial.print("Status: 0x");
143 | Serial.print(s, HEX);
144 | if(s & 0x01) Serial.print(" reset");
145 | if(s & 0x02) Serial.print(" error");
146 | if(s & 0x04) Serial.print(" sg2");
147 | if(s & 0x08) Serial.print(" standstill");
148 | Serial.println(" ");
149 |
150 | //show REG_DRVSTATUS
151 | s = tmc_read(REG_DRVSTATUS, &data);
152 | Serial.print("DRVSTATUS: 0x");
153 | Serial.print(data, HEX);
154 | Serial.print("\t - ");
155 | Serial.print("Status: 0x");
156 | Serial.print(s, HEX);
157 | if(s & 0x01) Serial.print(" reset");
158 | if(s & 0x02) Serial.print(" error");
159 | if(s & 0x04) Serial.print(" sg2");
160 | if(s & 0x08) Serial.print(" standstill");
161 | Serial.println(" ");
162 | }
163 |
164 | //make steps
165 | digitalWrite(STEP_PIN, HIGH);
166 | delayMicroseconds(10);
167 | digitalWrite(STEP_PIN, LOW);
168 | delayMicroseconds(10);
169 | }
170 |
--------------------------------------------------------------------------------
/software/TMC220X.ino:
--------------------------------------------------------------------------------
1 | /*
2 | SilentStepStick TMC2208/TMC2209 Example
3 | Rsense: 0.11 Ohm
4 |
5 | Other examples/libraries can be found here:
6 | https://github.com/teemuatlut/TMCStepper
7 | https://github.com/trinamic/TMC-API
8 | https://github.com/manoukianv/TMC2208Pilot
9 |
10 | Example source code free to use.
11 | Further information: https://learn.watterott.com/license/
12 | */
13 |
14 | // Note: You also have to connect GND, 5V/VIO and VM.
15 | // A connection diagram can be found in the schematics.
16 | #define EN_PIN 7 //enable (CFG6)
17 | #define DIR_PIN 8 //direction
18 | #define STEP_PIN 9 //step
19 |
20 | void setup()
21 | {
22 | //set pin modes
23 | pinMode(EN_PIN, OUTPUT);
24 | digitalWrite(EN_PIN, HIGH); //deactivate driver (LOW active)
25 | pinMode(DIR_PIN, OUTPUT);
26 | digitalWrite(DIR_PIN, LOW); //LOW or HIGH
27 | pinMode(STEP_PIN, OUTPUT);
28 | digitalWrite(STEP_PIN, LOW);
29 |
30 | digitalWrite(EN_PIN, LOW); //activate driver
31 | }
32 |
33 | void loop()
34 | {
35 | //make steps
36 | digitalWrite(STEP_PIN, HIGH);
37 | delay(2);
38 | digitalWrite(STEP_PIN, LOW);
39 | delay(2);
40 | }
41 |
--------------------------------------------------------------------------------
/software/TMC5160.ino:
--------------------------------------------------------------------------------
1 | /*
2 | SilentStepStick TMC5160 Example
3 | Rsense: 0.075 Ohm
4 |
5 | TMCStepper library required:
6 | https://github.com/teemuatlut/TMCStepper
7 |
8 | Example source code free to use.
9 | Further information: https://learn.watterott.com/license/
10 | */
11 |
12 | #include
13 |
14 | // Note: You also have to connect GND, 5V/VIO and VM.
15 | // A connection diagram can be found in the schematics.
16 | #define EN_PIN 7 //enable
17 | #define DIR_PIN 8 //direction
18 | #define STEP_PIN 9 //step
19 |
20 | #define CS_PIN 10 //CS chip select
21 | #define MOSI_PIN 11 //SDI/MOSI (ICSP: 4, Uno: 11, Mega: 51)
22 | #define MISO_PIN 12 //SDO/MISO (ICSP: 1, Uno: 12, Mega: 50)
23 | #define SCK_PIN 13 //CLK/SCK (ICSP: 3, Uno: 13, Mega: 52)
24 |
25 | #define R_SENSE 0.075f //TMC5160: 0.075 Ohm
26 |
27 | TMC5160Stepper tmc = TMC5160Stepper(CS_PIN, R_SENSE); //use hardware SPI
28 | //TMC5160Stepper tmc = TMC5160Stepper(CS_PIN, R_SENSE, MOSI_PIN, MISO_PIN, SCK_PIN); //use software SPI
29 |
30 | void setup()
31 | {
32 | //set pins
33 | pinMode(EN_PIN, OUTPUT);
34 | digitalWrite(EN_PIN, HIGH); //deactivate driver (LOW active)
35 | pinMode(DIR_PIN, OUTPUT);
36 | digitalWrite(DIR_PIN, LOW); //direction: LOW or HIGH
37 | pinMode(STEP_PIN, OUTPUT);
38 | digitalWrite(STEP_PIN, LOW);
39 |
40 | pinMode(CS_PIN, OUTPUT);
41 | digitalWrite(CS_PIN, HIGH);
42 | pinMode(MOSI_PIN, OUTPUT);
43 | digitalWrite(MOSI_PIN, LOW);
44 | pinMode(MISO_PIN, INPUT);
45 | digitalWrite(MISO_PIN, HIGH);
46 | pinMode(SCK_PIN, OUTPUT);
47 | digitalWrite(SCK_PIN, LOW);
48 |
49 | //init serial port
50 | Serial.begin(9600); //init serial port and set baudrate
51 | while(!Serial); //wait for serial port to connect (needed for Leonardo only)
52 | Serial.println("\nStart...");
53 |
54 | //set driver config
55 | tmc.begin();
56 | tmc.toff(4); //off time
57 | tmc.blank_time(24); //blank time
58 | //tmc.en_pwm_mode(1); //enable extremely quiet stepping
59 | tmc.microsteps(16); //16 microsteps
60 | tmc.rms_current(400); //400mA RMS
61 |
62 | //outputs on (LOW active)
63 | digitalWrite(EN_PIN, LOW);
64 | }
65 |
66 | void loop()
67 | {
68 | static uint32_t last_time=0;
69 | uint32_t ms = millis();
70 |
71 | if((ms-last_time) > 1000) //run every 1s
72 | {
73 | last_time = ms;
74 |
75 | if(tmc.diag0_error()){ Serial.println(F("DIAG0 error")); }
76 | if(tmc.ot()) { Serial.println(F("Overtemp.")); }
77 | if(tmc.otpw()) { Serial.println(F("Overtemp. PW")); }
78 | if(tmc.s2ga()) { Serial.println(F("Short to Gnd A")); }
79 | if(tmc.s2gb()) { Serial.println(F("Short to Gnd B")); }
80 | if(tmc.ola()) { Serial.println(F("Open Load A")); }
81 | if(tmc.olb()) { Serial.println(F("Open Load B")); }
82 | }
83 |
84 | //make steps
85 | digitalWrite(STEP_PIN, HIGH);
86 | delayMicroseconds(10);
87 | digitalWrite(STEP_PIN, LOW);
88 | delayMicroseconds(10);
89 | }
90 |
--------------------------------------------------------------------------------