EMC2 running on Raspberry Pi?

More
30 May 2012 18:35 #20514 by line
line created the topic: EMC2 running on Raspberry Pi?
Hi There!

Have anyone tried to run LinuxCNC on a "Raspberry Pi" computer?
More
31 May 2012 06:35 #20524 by ArcEye
ArcEye replied the topic: Re:EMC2 running on Raspberry Pi?
Hi

This is discussed here
www.linuxcnc.org/index.php/english/compo...ew&catid=18&id=18339

Short answer is no, the main thrust of LinuxCNC is still running NC machines on inexpensive computers, rather than trying to create embedded systems or find a way of using restricted low power boards.

regards
More
01 Jun 2012 06:39 #20550 by cncbasher
cncbasher replied the topic: Re:EMC2 running on Raspberry Pi?
although not an up to date version of Linuxcnc , heres a starter project using a webserver interface , but needs work
if you have the knowledge.. .
code.google.com/p/miniemc2/
More
06 Jun 2012 23:24 #20690 by wizard69
wizard69 replied the topic: Re:EMC2 running on Raspberry Pi?
ArcEye wrote:

Hi

This is discussed here
www.linuxcnc.org/index.php/english/compo...ew&catid=18&id=18339

Short answer is no, the main thrust of LinuxCNC is still running NC machines on inexpensive computers, rather than trying to create embedded systems or find a way of using restricted low power boards.

regards


While I don't want to dismiss the LinuxCNC projects goals do realize that these single board computers are getting more powerful everyday. The are indeed inexpensive too, especially if your intentions are to buy new hardware. There may not be an ideal board out there yet, but that could easily change, further I/O is far easier on some of these boards.

The flip side of this is that consumer grade PC hardware is going in a direction that is not friendly to machine control. In this regards we are already seeing issues at work where PC hardware for industrial use is getting more expensive. You can read that to mean PC hardware with lots of slots.

So what I'm saying is that it might not be a bad idea to keep an eye on the embedded processor board world. Linux is becoming very common place there and I really don't think it will be too long before suitable embedded boards are actually cheaper than some of the new PCs being used. Recycled is likely to be always cheaper but that is a different story.
More
06 Aug 2012 19:52 #22917 by mungkie
mungkie replied the topic: Re:EMC2 running on Raspberry Pi?
I am sure it will run eventually if someone put enough effort into it :D

www.raspberrypi.org/phpBB3/viewtopic.php?f=24&t=1847&p=137435

I have got the linuxcnc RT_PREEMPT fork to compile and run in sim mode, but, I am currently looking at hardware interfacing and writing a IO driver for loading into the hal as I feel the kernel will get sorted by someone else.

The interface should cost around £3 in components to build and give 16 bits of IO with 50kHz switching (if the PI can switch it that fast??).

I am still really in the guessing and rough testing stage though so I may never complete things if I hit some unforeseen obstacle.

I will eventually try and hack a kernel with real time support but am leaving it for now as I know absolutely nothing about real time kernel compilation and think an expert would do it quicker and better than I ever could.
More
06 Aug 2012 23:28 #22921 by andypugh
andypugh replied the topic: Re:EMC2 running on Raspberry Pi?
Still waiting for mine to arrive <sulk>
More
13 Aug 2012 10:04 #23081 by mungkie
mungkie replied the topic: Re:EMC2 running on Raspberry Pi?
Is there any documentation for writing hal driver modules for linuxcnc?

I have a very basic driver written for my hardware ( I finished soldering up the dual parallel port board this weekend but have not tested it yet).

The driver sort of works on breadboard switching a few pins, but I have to run linuxcnc as root with sudo to be able to access the kernelspace memory, does linuxcnc have any code to load modules with root access?

Is there a driver writing guide?

I am really just hacking this and still don't have a full understanding of how all parts of linuxcnc work together(maybe a stupid way to work but I sort of prefer to use the task to guide what I need to learn and understand).
More
13 Aug 2012 11:07 #23082 by ArcEye
ArcEye replied the topic: Re:EMC2 running on Raspberry Pi?

Is there any documentation for writing hal driver modules for linuxcnc?

linuxcnc.org/docs/2.5/html/hal/comp.html is a starting point, then look at the components in the source code and pick one which is closest to what you want to do.

Some of these are in pure C, it might be easiest to understand the ones with a .comp suffix to start with, as they just contain pin creation and the relevant function code, without the other
bits that comp fills in.

does linuxcnc have any code to load modules with root access?

You shouldn't need to if the module is loaded with loadrt, it will have access to what it requires, unless you are completely directly hacking and not using rtapi calls.
You will need to be specific as to what you want to achieve when you have been able to study the existing modules.

I suspect the code most of interest to you will be in the ../src/hal/drivers/ directory. Most of them are in pure C, you can always run comp filename to generate a C file from an existing .comp file to see what is added.

Lot of reading to do!

regards
More
13 Aug 2012 12:03 #23085 by mungkie
mungkie replied the topic: Re:EMC2 running on Raspberry Pi?
I suppose I should have elaborated more about my current situation:

I have already written a very basic test hal driver in c, it works with linuxcnc and the test LED is blinking when it should (I have only implemented very basic test functionality though the rest is just implementing more IO pins and possibly some caching).

I based the driver on c code from the linuxcnc tree, but have had to shift the driver about in the source tree to get it to compile, and have not sorted out the autogen and configure stuff so basically just hacked the Makefile and submakefile in src/ and src/hal/.

I have written a set of configs for the raspberry pi and the IO card I made and it load the IO card driver with 'loadrt hal_rpi 1' in my .hal file and connected stepgen and axis to the driver, but linuxcnc will not run as the module load fails due to access permissions. The problem is that the userspace driver requires root access to write to memmapped device, so I have to run linuxcnc with 'sudo linuxcnc'.

The driver works when I run linuxcnc as root and moving axes in the axis gui lights the test LEDS, my problem is that I do not want to have to run linuxcnc as root, and I am considering ways of hacking linuxcnc code so that it can run stepper based systems without a RT kernel using some scheduling tricks and some low level FIQ interupts (I have no idea what I am doing as its not something I have done before). Currently without any other hacking of kernel scheduling or interupts I am getting around 1.5KHz of pulses so should run a stepper system with 200 steps per rev at about 450rpm. I know this is all a horrendous hack and jitter and latency could be terrible but in some situation where you don't need to synchronise external events like spindle speed etc, it will be a workable solution (and this is just an interim stop gap that I have hacked up in a couple of weekends work)

Is there a wrapper for loading modules with root permissions?.

I should also say the system is built from the RT_PREEMPT git repo of linuxcnc-2.6 and is built in simulator mode, I am just trying to test the driver at present as I cannot get a realtime kernel at present and I think there are stability issues with RPI that mean it is not worth trying to kernel hack RT_PREEMPT for quite a while yet. I do hope to get a RT kernel running, but I am toying with the idea of running linuxcnc in non realtime as this could be a fairly simple thing to do (though not very accurate it maybe 'good enough' for some situations).
More
13 Aug 2012 12:32 #23086 by andypugh
andypugh replied the topic: Re:EMC2 running on Raspberry Pi?
mungkie wrote:

I have already written a very basic test hal driver in c, it works with linuxcnc and the test LED is blinking when it should


In that case:
sudo comp --install path/to/my/filename.c
ought to compile and install the module with the required permissions.
Moderators: ArcEye
Time to create page: 0.193 seconds
Powered by Kunena Forum