Troubleshooting SINUMERIK 840D sl Fagor Linear Encoder Alarm Errors
Replacing a Heidenhain linear encoder with a Fagor equivalent on a SINUMERIK 840D sl control can leave the affected linear axis operable for only a few centimetres of jog travel before the drive drops into a hard alarm. The fault is not a wiring problem, not a loose connector, and not a mechanical alignment issue. It is a referencing configuration mismatch: the replacement strip plus readhead combination produces a distance-coded (multiple reference mark) signal, while the controller has been told to expect a single-pulse incremental scale. The drive then raises a position-tracking or lost-reference alarm after a short travel because the index-pulse expectations cannot be satisfied. This reference walks through diagnosis, the parameter set that must change in both the NCK and the SINAMICS drive, and the verification sequence that confirms the fix on a live machine.
1. Problem Description
After mechanically mounting the Fagor linear scale and re-terminating the readhead to the SMC or SME module on the SINAMICS drive, the affected linear axis can be jogged freely for a stroke of approximately 5–10 cm in either direction. At that point the drive raises a hard alarm — typically 20005 / 21612 at the NCK level and 25000 / 25001 / 300748 in the HMI alarm line — and the axis stops with a follow-up error or encoder fault. No further motion is permitted until the alarm is cleared and the control is reset. The error returns at every jog attempt at the same physical position, which rules out loose connectors, intermittent cable damage, or readhead contamination as primary causes. The problem is consistent, repeatable, and occurs at a fixed travel, which is the signature of a configuration mismatch rather than a hardware defect.
1.1 Affected System Configuration
| Component | MLFB / Part Number | Notes |
|---|---|---|
| NCU | 6FC5371-0AA10-0AA1 | NCU 710.2 PN, software version A |
| PLC | PL 6FC5860-1YF20-0YA0 | Integrated PLC unit, PLU50.3 |
| Drive | SINAMICS S120 (Combi) | Integrated in NCU 710.2 |
| Original encoder | Heidenhain LC/LS series | Distance-coded reference marks, ~20 µm grating period |
| Replacement encoder | Fagor strip LO-8426 + readhead LP-A | Distance-coded (Referencias codificadas) |
2. Root Cause Analysis
Linear encoders on SINUMERIK 840D sl can be configured in one of two referencing modes that affect the entire parameter set, the homing sequence, and the alarm behaviour during motion. The mismatch is created when the new encoder is wired in correctly but the NCK axis machine data is left at the defaults for a single-pulse incremental scale.
| Referencing Mode | Reference Mark Layout | Activation | Reference Travel Required | Cam Switch |
|---|---|---|---|---|
| Single-pulse incremental | One index pulse per measuring length | $MA_ENC_REFP_MODE = 1 or 2 | Full travel past one or more index marks until valid zero mark found | Typically mandatory |
| Distance-coded (multiple reference marks) | Pair of index marks with coded spacing every X mm | $MA_ENC_REFP_MODE = 3 or 4 | Short travel (typically ≤ 20 mm) is sufficient | Optional, retained as safety interlock |
When the original Heidenhain encoder is replaced by a Fagor LO-8426 / LP-A combination, the mechanical mounting and the electrical signal (A, /A, B, /B, R, /R) are compatible with the SMC20 / SME120 sensor module. The controller's default referencing mode for a newly declared linear encoder, however, is single-pulse incremental. In that mode the SINAMICS drive expects to see a specific edge on the index track at a specific position. Because the distance-coded scale places index marks every few millimetres in a coded pattern, the drive interprets those spurious index edges as lost reference marks and raises a position-tracking alarm. The 5–10 cm window of motion before alarm corresponds to the distance the axis must travel before the drive's internal "expected next index" counter overflows when no valid index is found in the expected location. Once the counter overflows, the alarm is raised permanently until the axis is re-homed.
3. Pre-Diagnostic: Activate the Sinamics Alarm Buffer
Before changing any drive parameters, enable full alarm and warning visibility in the NCK. By default the HMI shows only summarised hardware faults that mask the actual SINAMICS diagnostic code, leaving the technician to guess at the root cause.
- Power the control ON in commissioning mode (password: machine manufacturer or service level).
- Navigate to Commissioning → Machine Data → General MD.
- Open MD13150 $MN_SINAMICS_ALARM_MASK.
- Set the value to
0xFFFF(or set the relevant bits to expose drive-side faults and warnings). - Reset the NCK (or perform an NCK restart) for the new mask to take effect.
- Re-trigger the fault by jogging the axis in JOG mode. The alarm line in the HMI will now show the underlying SINAMICS message (typically 20005, 21612, 300748, or F3x117), which is the true root cause.
0xFFFF is acceptable for commissioning and service work, but mask non-critical bits again before returning the machine to production so that the operator HMI is not flooded with informational warnings. Setting the bit to expose only faults (bit 0) and not warnings (bit 8) is a common compromise.4. Encoder Mode Parameter Changes
The encoder change requires modifications in three layers: the NCK axis machine data, the SINAMICS drive parameters, and the drive configuration itself. The simplest path is the drive configuration wizard; the manual path is required when the wizard cannot identify the encoder as distance-coded automatically or when commissioning is performed offline.
4.1 Drive Config Wizard (Recommended Path)
- Open HMI menu Commissioning → Drives → Configuration.
- Select the affected drive (e.g., SERVO_1 for the X axis).
- Run Change encoder type → Distance-coded linear scale.
- Enter the grating period from the Fagor datasheet for the LO-8426 strip (20 µm is standard).
- Save. The wizard overwrites the corresponding $MA_ENC_* axis MDs and p04xx SINAMICS parameters with values appropriate for distance-coded referencing.
- Exit the wizard and re-home the axis.
4.2 Manual Parameter Path
If the wizard is not available, cannot identify the encoder, or produces an unexpected result, change the parameters directly. The table below shows the minimum parameter set that must be reviewed. All parameters are written to the CF card on NCK reset; SINAMICS parameters are written to the non-volatile memory of the drive with the "Copy RAM to ROM" function.
| Layer | Parameter | Description | Value for LO-8426 / LP-A |
|---|---|---|---|
| NCK axis MD | $MA_ENC_IS_LINEAR[ax,enc] | Linear encoder flag | 1 (linear) |
| NCK axis MD | $MA_ENC_GRID_POINT_DIST[ax,enc] | Signal period of the encoder | 0.000020 m (20 µm) |
| NCK axis MD | $MA_ENC_RESOL[ax,enc] | Resolution (multiplier × period) | Per Fagor datasheet; commonly 0.001 µm (1 nm) |
| NCK axis MD | $MA_ENC_TYPE[ax,enc] | Encoder type identifier | 4 (linear, distance-coded) |
| NCK axis MD | $MA_ENC_REFP_MODE[ax,enc] | Referencing mode | 3 (distance-coded, NC-side evaluation) |
| NCK axis MD | $MA_ENC_REFP_MARKER_DIST[ax,enc] | Distance between two coded reference marks | Per Fagor datasheet for LP-A; typically 1000 × grating period = 20 mm |
| NCK axis MD | $MA_ENC_MARKER_INC[ax,enc] | Index increment on linear scale | Per scale data |
| NCK axis MD | $MA_ENC_INVERS[ax,enc] | Encoder direction inversion | 0 (or 1 if sign reversed during commissioning) |
| NCK axis MD | $MA_DRIVE_ENC_TYPE[ax,enc] | Drive-side encoder type | 4 (linear, distance-coded) |
| NCK axis MD | $MA_DRIVE_ENC_GRID_POINT_DIST[ax,enc] | Drive-side grating period | Match axis MD |
| NCK axis MD | $MA_DRIVE_ENC_RESOL[ax,enc] | Drive-side resolution | Match axis MD |
| NCK axis MD | $MA_DRIVE_ENC_IS_LINEAR[ax,enc] | Drive linear flag | 1 |
| SINAMICS DO | p0400[0] | Encoder type selection | 9999 (user-defined) or per encoder list |
| SINAMICS DO | p0404[0] | Encoder configuration word | Bit pattern: linear + distance-coded + signal level (TTL/1 Vpp) |
| SINAMICS DO | p0424[0] | Linear encoder resolution | 0.001 µm = 1e-8 m, or per datasheet |
| SINAMICS DO | p0437[0] | Sensor module configuration | Bit pattern enabling distance-coded evaluation |
5. Pre-Change Checklist
Perform the following checks before saving any parameter changes. Skipping any item risks introducing a new fault that masks the original one.
- Backup the current machine data via Commissioning → Series Start-up → Save to a CF card or network share so that the prior configuration can be restored if needed.
- Confirm the readhead output is wired correctly: A, /A, B, /B, R, /R on the SMC20 or SME120 module; shield bonded at one end only, no daisy-chained shield connections.
- Measure power supply at the readhead connector (5 V ± 5% for TTL, 5 V ± 5% for 1 Vpp). Low voltage produces intermittent index detection that mimics parameter errors.
- Verify mechanical alignment: readhead centred on the scale strip, riding height within the Fagor specification, scale not warped or twisted along its length.
- Confirm cable length does not exceed the Fagor drive-module specification (typically ≤ 30 m for TTL without repeater, ≤ 50 m for 1 Vpp with a Siemens / Heidenhain-approved cable).
- Set MD13150 $MN_SINAMICS_ALARM_MASK = 0xFFFF so the underlying SINAMICS message is visible.
6. Homing Procedure After Encoder Change
Once the parameters are saved, the axis must be re-referenced. With distance-coded mode, the controller requires only a short motion to resolve the absolute position; the cam switch is optional but is typically retained for fail-safe homing.
- Place the axis in JOG mode at reduced rapid override (5% is a good starting point).
- Execute REF from the HMI. The axis will traverse at
$MA_REFP_VELO_SEARCH_MARKER[ax]until two index marks have been evaluated by the controller and the absolute position is resolved. - If the axis alarms with 20005 or 21612, the parameter $MA_ENC_REFP_MARKER_DIST does not match the physical scale — re-check the Fagor datasheet for the coded spacing. For the LP-A readhead, the typical value is 20 mm; for other Fagor readheads the value may be 40 mm or 80 mm.
- After successful homing, the axis position display should match the mechanical position to within the encoder accuracy (typically ± 3 µm for the LP-A readhead).
- Perform a backlash test by moving ±1 mm past the homed position and verifying that no position jump appears on the actual-value display.
- Run a slow traverse of the full mechanical travel in JOG to confirm the index pulse search remains valid across the entire axis range.
7. Verification and Sign-Off
Confirm the fix with the following checks before returning the machine to production. Each row must pass before sign-off is recorded.
| Test | Method | Pass Criterion |
|---|---|---|
| Full-stroke JOG | Jog axis across the entire mechanical travel at 100% rapid | No alarm, position display tracks actual position |
| Repeatability | Home axis, move to a fixed mechanical stop, read actual value, repeat 5 times | Spread ≤ 5 µm across all 5 readings |
| Velocity loop | Run axis at programmed rapid and feed speeds | No following-error alarm; following error ≤ limit set in $MA_DYN_EXACT_STOP_FINE |
| Direction | Jog + then -, compare actual-value sign with machine zero | Sign consistent; $MA_ENC_INVERS = 0 if sign correct, 1 if inverted |
| Alarm buffer | After 30 min runtime, check alarm history | No 20005, 21612, 25000, 300748 entries |
| Power-cycle test | Power OFF/ON three times, re-home each time | Identical actual value at homed position on every cycle |
| Assign axis sanity | Use the Assign Axis function under Commissioning → Drives | No error reported; axis and drive data consistent |
8. Common Alarm Codes Encountered
| Alarm | Source | Meaning | Likely Cause |
|---|---|---|---|
| 20005 | NCK | Encoder error, channel 1 | Encoder mode mismatch, signal fault, or wiring |
| 21612 | NCK | Axis %1: re-referencing required after control reset | Lost homing following encoder change or power cycle |
| 25000 | NCK | Active encoder error | Following from drive fault F3x |
| 25001 | NCK | Axis %1: encoder error in drive | Drive detected encoder fault |
| 300748 | SINAMICS | Encoder 1: distance-coded reference mark error | Scale not configured as distance-coded |
| F31117 | SINAMICS DO | Sensor module error | Hardware, wiring, or parameter mismatch |
| F3x915 | SINAMICS DO | Encoder lost position | Index pulse search failed or wrong coded spacing |
| F3x920 | SINAMICS DO | Encoder temperature / signal error | Low supply voltage or cable damage |
9. Field Engineering Notes
Several practical observations from the field apply when swapping linear encoders on a live machine. These complement the parameter changes and reduce the risk of a second on-machine fault.
- Always ask the encoder vendor for the complete datasheet including reference-mark spacing. The combination of strip model and readhead model together determines whether the output is single-pulse or distance-coded; treating them as independent selections is a common source of misconfiguration.
- If the original Heidenhain spare is still available, the path of least resistance is to reinstall it. The drive configuration wizard can then be re-run with the new Fagor combination at a scheduled maintenance window without production pressure.
- MD13150 $MN_SINAMICS_ALARM_MASK = 0xFFFF is a high-value diagnostic enable switch. Use it on every drive troubleshooting engagement, not only encoder work — it converts a generic "hardware fault" into a precise drive-side message.
- The referencing chapter (16.5 / 16.6) of the SINUMERIK 840D sl Basic Functions manual is the authoritative reference for $MA_ENC_REFP_MODE selection. Always consult it before changing referencing mode.
- If the Fagor combination is genuinely incremental (single-pulse), a cam switch at one end of travel is mandatory for homing. For distance-coded, the cam switch is optional but recommended as a safety interlock.
- After the change, increase $MA_DYN_EXACT_STOP_FINE temporarily during commissioning to allow for any parameter-learning cycle to complete without nuisance alarms.
- The Assign Axis function under Commissioning → Drives can re-bind the encoder channel and update the drive data in a single operation. It is the right tool when multiple axes share a sensor module and the channel mapping has changed.
- Document the final $MA_ENC_REFP_MARKER_DIST, $MA_ENC_GRID_POINT_DIST, and SINAMICS p0404 values in the machine logbook. This is the single most useful reference for the next encoder service event on the machine.
10. When the Original Heidenhain Encoder Is Not Available
If the original Heidenhain spare has already been scrapped or cannot be sourced at short notice, contact Heidenhain with the new Fagor combination to identify a modern Heidenhain equivalent (LC 4xx or LS 4xx series in the same form factor). The benefit of staying on Heidenhain is that the existing distance-coded parameter set can be retained with only a serial number update in p0400 / p0422, avoiding the full parameter review. Where a return to Heidenhain is impossible, the parameter path described in sections 4 and 6 above is the production-ready route. Plan the work for a maintenance window — the change touches NCK MDs, SINAMICS p04xx, and the drive configuration, and a single incorrect value will halt the machine on first motion after restart.
FAQ
Why does the axis stop after only 5–10 cm when I jog it?
The drive is configured as a single-pulse incremental encoder. With a distance-coded Fagor scale, the controller sees multiple unexpected index edges within a few centimetres. Once the drive's expected-next-index counter overflows, it raises a 20005 / 25000 / 21612 alarm. Configure the axis as distance-coded ($MA_ENC_REFP_MODE = 3, $MA_ENC_REFP_MARKER_DIST = scale value) to resolve.
My Fagor datasheet says the encoder is incremental, but the strip is distance-coded. Which is right?
For Fagor the output type is determined by the combination of strip (e.g., LO-8426) and readhead (e.g., LP-A). The pair LO-8426 + LP-A is distance-coded. When the readhead produces a coded reference mark spacing, the NC must be told via $MA_ENC_REFP_MODE = 3 and the matching $MA_ENC_REFP_MARKER_DIST value from the datasheet.
What does MD13150 $MN_SINAMICS_ALARM_MASK do?
It controls whether the NCK displays the detailed SINAMICS drive-side alarms and warnings on the HMI. The default leaves only summarised hardware-fault messages visible. Setting MD13150 = 0xFFFF exposes the underlying F3xxxx message so the real cause is identifiable.
Do I need a cam switch to home with the Fagor distance-coded scale?
No. Distance-coded referencing resolves absolute position from a short travel (≤ ~20 mm typically). The cam switch is optional but commonly retained as a safety interlock. With single-pulse incremental encoders the cam switch is mandatory.
Can the drive config wizard set up the Fagor encoder automatically?
Yes. Commissioning → Drives → Configuration → Change encoder type → Distance-coded linear scale writes the correct $MA_ENC_* axis MDs and SINAMICS p04xx parameters. The wizard is the recommended path; manual editing is needed only if the wizard cannot identify the encoder or if you need a non-default resolution.
Which SINUMERIK 840D sl manual covers distance-coded referencing?
The SINUMERIK 840D sl Basic Functions manual, chapters 16.5 and 16.6, covers referencing modes including distance-coded scales. The SINAMICS S120 / S150 List Manual covers the p04xx encoder parameters. Both are available on the Siemens Support portal at support.industry.siemens.com under the SINUMERIK and SINAMICS product trees.