LinuxCNC

LinuxCNC controls CNC machines. It can drive milling machines, lathes, 3d printers, laser cutters, plasma cutters, robot arms, hexapods, and more. - LinuxCNC / What is the best CNC control software?

GUI

Configuration

Parallel port address

Parallel port is only seen by the kernel is pnpbios is active. (no pnpbios=0 options)

$ dmesg | grep parport
[ 11.551600] parport_pc 00:07: reported by Plug and Play ACPI
[ 11.551671] parport0: PC-style at 0x378 (0x778), irq 7, dma 3 [PCSPP,TRISTATE,COMPAT,ECP,DMA]
[ 11.648233] lp0: using parport0 (interrupt-driven).

Stepper Configuration

Latency-Test

  • If your “Max Jitter” number is less than about 15-20 microseconds (15’000-20’000 nanoseconds), the computer should give very nice results with software stepping.
  • If the Max Jitter is more like 30-50 microseconds, you can still get good results, but your maximum step rate might be a little disappointing, especially if you use microstepping or have very fine pitch leadscrews.
  • If the numbers are 100 uS or more (100’000 nanoseconds), then the PC is not a good candidate for software stepping.

Stress system

  • 3x glxgears (+ redim windows)
  • youtube video playing in 720p in firefox
  • stress with default cmdline / monitor temp
$ seq 3 | parallel -j 3 -n0 glxgears

intel E2180 config (2019)

add Kernels options, with value found in LinuxCNC 2.7 wheezy image this reduced a lot jitter.

The Intel Core2Duo benefits greatly from the idle=poll parameter to the kernel, which disables the deep-sleep C-State of the CPU. The effect is equal to that of hogging one CPU core. RealTime

Option acpi=off prevent kernel to shutdown pc.

$ sudo xedit /etc/default/grub
GRUB_CMDLINE_LINUX="... noapic acpi=off pnpbios=0 isolcpus=1"

$ sudo update-grub
Max Jitter:
GRUB_CMDLINE_LINUX="... noapic acpi=off pnpbios=0 isolcpus=1 intel_idle.max_cstate=0 processor.max_cstate=0 idle=poll"
Servo thread (1ms):  33k ns 62°C
Base thread (2.5µs): 58k ns

GRUB_CMDLINE_LINUX="... noapic acpi=off pnpbios=0 isolcpus=1"
Servo thread (1ms):  53k ns
Base thread (2.5µs): 38k ns

GRUB_CMDLINE_LINUX= default value
Servo thread (1ms):   45k ns
Base thread (2.5µs): 140k ns

## IRQ affinity
GRUB_CMDLINE_LINUX="... acpi=off pnpbios=0 isolcpus=1 intel_idle.max_cstate=0 processor.max_cstate=0 idle=poll acpi_irq_nobalance noirqbalance"
Servo thread (1ms):  66k ns 62°C
Base thread (2.5µs): 43k ns

GRUB_CMDLINE_LINUX="... noapic acpi=off pnpbios=0 isolcpus=1 intel_idle.max_cstate=0 processor.max_cstate=0 idle=poll acpi_irq_nobalance noirqbalance"
Servo thread (1ms):  25k 41k 22k 23k 35k 36k ns 62°C
Base thread (2.5µs): 49k 42k 43k 32k 31k 40k ns 

BIOS/Hardware config

  • Disable onboard audio
  • Disable APM and ACPI bios settings Turn everything off that you can. Any power saving, anything related to suspending, cpu frequency scaling, etc.
    • Enabling ACPI could be the only way to get access to local APIC timer (much lower latency than PIC), as new mainboards do not come with legacy support of MPTABLEs.
    • Disable C1E power-saving feature in BIOS (could save about ~10-15ms on recent CPUs), this feature is activated regardless of ACPI or APM, thus needs to be disabled independently. See Wikipedia for more information on this.
    • If you have a CPU that is C-state capable, add the following line to the GRUB_CMDLINE_LINUX in /etc/default/grub: idle=poll and run update-grub. The idle=poll keeps the CPU in a loop checking to see if it is needed rather then it entering C1 waiting for a wakeup call. I’ve seen latencies go from 30-50us to around 4us (1-2us even) on 6 different systems. RealTime

Multicore

Interrupts (IRQ)

# wath irq pert type/cpy
$ watch -n1 -d cat /proc/interrupts

Linuxcnc HAL tutorial / github

  • #1: The Basics
    • wiring goes into .hal / setting goes into .ini
    • kinematics / motion module
    • net signal command / setp set parameter
  • #2: INI improvements
    • display axis,control / default.ngc / GCODE subroutine
    • halui - running command from the ui
    • axis HOME_LATCH_VEL (second search spead)
    • user command file => to customize axis (linuxcnc ui written in python) (eg: disable command ‘r’)
  • #4: PyVCP / gladeVCP - Virtual Control Panel that extend Axis GUI (button / slider / readout)

Jog-wheel

FPGA

XFCE

LinuxCNC/Debian

Alternative

Written on October 29, 2020, Last update on November 19, 2023
cnc linux-system