LinuxCNC on a Liva X

More
24 Jan 2016 04:20 #69019 by 10K
LinuxCNC on a Liva X was created by 10K
I have a ECS Liva X.
http://www.ecs.com.tw/ECSWebSite/Product/Product_LIVA.aspx?DetailID=1593&LanID=0#Xtreme
It's a tiny all-in-one PC that mounts on the back of a monitor (touch-screen in my case). It talks over ethernet to a Mesa 7i92 card. That all works now, mostly due to a lot of assistance from tjmarch, pcw, and andypugh.

It took several days to get LinuxCNC installed on the Liva X. I've tried various distributions (11 so far), including 32 and 64 bit installs with varying luck. Currently, it's running a copy of Linux Mint LMDE 2, with RT PREEMPT 4.4. But I'm getting massive latencies - over 1,000,000ns. I did some tweaking of the kernel based on some internet advice, but I'm certainly no expert there.

The Liva X uses UEFI and an internal eMMC drive. This really complicates things. I've found that I can only install 64 bit versions of Linux (because of UEFI), and they have to be recent, or they don't see the eMMC drive during installation. Also, only the newer versions support the internal wireless chip. So for the OS, I've only been able to install 64 bit versions of:
  • Ubuntu 14.04.3 LTS
  • Linux Mint 17.3
  • Linux Mint LMDE 2
I'm pretty sure I was not able to load Debian Jessie 64 bit, but I tried it early in the process, and I need to try it again since I know more now that I have more experience getting things to work..

I've read on the board a bit about how RT PREEMPT 3.x distributions may have better latency than the newer 4.x version that I used. So I'm thinking that I may need to compile another kernel.

Does anyone have a recommendation on what path I should pursue, here? I saw that Peter (PCW) posted links to some instructions and a .config file, but the config is only for a 32 bit system:
freeby.mesanet.com/makert should build the latest preemt-rt kernel

freeby.mesanet.com/rtconfig is a known working .config file

I thought that I'd give the build instructions a go, but before I unknowingly go down another dead end, I thought I'd check here.

Please Log in or Create an account to join the conversation.

More
24 Jan 2016 07:53 #69024 by ArcEye
Replied by ArcEye on topic LinuxCNC on a Liva X

Does anyone have a recommendation on what path I should pursue, here? I saw that Peter (PCW) posted links to some instructions and a .config file, but the config is only for a 32 bit system:

freeby.mesanet.com/makert should build the latest preemt-rt kernel

freeby.mesanet.com/rtconfig is a known working .config file


I thought that I'd give the build instructions a go, but before I unknowingly go down another dead end, I thought I'd check here.


The instructions can be used generically, just substitute the later kernel and rt patch.

The rt config is 32 bit only because the option for 64 bit is not set.
Patch the kernel then run make menu-config, changing the setting on the first page to 64 bit, then save and compile.

The Liva X uses UEFI and an internal eMMC drive.


Having read how you cannot even access the BIOS properly unless you install windoze and how UEFI cannot be disabled, not a computer I would ever consider.

regards

Please Log in or Create an account to join the conversation.

More
24 Jan 2016 17:39 - 26 Jan 2016 17:23 #69061 by PCW
Replied by PCW on topic LinuxCNC on a Liva X
I have run LinuxCNC successfully on a HP-Stream-Mini which has a similar hardware to the Liva.

When I tested this it was with a Preempt-RT 3.18 kernel, a 3.18 or 4.1 kernel may give
better performance as the 4.4 kernel is _VERY_ new.

I did have to disable the on card Broadcom WIFI card as it caused massive latency spikes (I used a USB WIFI dongle for network access)

The other option is to just slow down the servo thread, this does compromise performance slightly because of
chording errors due to the velocity being constant between thread invocations.
500 Hz or even 250 Hz might be OK depending on accuracy requirements.

Note that at 250 Hz and a moderate 300 IPM, 50 IPS/S accel system (.1 second to full 300 IPM speed)
the chord error is less than .0001"
Last edit: 26 Jan 2016 17:23 by PCW.

Please Log in or Create an account to join the conversation.

More
06 Feb 2016 16:49 - 06 Feb 2016 16:52 #69702 by 10K
Replied by 10K on topic LinuxCNC on a Liva X
Update on progress.

I'm a persistent person, and I've tried more than 20 different distributions in more than 30 trials of Linux on the Liva X. I've gotten a lot of experience at compiling kernels! Here are my conclusions so far:

  • I can't run older distributions. They don't support the UEFA and/or the eMMC drives.
  • I can install a few 32 bit versions, but I can't get them to boot automatically after installation. I can use something like a rEFIned USB drive to boot into them, but I could never get it to boot automatically.
  • I can install some 64 bit distributions with the only problem being that I have to manually tweak the partitioning.
Here's what I've gotten to work. They're all 64 bit versions.

  • Mint LMDE 2
  • SparkyLinux 4.2
  • Debian Jessie 8.3
  • Ubuntu 14.04LTS

The next problem I had was getting a RT kernel to work. I've tried other kernels - rtai, liquorix and xenomai - without success. I don't think that they're good with linuxcnc-uspace anyway. I have not had much luck with the RT 3.x.x versions. I think that the problem is that they don't see the eMMC drive, so they crash when rebooting. The 4.4.x versions seem to work OK.

The kernel configuration has a lot of effect on the latency. I tried the rtconfig.txt that was posted in this forum, but my computer won't reboot with it.

So I've been "rolling my own". Here are the changes I've made with Xconfig:
Processor type and features
	Processor Family
		Intel Atom (this one item halved the latency)
	Preemption Model
		Fully Preemptible Kernel (RT) - on
	Timer frequency (n)
		1000 Hz
Power manmakemakeagement and ACPI options
	All options off under this heading
	All subheadings off, except don't change ACPI (....)Support
	

Power management and ACPI options
	turn off all but ACPI
	
Device Drivers (I don't think that these have a large effect, but I have not isolated and tested)
	Dallas's 1-wire support - off (n)
	Parallel port support - off
	Multimedia support - off
	Sound card support - off
	Sony MemoryStick card support - off 
	Accessibility support - off
	Virtualization drivers - off
	Platform support for Chrome hardware - off
	Industrial I/O support - off
Sound card disabled

Kernel hacking
	all off, including that under main listing, except
	Magic SysRq key on

In UEFI, I disabled the sound card.

I have a few questions:

  1. Is there anything else that I should try, either in UEFI or in Xconfig?
  2. I've seen a lot of discussion about what latency is needed. I'm running the Mesa 7i92 card, and use only the servo thread. Under []EMCMOT the parameter SERVO_PERIOD = 1,000,000. There is no BASE_PERIOD needed or set. What numbers should I be targeting when I check the latency? (I'm getting Servo 1ms spikes to 650,000)
Last edit: 06 Feb 2016 16:52 by 10K. Reason: typo

Please Log in or Create an account to join the conversation.

More
06 Feb 2016 17:07 - 06 Feb 2016 17:08 #69703 by PCW
Replied by PCW on topic LinuxCNC on a Liva X
You might want to check that the CPU clock scaling mode is set to "performance"
( and all possible power management options are disabled in the BIOs )

650 usec latency spikes probably mean that you will need to run the servo thread at 500 or 750 Hz or so
to avoid occasional real time errors
Last edit: 06 Feb 2016 17:08 by PCW.

Please Log in or Create an account to join the conversation.

More
21 Feb 2016 20:42 #70456 by 10K
Replied by 10K on topic LinuxCNC on a Liva X
I finally got it working! Here's what I did:
  • The eMMC drive was causing me a lot of grief. I bought a mSATA drive and installed it so I would not have to use the eMMC drive
  • I put the Liva X in "Other OS" mode instead of "Windows 8". That makes it where it'll load a non-UEFI OS
  • Installed the latest version of Debian Wheezy 32 bit
  • Installed linuxcnc and the RT-PREEMPT kernel using
sudo apt-get install linuxcnc-uspace
from the linuxcnc repository
deb http://linuxcnc.org/ wheezy base 2.7-uspace
LinuxCNC Latency Test Results using above:
3x glxgears, MP3 file playing, at end of 15 minutes
Max Jitter 32 bit (and 64 bit)
Servo Thread = 44013 (49296)
Base Thread = 38625 (49730)

Although it would not work with the Mesa 7i92 card, and has no parallel port, I loaded the live version of linuxcnc that already includes the RTAI kernel. I got great latency times. I didn't record the exact results, but this is close:

LinuxCNC Latency Test Results:
3x glxgears, MP3 file playing, at end of 15 minutes
Servo Thread = 2500
Base Thread = 6500

The only other change I made to the Liva X is that I'm using a USB network dongle so that I can have two networks, one at 192.168.1.x and the other at 10.10.10.x for the Mesa card.

Also, Wheezy does not support the Liva X's internal WiFi and Bluetooth. I found some drivers (rtlwifi-new-dkms linux-firmware rtl8723au-bt-dkms) that got them working, but the Latency numbers went through the roof. No big deal. I can get by fine without them.

I've already successfully cut a taper, an external thread, an internal thread, and a ball on the lathe.

Please Log in or Create an account to join the conversation.

Time to create page: 0.265 seconds
Powered by Kunena Forum