Issues with [sdcard_loop]

Basic Information:

Printer Model: DIY Filament Spooler
MCU / Printerboard: Megatronics V3
Host / SBC: RaspberryPi 3
klippy.log

klippy.log (41.1 KB)

Fill out above information and in all cases attach your klippy.log file (use zip to compress it, if too big). Pasting your printer.cfg is not needed
Be sure to check our “Knowledge Base” Category first. Most relevant items, e.g. error messages, are covered there

Describe your issue:


I try to establish the loop function with [sdcard_loop] for a filament spooler.

G28 X
G90
MANUAL_STEPPER STEPPER=stepper_spool ENABLE=1 SET_POSITION=0
G1 X0 F300
SDCARD_LOOP_BEGIN COUNT=2
MANUAL_STEPPER STEPPER=stepper_spool ENABLE=1 MOVE=9000 SPEED=360 SYNC=0
G1 X43.25 F105
MANUAL_STEPPER STEPPER=stepper_spool ENABLE=1 SET_POSITION=0

MANUAL_STEPPER STEPPER=stepper_spool ENABLE=1 MOVE=9000 SPEED=360 SYNC=0
G1 X0 F105
MANUAL_STEPPER STEPPER=stepper_spool ENABLE=1 SET_POSITION=0
SDCARD_LOOP_END
MANUAL_STEPPER STEPPER=stepper_spool ENABLE=1 MOVE=360 SPEED=120 SYNC=0
G1 X1.75 F35
MANUAL_STEPPER STEPPER=stepper_spool ENABLE=1 SET_POSITION=0
MANUAL_STEPPER STEPPER=stepper_spool ENABLE=1 MOVE=360 SPEED=120 SYNC=0
G1 X3.5 F35
MANUAL_STEPPER STEPPER=stepper_spool ENABLE=1 SET_POSITION=0
G28 X
M84

But I always get Only permitted in SD file. as error.
And yes, the file to print is in the folder assigned with [virtual_sdcard]

grafik

Maybe the gcodes folder must be elsewhere?
Do I miss something in the gcode file?

The SDCARD_LOOP_BEGIN command must be in a gcode file that one is actively printing, and being printed using Klipper’s “virtual_sdcard” system. That is, the command can not be sent from the command-line, nor from macros issued from the command-line, nor from gcode sent piecemeal from OctoPrint. The error you posted above indicates that the sdcard_loop.py code detected the command did not originate from an active virtual_sdcard gcode print.

If the command was in a gcode file being actively printed from virtual_sdcard, then it indicates an error somewhere in the code. In that case, you could try issuing an M112 immediately after the event to get additional information in the Klipper log. I suspect a developer would need to look through that info to track down the root cause.

-Kevin

1 Like

I actually print from a file that is located in the virtual SDcard path.

Here is the klippy log with an issued M112

klippy.log (111.7 KB)

Test_3.gcode (719 Bytes)

I’m not sure what frontend you are using, but the gcode commands were definitely sent via the /tmp/printer pseudo-tty and not from a virtual_sdcard print. If this is OctoPrint, make sure you are telling it to print via sdcard and not via its normal streaming mode.

From the log:

Read 10109.004722: 'N0 M110 N0*125\n'
Read 10109.032599: 'N1 G28 X*106\n'
Read 10112.363954: 'N2 G90*18\n'
Read 10112.368594: 'MANUAL_STEPPER STEPPER=stepper_spool ENABLE=1 SET_POSITION=0\n'
Read 10112.379977: 'N3 G1 X0 F300*54\n'
Read 10112.384958: 'SDCARD_LOOP_BEGIN COUNT=2\n'
Read 10112.483550: 'N4 M84*27\n'
Read 10115.878750: 'M105\n'
Read 10116.954991: 'M112\n'

Those “Read” reports are reporting data read from /tmp/printer.

-Kevin

1 Like

If you are using Octoprint, then my experience is that Octoprint uses the traditional way via /tmp/printer and effectively bypasses the virtual SD card.

Try using M23 or Mainsail / fluidd.

1 Like

Good to know.

When M23 does not work, I’ll go with Mainsail.

Thank you both

Just installed Moonraker/Mainsail via KIAUH and it works now.

Thanks a lot again

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.