Skip to content

Flow calibration in the Creator 5 factory firmware

The touchscreen calls this Flow Calibration, but the routine is intended to test pressure advance. It does not measure a printed line's width, weigh extruded plastic, or calculate an extrusion multiplier. The host tries several pressure-advance values while the eboard observes the extruder motor driver's SG_RESULT load signal. The eboard reports whether each sampled waveform passes its check.

The sequence below is reconstructed from the factory firmwareExe.i64 database, principally BuildPage::clearNozzlePrint and CommMgr::paTestMgr, and from the factory eBoard.hex.

The stock test, step by step

  1. The host resets the extruder position with G92 E0, switches to relative extrusion with M83, sets acceleration to 5000 mm/s² and square-corner velocity to 9 mm/s, enables the X/Y motor-driver control pins, and waits for queued motion to finish.
  2. It tries these pressure-advance candidates in this order: 0.0100, 0.0200, 0.0150, 0.0350, 0.0250, 0.0300, and 0.0400. For each candidate it sends PA_ACTION ACTION=11 PC=666 to arm the eboard measurement, then SET_PRESSURE_ADVANCE ADVANCE=<candidate>.
  3. The carriage starts each candidate at X40 and a Y position from 50 to 80 in 5 mm steps. It extrudes across six X strokes ending at X60, X100, X120, X140, X180, and X200. The X and Y movements don't actually happen and get discarded, this is mostly to trick Klippy into thinking PA can be used. The short strokes extrude 1.13573 mm of filament at F1080 (18 mm/s); the long strokes extrude 2.27146 mm at F10980 (183 mm/s). Alternating slow and fast motion creates the motor-load transient that the eboard examines.
  4. The host sends PA_ACTION ACTION=0 PC=666, waits with M400, and reads PA_GET. It treats a returned value of 9 as a pass for that candidate.

The eboard firmware's pa_action handler resets its result and sample area when action 11 starts a measurement, switches its acquisition mode, then finalizes the capture when action 0 arrives. get_emcu_pa_value reports the result back to the host as pa_value value=<number>. 9 means "pass"; it isn't the measured pressure advance. How the eboard decides is described below. The host always sends PC=666, and what that value means isn't known yet.

Where the waveform comes from

The host does not synthesize an electrical waveform. It commands a sequence of extruder moves. Changing extrusion speed changes the motor's mechanical load; the TMC2209 turns that load into successive SG_RESULT register values. The eboard reads those values over UART and stores valid replies in time order. Plotting sample index against SG_RESULT produces the waveform that the classifier examines. Consecutive samples are roughly 2 ms apart when no reply is lost; dropped replies make sample index an imperfect time axis. It is a driver load estimate, not a direct motor current measurement or a measurement of deposited plastic.

In the current OpenCreator/Kalico bucket test the carriage stays at the purge bucket and runs the stock strokes: X/Y moves with extrusion, from X40 through six strokes ending at X60, X100, X120, X140, X180 and X200. The X/Y steppers are held, not stepped, so the nozzle doesn't move, but Klipper still treats them as X/Y moves and applies pressure advance. The X/Y speeds are flow_slow_speed (18 mm/s) and flow_fast_speed (183 mm/s) in [creator5_toolchanger], at 5000 mm/s² (flow_test_accel):

Segment X travel Filament commanded X/Y speed Nominal time at speed
Slow 20 mm 1.13573 mm 18 mm/s 1.11 s
Fast 40 mm 2.27146 mm 183 mm/s 0.22 s
Slow 20 mm 1.13573 mm 18 mm/s 1.11 s
Slow 20 mm 1.13573 mm 18 mm/s 1.11 s
Fast 40 mm 2.27146 mm 183 mm/s 0.22 s
Slow 20 mm 1.13573 mm 18 mm/s 1.11 s

That is about 1 mm/s of filament on the slow strokes and about 10.4 mm/s on the fast ones. Those durations are distance divided by speed, not exact captured pulse widths: acceleration, motion planning, and transitions between moves alter the actual timing. The test commands 9.08584 mm of filament per candidate. PA_ACTION ACTION=11 starts sampling before the moves; M400 drains them, and PA_ACTION ACTION=0 closes the capture. The eboard polls the driver about every 2 ms, accepts only complete replies with a valid CRC, and reserves 2,000 sample slots (about four seconds). Missing or invalid replies are not valid load observations.

A pass shows that the driver-load waveform matches the eboard's stroke criteria; it does not prove that the selected pressure-advance value is optimal.

How the eboard judges a stroke

This is how OpenCreator's own eboard firmware (in Kalico, src/c5_eboard_pa.c) does it.

Sampling. While a measurement runs, the eboard asks the extruder's TMC2209 driver for its load reading (SG_RESULT) about every 2 ms, roughly 500 times a second. The response parser checks its framing and CRC before storing a reading.

Judging. In those readings the eboard looks for a stroke:

  1. Start: the reading climbs by more than 99 without dropping.
  2. End: the reading stays at 70 or below for 0.4 s (or the readings run out).
  3. Plateau: the part above 150, minus 60 ms at each end.

The stroke passes when all of these are true:

  • The plateau averages more than 150.
  • The reading stays above 150 for about 80–150 readings, about 160–300 ms (the whole span above 150, before the 60 ms are trimmed). That's about the length of one fast stroke (0.22 s at 183 mm/s), not a slow one.
  • Early in the stroke the reading jumps more than 20% above the plateau, for at least 3 readings.
  • At the end it drops cleanly, from between half and all of the plateau level down to near zero.

If any stroke passes, the eboard answers 9.

What can make it fail

  • Klipper talking to the same driver. Klipper checks the extruder driver about once a second over the same wire, which garbles the eboard's readings and stops the test from ever passing. OpenCreator's flow test now pauses those checks while it runs.
  • No X/Y motion. Klipper only applies pressure advance to moves that include X or Y motion, so extruding in place tests nothing. Like the stock firmware, OpenCreator runs the stock X/Y strokes, but with the X/Y motors held still: they stay powered and locked, they just aren't sent any steps. The nozzle stays over the bucket, and afterwards the printer knows exactly where it is again, so no re-homing is needed.
  • Driver mode. The TMC2209 only gives a useful SG_RESULT in its quiet StealthChop mode, so OpenCreator runs the extruder driver in StealthChop (stealthchop_threshold: 999999 on [tmc2209 extruder] to [tmc2209 extruder3]). Klipper's default would be SpreadCycle. On stock firmware the eboard sets up the driver itself, so the stock config has no driver settings to compare with.

To see the driver settings the stock eboard uses, run DUMP_TMC STEPPER=extruder in the console of a printer still on stock firmware.

How it chooses and applies a result

One pass tests up to seven candidates and keeps the smallest candidate for which the eboard returned 9. The host allows up to five passes, stopping once three passes produce a valid candidate. It averages those three selected values to produce that tool's result. If fewer than three passes succeed, the test reports failure rather than producing a new value. The routine also cleans up its motor-driver test mode after completion or interruption.

After preparing the tools, the print-start code sends SET_PA_ADVANCE with the successful T0–T3 results and ENABLE=1. Entries without a result are filled with 99.0 as placeholders. If flow testing is off, or no valid tool result is available, it sends SET_PA_ADVANCE T0=99.0 T1=99.0 T2=99.0 T3=99.0 ENABLE=0. These final per-tool settings are distinct from the temporary SET_PRESSURE_ADVANCE candidate applied during each test.

Print start's flow_calibration switch controls whether this test runs for each used tool. See Print preparation for where it fits in the job, and How to toggle features for the switch. The separate experimental host-side test is noted in Calibration.