-
Notifications
You must be signed in to change notification settings - Fork 1
AD5X IFS Serial Protocol
The Intelligent Filament Station (IFS) on the AD5X communicates with the main printer controller via a dedicated UART serial connection. This document details the hardware interface and complete command protocol discovered through reverse engineering the firmwareExe binary (firmware v1.2.1).
| Property | Value |
|---|---|
| Device | /dev/ttyS4 |
| Baud Rate | 115200 |
| Data Bits | 8 |
| Parity | None |
| Stop Bits | 1 |
| Flow Control | None |
Unload filament from a specific slot via the FourToOne calibration panel. Performs a crotch cut before unloading.
Format: F10 C<slotId> L1000 S<unloadSpeed>
| Parameter | Description |
|---|---|
C<slotId> |
Slot number (1–4) |
L1000 |
Fixed length parameter |
S<speed> |
Unload speed from printer config |
Operation Flow:
- Call
checkCrotchCutting(slotId)to cut filament at junction - Send
F10 C<slotId> L1000 S<speed> - Poll
F13field 3 until it equals 5 (complete), sleeping 1s between polls
Primary command for loading or unloading filament from a specific IFS slot.
Format: F11 C<slotId> <colorCode>
| Parameter | Description |
|---|---|
C<slotId> |
Slot number (0–3 internally, displayed as 1–4 in UI) |
colorCode |
Hex color code (e.g., 1200 for red, ffff) |
Load Operation Flow:
- Send
F11 C<slotId> <color> - Poll
F13to monitor progress - If field 3 returns 0x7F → send
F15to continue - Wait for field 3 = 5 (complete)
- Check filament sensor
- Send
F112to finalize load
Unload Operation Flow:
- Send
F11 C<slotId> <color> - Send
M400(wait for motion buffer clear) - Poll
F13to monitor progress - If field 3 returns 0x7F → send
F15to continue - Wait for field 3 = 5 (complete)
- Verify slot bit cleared in F13 field 5
Sent after a successful load operation (F13 field 3 = 5) to finalize the filament loading.
Format: F112
Returns comprehensive IFS status. This is the primary polling command.
Format: F13
Response Format: Colon-space delimited fields prefixed with ok:
ok <f0>: <f1>: <f2>: <f3>: <f4>: <f5>: <f6>: <f7>: <f8>: <f9>: <f10>: <f11>
Key Fields:
| Field | Purpose | Description |
|---|---|---|
| 3 | Operation status | Status code for current load/unload/cut operation |
| 5 | Filament presence | Per-slot bitmask (bits 0–3 = slots 1–4) |
| 9 | Stall detection | Per-slot motor stall bitmask |
| 11 | Motor number | Active motor number (only during printing) |
Field 3 — Status Codes:
| Code | Meaning |
|---|---|
| 5 | Operation complete / ready |
| 0x7F (127) | Needs F15 command to continue (driver error) |
| 0x7E (126) | Error state |
Field 5 — Filament Presence Bitmask:
| Bit | Slot |
|---|---|
| 0 | Slot 1 |
| 1 | Slot 2 |
| 2 | Slot 3 |
| 3 | Slot 4 |
Field 9 — Stall Detection:
Per-slot bits for odometer roller movement. If the bit for the active channel is NOT set during printing, a stall counter increments. After 200 consecutive non-movement detections, error E0109 fires and the print is paused.
Polling Intervals:
| State | Interval |
|---|---|
| Idle | 200 ms |
| Printing | 1000 ms |
| IFS offline | 1000 ms (with retry) |
Special: F13 bypasses the IFS online check — it can be sent even when the IFS status flag is false.
Sent when F13 field 3 returns 0x7F during load, unload, or cut operations. After sending F15, the original command (F11/F24/F39) is re-sent to retry.
Format: F15 or F15 C
Query IFS firmware version and verify the module is alive.
Format: F19
Response: ok ... version:<version_string>
Special Properties:
- Bypasses IFS online check (like F13)
- Used after firmware update to verify new firmware is running
- Retried up to 3 times after firmware update
Reset the status of a specific IFS channel after a load/unload/change operation.
Format: F23 C<slotId>
| Parameter | Description |
|---|---|
C<slotId> |
Channel number (1–4) |
Typically called after load/unload operations, followed by F39 (post-operation crotch cut).
Cut filament at the crotch/junction point before a slot change. This is the primary crotch cutting command.
Format: F24 C<slotId>
Operation Flow:
- Send
F24 C<slotId> - Poll
F13field 3:- 5 → complete, exit
- 0x7F → send
F15 C, re-sendF24 C<slotId>, reset retry counter - 0x7E → error, exit
- Retry count > 20 → timeout, exit
- Otherwise: increment retry, sleep 1s
Puts the IFS module into bootloader mode for firmware flashing.
Format: F37
Firmware Update Sequence:
- Send
F37to enter bootloader - Close serial port
- Execute:
/usr/prog/PROGRAM/control/IFSCommand /usr/prog/PROGRAM/control/ifs.hex /dev/ttyS4 - Sleep 5 seconds
- Reopen serial port
- Send
F19(up to 3 retries) to verify IFS is alive - Parse version from response
Secondary crotch cut used after channel clear. Same flow as F24 but with max retry count of 10 (vs 20 for F24).
Format: F39 C<slotId>
Typical Sequence:
F11 C<slot> <color> → Load filament
[poll F13 until done]
F23 C<slot> → Clear channel status
F39 C<slot> → Verify crotch cut
[poll F13 until done]
Query the TMC stepper motor driver status register from the IFS module. Diagnostic command shown in Status screen UI.
Format: F44
Response: ok DRV_STATUS:<hex_value>
Only sent when the IFS present flag is true.
Query the TMC stepper motor general status register (GSTAT). Reports over-temperature, short-to-ground, and driver error flags.
Format: F45
Response: ok GSTAT:<hex_value>
Only sent when the IFS present flag is true.
| Command | Purpose | Parameters | Polls F13 |
|---|---|---|---|
| F10 | Manual unload (debug) | C<slot> L1000 S<speed> |
Yes |
| F11 | Load/unload filament | C<slot> <color> |
Yes |
| F112 | Finalize load | (none) | No |
| F13 | Query IFS status | (none) | N/A |
| F15 | Continue/retry operation | (none) or C
|
No |
| F19 | IFS version/probe | (none) | No |
| F23 | Clear channel status |
C<slot> (1–4) |
No |
| F24 | Crotch cut (pre-op) | C<slot> |
Yes (max 20) |
| F37 | Enter firmware update mode | (none) | No |
| F39 | Crotch cut (post-op) | C<slot> |
Yes (max 10) |
| F44 | TMC DRV_STATUS query | (none) | No |
| F45 | TMC GSTAT query | (none) | No |
| Code | Description | Trigger |
|---|---|---|
| E0100 | Channel 1 feeding timeout | Slot 1 load timeout |
| E0101 | Channel 2 feeding timeout | Slot 2 load timeout |
| E0102 | Channel 3 feeding timeout | Slot 3 load timeout |
| E0103 | Channel 4 feeding timeout | Slot 4 load timeout |
| E0104 | Channel 1 retracting timeout | Slot 1 unload timeout |
| E0105 | Channel 2 retracting timeout | Slot 2 unload timeout |
| E0106 | Channel 3 retracting timeout | Slot 3 unload timeout |
| E0107 | Channel 4 retracting timeout | Slot 4 unload timeout |
| E0108 | Failed to feed filament to extruder | Filament sensor timeout |
| E0109 | IFS odometer roller not moving | Stall count > 200 |
| E0114 | IFS homing error |
fourInOneLoadFristStep returns 10 |
The core filament swap routine (changeChannel) during multi-material printing:
-
M400— Wait for all moves to complete - Save current state (crash recovery)
-
M114— Get current position - Move nozzle to purge position
-
doLoadAndUnload()— Physical filament swap (unload old, load new via F11) - Calculate flush volume via
getFlushVol() - Run
cleanFilamentBox()1–2 times (2× if flush volume > 400) - Set fan speed:
SET_FAN_SPEED FAN=fanM106 SPEED=<value> - Move nozzle back to print position
-
G92 E0— Reset extruder position -
SDCARD_CLEAR_REFUELLING— Clear refuelling flag