<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Getting Started on STMBLv5 Documentation</title><link>https://freakontrol.github.io/stmbl/docs/getting_started/</link><description>Recent content in Getting Started on STMBLv5 Documentation</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://freakontrol.github.io/stmbl/docs/getting_started/index.xml" rel="self" type="application/rss+xml"/><item><title>Pinouts</title><link>https://freakontrol.github.io/stmbl/docs/getting_started/pinouts/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://freakontrol.github.io/stmbl/docs/getting_started/pinouts/</guid><description>&lt;h2 id="pinouts">
 Pinouts
 &lt;a class="anchor" href="#pinouts">#&lt;/a>
&lt;/h2>
&lt;p>Interfaces supported by the current firmware (with the config template or component that reads them):&lt;/p>
&lt;ul>
&lt;li>Mesa SmartSerial = full-duplex UART (&lt;code>link sserial&lt;/code>)&lt;/li>
&lt;li>Encoder = QUAD (&lt;code>link enc_fb0&lt;/code>, component &lt;code>enc_fb&lt;/code>), optionally with analog SIN/COS tracks (1Vpp)&lt;/li>
&lt;li>Resolver = SIN/COS (&lt;code>link res_fb0&lt;/code>, component &lt;code>res&lt;/code>)&lt;/li>
&lt;li>Hall / commutation signals UVW (&lt;code>link uvw_fb0&lt;/code>, component &lt;code>uvw&lt;/code>)&lt;/li>
&lt;li>Mitsubishi (mit 02) = half-duplex UART (&lt;code>link encm_fb0&lt;/code>, component &lt;code>encm&lt;/code>)&lt;/li>
&lt;li>Sanyo Denki = half-duplex UART (&lt;code>link encs_fb0&lt;/code>, component &lt;code>encs&lt;/code>)&lt;/li>
&lt;li>Tamagawa SmartABS = half-duplex UART (&lt;code>link smartabs_fb0&lt;/code>, component &lt;code>smartabs&lt;/code>)&lt;/li>
&lt;li>Fanuc serial = half-duplex UART (&lt;code>link fanuc_fb0&lt;/code>, component &lt;code>encf&lt;/code>)&lt;/li>
&lt;li>Yaskawa Sigma serial (component &lt;code>yaskawa&lt;/code>, used by the &lt;code>conf/sgmph-*.txt&lt;/code> configs)&lt;/li>
&lt;li>DMM = RS485 (&lt;code>link encdmm_fb0&lt;/code>, component &lt;code>dmm&lt;/code>)&lt;/li>
&lt;li>EnDat = half-duplex SPI (component &lt;code>endat&lt;/code>, experimental, no template loads it)&lt;/li>
&lt;/ul>
&lt;p>The hardware can also carry SSI, BiSS (half-duplex SPI) and Hyperface (SIN/COS + half-duplex UART), but there is no firmware for them.&lt;/p></description></item><item><title>Servoterm</title><link>https://freakontrol.github.io/stmbl/docs/getting_started/servoterm/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://freakontrol.github.io/stmbl/docs/getting_started/servoterm/</guid><description>&lt;h1 id="servoterm">
 Servoterm
 &lt;a class="anchor" href="#servoterm">#&lt;/a>
&lt;/h1>
&lt;p>Servoterm (servo terminal) provides an interface which allows editing of the drive HAL configuration. It also provides a rolling graphical representation of any chosen parameter in the HAL, which can be a great aid to tuning and motor setup.&lt;/p>
&lt;p>Servoterm is now available as a C++ application. You can download it from 
 &lt;a href="https://github.com/STMBL/QtServoterm">this GitHub repository&lt;/a>.&lt;/p>
&lt;h2 id="installation">
 Installation
 &lt;a class="anchor" href="#installation">#&lt;/a>
&lt;/h2>
&lt;p>To install Servoterm, follow these steps:&lt;/p>
&lt;ol>
&lt;li>
&lt;p>Clone the repository:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>git clone https://github.com/STMBL/QtServoterm.git
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>Navigate to the project directory:&lt;/p></description></item><item><title>Feedback</title><link>https://freakontrol.github.io/stmbl/docs/getting_started/feedback/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://freakontrol.github.io/stmbl/docs/getting_started/feedback/</guid><description>&lt;h1 id="feedback">
 Feedback
 &lt;a class="anchor" href="#feedback">#&lt;/a>
&lt;/h1>
&lt;h2 id="incremental-encoder">
 Incremental Encoder
 &lt;a class="anchor" href="#incremental-encoder">#&lt;/a>
&lt;/h2>
&lt;p>An 
 &lt;a href="https://en.wikipedia.org/wiki/Incremental_encoder">incremental encoder&lt;/a> operates on the principle of quadrature encoding, meaning it uses two channels of data to provide accurate measurement information. When the encoder is rotated or displaced, both output signals A and B change in a specific sequence that indicates direction and magnitude of movement. However, since it doesn&amp;rsquo;t maintain an absolute position reference, it only provides relative changes from its initial state.&lt;/p></description></item><item><title>Motor</title><link>https://freakontrol.github.io/stmbl/docs/getting_started/motor/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://freakontrol.github.io/stmbl/docs/getting_started/motor/</guid><description>&lt;h1 id="motor">
 Motor
 &lt;a class="anchor" href="#motor">#&lt;/a>
&lt;/h1>
&lt;blockquote class="book-hint info">
&lt;p>It is possible to use 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/docs/getting_started/tuning/">autotuning&lt;/a> to estimate the motor parameters.&lt;br>
You can still use this guide if autotuning fails.&lt;/p>
&lt;/blockquote>
&lt;h2 id="motor-parameters">
 Motor parameters
 &lt;a class="anchor" href="#motor-parameters">#&lt;/a>
&lt;/h2>
&lt;p>Unfortunately, servo motor datasheets often lack a good description of the parameters. There is a difference between line-to-line and phase values. Here are listed the most important motor parameters and how to determine them.&lt;/p>
&lt;h3 id="resistance-conf0r">
 Resistance (conf0.r)
 &lt;a class="anchor" href="#resistance-conf0r">#&lt;/a>
&lt;/h3>
&lt;ol>
&lt;li>Measure line-to-line resistance R&lt;/li>
&lt;li>Convert to phase resistance conf0.r = R/2&lt;/li>
&lt;/ol>
&lt;h3 id="inductance-conf0l">
 Inductance (conf0.l)
 &lt;a class="anchor" href="#inductance-conf0l">#&lt;/a>
&lt;/h3>
&lt;ol>
&lt;li>Measure line-to-line inductance L&lt;/li>
&lt;li>Convert to phase inductance conf0.l = L/2&lt;/li>
&lt;/ol>
&lt;p>If you can&amp;rsquo;t measure this, a rough guess is conf0.l = 0.001 × conf0.r (a 1 ms electrical time constant). Better, measure it with &lt;code>link id_pmsm&lt;/code> (see 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/docs/getting_started/tuning/#electrical-parameters-id_pmsm">Tuning&lt;/a>).&lt;/p></description></item><item><title>Tuning</title><link>https://freakontrol.github.io/stmbl/docs/getting_started/tuning/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://freakontrol.github.io/stmbl/docs/getting_started/tuning/</guid><description>&lt;h1 id="parameter-tuning">
 Parameter Tuning
 &lt;a class="anchor" href="#parameter-tuning">#&lt;/a>
&lt;/h1>
&lt;p>STMBL can measure most motor and axis parameters itself. Each measurement is an identification component (&lt;code>idpmsm&lt;/code>, &lt;code>idacim&lt;/code>, &lt;code>iddc&lt;/code>, &lt;code>idtune&lt;/code>, &lt;code>idm&lt;/code>, &lt;code>ids&lt;/code>, &lt;code>iddac&lt;/code>) loaded by an &lt;code>id_*&lt;/code> config template. It takes over the power stage, runs its test and prints the results as &lt;code>conf0.* = ...&lt;/code> (or &lt;code>hv0.*&lt;/code>, &lt;code>acim_*&lt;/code>, &lt;code>vf0.*&lt;/code>) lines in green for you to append to the config.&lt;/p>
&lt;h2 id="requirements">
 Requirements
 &lt;a class="anchor" href="#requirements">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/docs/supply/">Supply&lt;/a>&lt;/li>
&lt;li>
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/docs/getting_started/servoterm/">Servoterm&lt;/a>&lt;/li>
&lt;li>
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/docs/getting_started/feedback/">Feedback&lt;/a>&lt;/li>
&lt;li>
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/docs/getting_started/motor/">Motor&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="before-you-start">
 Before You Start
 &lt;a class="anchor" href="#before-you-start">#&lt;/a>
&lt;/h2>
&lt;h3 id="which-stages-for-which-motor">
 Which stages for which motor
 &lt;a class="anchor" href="#which-stages-for-which-motor">#&lt;/a>
&lt;/h3>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th style="text-align: left">Motor&lt;/th>
 &lt;th style="text-align: left">Stages, in this order&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td style="text-align: left">DC motor&lt;/td>
 &lt;td style="text-align: left">
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#dc-motor">id_dc&lt;/a>, then 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#mechanical-parameters-id_mot">id_mot&lt;/a>, 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#load-inertia-id_sys">id_sys&lt;/a>, 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#control-loop-id_pid">id_pid&lt;/a>&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td style="text-align: left">PMSM with encoder&lt;/td>
 &lt;td style="text-align: left">
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#electrical-parameters-id_pmsm">id_pmsm&lt;/a>, 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#advance-and-dead-time-id_tune">id_tune&lt;/a>, 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#mechanical-parameters-id_mot">id_mot&lt;/a>, 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#load-inertia-id_sys">id_sys&lt;/a> (optional), 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#breakaway-torque-id_brk">id_brk&lt;/a> (optional), 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#coupling-resonance-id_lpf">id_lpf or id_frf&lt;/a> (optional), 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#control-loop-id_pid">id_pid&lt;/a>&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td style="text-align: left">Induction motor (ACIM)&lt;/td>
 &lt;td style="text-align: left">
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#standstill-test-id_acim">id_acim&lt;/a> (standstill, optional rotating test), then run it with 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#run-it-with-vf">V/f&lt;/a>, 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#run-it-with-vf-and-an-encoder">V/f with an encoder&lt;/a> or 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#run-it-with-foc">FOC&lt;/a>; with an encoder also id_mot, id_sys, id_pid (
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#speed-mode-spindle">speed mode&lt;/a> for a spindle)&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td style="text-align: left">Sensorless PMSM / ACIM&lt;/td>
 &lt;td style="text-align: left">identify as above, then 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#sensorless">obs_check, sl_pmsm, sl_acim, id_sys_sl&lt;/a>&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;p>On an STMBL v5 HV board also set the 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/#overcurrent-trip-threshold-hv0dac">overcurrent trip threshold&lt;/a>.&lt;/p></description></item><item><title>Linuxcnc</title><link>https://freakontrol.github.io/stmbl/docs/getting_started/linuxcnc/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://freakontrol.github.io/stmbl/docs/getting_started/linuxcnc/</guid><description>&lt;h1 id="linuxcnc">
 LinuxCNC
 &lt;a class="anchor" href="#linuxcnc">#&lt;/a>
&lt;/h1>
&lt;p>Here is an example of a LinuxCNC configuration for one axis, using Mesa smart serial.&lt;/p>
&lt;h2 id="stmbl-side">
 STMBL side
 &lt;a class="anchor" href="#stmbl-side">#&lt;/a>
&lt;/h2>
&lt;p>The drive config needs &lt;code>link sserial&lt;/code> after the motor and feedback templates, for example:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>link pid
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>link pmsm
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>link enc_fb0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>link sserial
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>link misc
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The &lt;code>sserial&lt;/code> template makes the drive a smart serial remote with the card name &lt;code>stbl&lt;/code>. It:&lt;/p>
&lt;ul>
&lt;li>links &lt;code>fault0.en = sserial0.enable&lt;/code>, so LinuxCNC enables and disables the drive, and sends the drive fault and its fault number (&lt;code>sserial0.fault_code = fault0.last_fault&lt;/code>) back to LinuxCNC&lt;/li>
&lt;li>feeds the position and velocity command from LinuxCNC through &lt;code>linrev0&lt;/code> and &lt;code>vel_int0&lt;/code> into the controller, and sends the position from &lt;code>linrev0&lt;/code> back to LinuxCNC&lt;/li>
&lt;li>derives an acceleration feedforward from the host frames: &lt;code>vel_int0.acc_out&lt;/code> (the change of &lt;code>vel_cmd&lt;/code> per frame, held until the next frame, 0 while the watchdog holds, clamped to &lt;code>conf0.max_acc&lt;/code>) goes through &lt;code>rev0.out_dd&lt;/code> to &lt;code>pid0.acc_ext_cmd&lt;/code>. It is on by default; &lt;code>vel_int0.acc_k&lt;/code> scales it (1 = as commanded, 0 = off)&lt;/li>
&lt;li>places the host frames on a smoothed frame clock, &lt;code>vel_int0.sync_k = 0.05&lt;/code>: a frame that arrives an rt tick early or late (host jitter) no longer puts a sawtooth of &lt;code>vel_cmd&lt;/code> x the timing error on the position command (10-20 um at 200 mm/s on Y). The mean offset is 0, so no latency is added; &lt;code>sync_k = 1&lt;/code> snaps to each frame as before (see 
 &lt;a href="https://freakontrol.github.io/stmbl/stmbl/docs/hal_components/vel_int/">vel_int&lt;/a>)&lt;/li>
&lt;li>runs &lt;code>sserial0&lt;/code> with rt_prio 2.3 and frt_prio 2.0, and sets &lt;code>sserial0.pos_advance = 0.0003&lt;/code> (tune it per axis, see the last section)&lt;/li>
&lt;li>raises fault 1 (CMD_ERROR) if no valid packet arrives for 5 ms (&lt;code>sserial0.timeout&lt;/code>, 100 frt cycles)&lt;/li>
&lt;/ul>
&lt;p>For a position axis (not a spindle) also set these two, both 0 by default:&lt;/p></description></item><item><title>Servoterm protocol</title><link>https://freakontrol.github.io/stmbl/docs/getting_started/servoterm_protocol/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://freakontrol.github.io/stmbl/docs/getting_started/servoterm_protocol/</guid><description>&lt;h1 id="servoterm-protocol-v1-float-scope-capture-header-ack">
 Servoterm protocol v1 (float scope, capture, header, ack)
 &lt;a class="anchor" href="#servoterm-protocol-v1-float-scope-capture-header-ack">#&lt;/a>
&lt;/h1>
&lt;p>Drive -&amp;gt; host on the USB CDC port. Text and binary share the stream. A binary frame starts with a marker byte in
0xFB..0xFF, and every payload byte of a 0xFD/0xFC/0xFB frame is in 1..250, so markers are unique there and text
(ASCII/UTF-8) never contains them. (Base 250, not 253: digits 250..252 would have been bytes 0xFB..0xFD.)&lt;/p>
&lt;h2 id="encodings">
 Encodings
 &lt;a class="anchor" href="#encodings">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>d250:&lt;/strong> an unsigned integer as base-250 digits, most significant first; each digit is stored as digit + 1
(1..250).&lt;/li>
&lt;li>&lt;strong>f32:&lt;/strong> an IEEE754 float&amp;rsquo;s 32 bits as a 5-digit d250 (250^5 &amp;gt; 2^32).&lt;/li>
&lt;li>&lt;strong>u16:&lt;/strong> a 2-digit d250 (0..62499).&lt;/li>
&lt;li>&lt;strong>u8:&lt;/strong> a 1-digit d250 (0..249).&lt;/li>
&lt;/ul>
&lt;h2 id="frames">
 Frames
 &lt;a class="anchor" href="#frames">#&lt;/a>
&lt;/h2>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th style="text-align: left">marker&lt;/th>
 &lt;th style="text-align: left">name&lt;/th>
 &lt;th style="text-align: left">payload&lt;/th>
 &lt;th style="text-align: left">length&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td style="text-align: left">0xFF&lt;/td>
 &lt;td style="text-align: left">legacy 8-bit sample (term0.fmt 0)&lt;/td>
 &lt;td style="text-align: left">8 bytes, v + 128 clamped 1..253 (was 1..254; 254 = 0xFE collided with reset)&lt;/td>
 &lt;td style="text-align: left">9&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td style="text-align: left">0xFE&lt;/td>
 &lt;td style="text-align: left">reset&lt;/td>
 &lt;td style="text-align: left">none: clear the scope&lt;/td>
 &lt;td style="text-align: left">1&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td style="text-align: left">0xFD&lt;/td>
 &lt;td style="text-align: left">float sample (term0.fmt 1)&lt;/td>
 &lt;td style="text-align: left">u8 seq, 8 x f32&lt;/td>
 &lt;td style="text-align: left">42&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td style="text-align: left">0xFC&lt;/td>
 &lt;td style="text-align: left">header&lt;/td>
 &lt;td style="text-align: left">6 x f32: proto (1), kind (0 live, 1 capture), period [s], channels (8), count, pre&lt;/td>
 &lt;td style="text-align: left">31&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td style="text-align: left">0xFB&lt;/td>
 &lt;td style="text-align: left">capture sample&lt;/td>
 &lt;td style="text-align: left">u16 index (0..count-1), 8 x f32&lt;/td>
 &lt;td style="text-align: left">43&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;ul>
&lt;li>
&lt;p>&lt;strong>Float values&lt;/strong> are &lt;code>(wave + offset) * gain&lt;/code>, the same number the 8-bit path rounds to a byte before adding 128.
The host divides by 128 to get today&amp;rsquo;s normalised -1..1 (it can go beyond ±1, never clipped).&lt;/p></description></item></channel></rss>