Science-X
Posts: 1
Joined: Thu Feb 19, 2015 1:38 am

Re: LinuxCNC

Thu Feb 19, 2015 2:43 am

Hi kinsa
I want to compile "Linux_rpi_3.8.13 + Xenomai_2.6.3 + LinuxCNC_2.5.3" by myself. So,I try to do .
Now,I finish "Linux_rpi_3.8.13 + Xenomai_2.6.3" with config-3.8.13-xenomai+ ,and filesystem was ready for them.
But,I get into trouble -> compile LinuxCNC_2.5.3
Image

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Fri Feb 20, 2015 11:54 am

Science-X wrote:Hi kinsa
I want to compile "Linux_rpi_3.8.13 + Xenomai_2.6.3 + LinuxCNC_2.5.3" by myself. So,I try to do .
Now,I finish "Linux_rpi_3.8.13 + Xenomai_2.6.3" with config-3.8.13-xenomai+ ,and filesystem was ready for them.
But,I get into trouble -> compile LinuxCNC_2.5.3
Image
Sorry, I can't seem to see your picture as I'm behind a firewall.

What exactly is the error message?
42

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Fri Feb 20, 2015 11:58 am

You didn't pass the correct parameters to configure:

Code: Select all

./configure --with-xenomai
Why are you building from source?
42

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: LinuxCNC

Fri Feb 20, 2015 6:35 pm

kinsa wrote:You didn't pass the correct parameters to configure:

Code: Select all

./configure --with-xenomai
Why are you building from source?
My guess is that incorrect version of linuxcnc is also being used so the only support is for rtai anyways.

As far as 'why' build from source, again just my guess, is that why not try building from source then can become a famous ubergeek and create a linuxcnc version that works well on the new rpi2.

I have had a quick look at the rpi2 and there could be problems with affinity in RT and other stuff, but its definitly going to be good probably a lot better than the beaglebone once things get sorted, of course beagle will be releasing something better soon but I think beagle don't have such a good linux software stack. If the rumors about the new GFX drivers are true rpi2 should be able to do it all.

Anyways, I am here for a reason, as I have been trying to recover some stuff from damaged backups to use on rpi2 tests, and maybe going to chuck something out from what I can recover of the rpi1 work if anyone wants to test. Not sure if I should post here or start a new thread.

I don't have a workable x86 for cross compiling and don't really want to dogfood compile even on the rpi2 so I am trying to find the last 3.14 kernel, soon as I do I will possibly put an image up.

I am not going to try 3.18RT for a few weeks or possibly months and I am not sure why people are bothering with xenomai on the rpi2.

Anyways if things go okay I may put something here this evening.

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: LinuxCNC

Fri Feb 20, 2015 8:34 pm

Okay so I think I recovered most of the stuff, I think was the last compile from september last year, I think the direction pins do not work as there were complaints about speed and I made a few attempts at optimizing via vc4 that I never got to finish due to hard disk crash.

I think it was possible to get 1MHz out of it, but obviously without direction control not a lot of use unless you only want one direction of stepper movement.

The previous driver version was doing 40K steps second (80KHz) and opencv was reasonably usable, but I could not find any of that from the backups yet.

To run you will need 18Mb download and then possibly 300Mb of raspbian packages upgraded.

Basically get a fresh install of raspbian on SD(unless you want to risk a current install and make sure you backup), install it open a terminal and type

Code: Select all

wget http://soundproofingforum.co.uk/rpi_linuxcnc/linuxcnc-RT-rpi1.0.tbz
tar xjf linuxcnc-RT-rpi1.0.tbz
cd linuxcnc
./install.sh
answer Y <enter> when prompted to upgrade/install via apt-get
then reboot
once reboot startx, then open a terminal, type 'cd linuxcnc ; run.sh'

It should run on all rpi a+ and b+ no problems, you can connect your stepper drivers to the appropriate gpio pins and an arduino to the i2c pins if you want more I/O.

you will have to check the .hal file to workout which gpio pins are used, I cannot remember I think it is probably set at 5us base thread with 5axes and the pins are a comma sep list of step,dir,step,dir....

I will probably try it out myself tomorrow and see if it runs motors, it was much much more stable than the version I released in 2013.

If you want more speed disable the gladevcp/pi3d/opencv tabs in the axis gui setup from the .ini file and change the base step period.

Wire
Posts: 78
Joined: Tue Sep 11, 2012 6:46 pm

Re: LinuxCNC

Fri Feb 20, 2015 10:39 pm

At one point it was stated that the RPI RTOS was not stable enough to do direct stepper driving. Has that been resolved now?

Right now the PICnc is capped at 40kHz so a direct GPIO solution running at 1MHz (or anything over 100kHz) would be a boon. More than likely would redo my control card to just do the GPIO and laser control and use the GPIOs for the stepgen. (would be nice to have more speed for when doing raster engraving.)

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: LinuxCNC

Sun Feb 22, 2015 10:33 pm

I had a quick play with the download I posted on a b+ this afternoon, lots of things I forgot I did, can just about get a 3us base step period and still run axis gui but anything less and it will virtually lockup with gui refresh of about 1 second.

There are also some weird things I did with the step timing definitions like step space, hold time, dir hold, etc are all defined as multiples of the base step period and are char values so anything over 255 could cause strange behaviours (this was done to save data size moving around cache to main memory and also allow some of the ARM simd intrinsics like __qsub8 etc to save a few cycles in the stegen). Also accumulator was reduced to a 32bit long as I heard armv6 has slow 64bit ops.

None of it was really finished and I think the driver was substantially improved if I can find a later version in the backups I will release an update.

That said I will probably not bother as I have spent a little time looking at RT_PREEMPT on the rpi2 and it may be an easy job (or it may not :lol ) but if I get time next weekend I may be able to get something working on the rpi2 with highspeed stepgen maybe 1MHz and responsive gui and opencv processing.

All the work on the rpi1 was probably wasted :lol:

grandixximo
Posts: 4
Joined: Sat Feb 28, 2015 7:20 am

Re: LinuxCNC

Sat Feb 28, 2015 7:28 am

This is an amazing project, i'd love to have a compact controller for my CNC machine, thank you for all your work mung

Do you think this project can be installed on the latest Raspberry Pi 2 Model B

joushou
Posts: 1
Joined: Thu Mar 12, 2015 11:12 pm

Re: LinuxCNC

Thu Mar 12, 2015 11:17 pm

mung wrote:I had a quick play with the download I posted on a b+ this afternoon, lots of things I forgot I did, can just about get a 3us base step period and still run axis gui but anything less and it will virtually lockup with gui refresh of about 1 second.

There are also some weird things I did with the step timing definitions like step space, hold time, dir hold, etc are all defined as multiples of the base step period and are char values so anything over 255 could cause strange behaviours (this was done to save data size moving around cache to main memory and also allow some of the ARM simd intrinsics like __qsub8 etc to save a few cycles in the stegen). Also accumulator was reduced to a 32bit long as I heard armv6 has slow 64bit ops.

None of it was really finished and I think the driver was substantially improved if I can find a later version in the backups I will release an update.

That said I will probably not bother as I have spent a little time looking at RT_PREEMPT on the rpi2 and it may be an easy job (or it may not :lol ) but if I get time next weekend I may be able to get something working on the rpi2 with highspeed stepgen maybe 1MHz and responsive gui and opencv processing.

All the work on the rpi1 was probably wasted :lol:
Have you had time to look at this? I think many people would be very interested in your results, me included.

sojka
Posts: 10
Joined: Fri Jan 03, 2014 6:38 pm

Re: LinuxCNC

Fri Mar 13, 2015 8:22 am

I built PREEMPT-RT for Raspberry 2,
from https://github.com/emlid/linux-rt-rpi and it's working.
LinuxCNC was compiled from this
http://wiki.linuxcnc.org/cgi-bin/wiki.p ... nomaiBuild

but picnc board is not connected. I think problem may be in picnc Broadcomm defines. Is somebody able to check?


Petr

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Sat Mar 14, 2015 2:57 am

The RT kernel isn't ok yet: http://comments.gmane.org/gmane.linux.rt.user/13057

I'm still waiting for a stable RT kernel before porting picnc.
42

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: LinuxCNC

Sun Mar 15, 2015 6:43 pm

I have not had enough time to look at linuxcnc any further(since last post I made here, or linuxcnc.org, not sure seems like a 4 or a few weeks), was hoping to try a little work this weekend, but have been trying to get to the bottom of stability issues. I have only got as far as getting a new SD card and just installed raspbian this morning, I am going to do memtester and some cpu stress tests on a stock image on a brand new tested SD card to try and be certain the system is not faulty.

I got machinekit running on RT_PREEMPT a few weeks ago and found no stability issues (or at least none compared to a stock kernel), I had no lockups running axis for over 8 hours(actually never locked once while running linuxcnc or axis), but had lockups even on a stock kernel when trying large compile jobs. The RT_PREEMPT numbers are not much better than on a rpi1 (about 120us worst on cyclictest, I think the average was 17us? memory fails me though), but that is I assume mostly due to USB.

In general use axis gui seems really snappy even without opengl accel and there is plenty (more than on rpi1) of cpu cycles for opencv analysis.

Unfortunately software stepgen still will need a vc4 driver to get 1MHz speeds (I think 120us is about 8KHz?), but the extra processing available will mean lots more options for the less real time tasks like opencv, gui, path, task and traj planning etc.

I guess if stepgen basethread is offloaded then servo thread should easily run at 200us.

Unfortunately I still not got round to finish testing, once I have completed test I will start work on the drivers needed for the rpi2, but doubt that will happen until next weekend now, I am going to leave the rpi2 running for a couple of days and see if it crashes.

It will get done eventually but I have other stuff to do so may take some weeks to find enough time, or maybe someone else will beat me to it, compiling the RT kernel and machinekit is very easy now, all the instructions are available.

If anyone is really really interested I maybe can try and pack up the binarys I made, but that will probably take at least an hour to move the libs and stuff and write a script to put them in correct paths, and rather a waste of my time as there are no drivers yet.

If someone wants to put the effort in to do some work and needs a little help to get started I could write up, but that in itself suggests that my effort would be wasted (anyone that could not workout how to get everything compiled probably is not talented enough to do any useful work on the project anyways :lol: ).

So I don't know what to do to get others working on this, other that tell everyone it is easy if you are willing to put a little time and effort into it. I am guessing getting the drivers working is about 4 solid hardcore non stop weekends worth of work (100+ hours), but actually getting free time and enough energy to code all weekend?

And finally I think that the rpi2 is probably the best platform available at the price for running linuxcnc vastly superior to the beaglebone (until they bring out something better).

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: LinuxCNC

Sun Mar 15, 2015 9:52 pm

Yeah, just had another system lockup on a totally fresh raspbian install to a new SD card and have tested with a number of alternative usb keyboards/mice. So my problems are either device specific fault or its a kernel issue that only I am seeing because of my particular system usage.

I was running memtester and X and some other bacground processes to put a little load on the system, it seems to be problems with SD, but I am not really knowledgable enough to know anything for sure.

Looks like it will be some more time before I get to start working on the linuxcnc stepgen driver, I will post when I get a working system and start hacking again.

markdoll01
Posts: 2
Joined: Wed Jun 18, 2014 8:36 pm

Re: LinuxCNC

Wed Apr 01, 2015 9:28 pm

Hi,

Just want to mention that a working RT kernel for the RPI2 was created by "carloscambra" from Navio and can be found here -" http://community.emlid.com/t/raspberry- ... age/112/44 "-

Seems to have been an issue with the USB driver and the RT kernel but it was patched now. I downloaded the image and installed LinuxCNC with a whole bunch of required libraries and apps for the PI to get X running and LinuxCNC. Don't have any hardware to test though except for the PI and DVD stepper motors :-( LinuxCNC opens just fine with the simulator ini files and the latency-test 100us 1ms .

First time using / opening LinuxCNC.

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Thu Apr 09, 2015 1:24 pm

Here's the Machinekit image for RPi2: http://0ptr.link/files/RPi2-machinekit-1.0.img.bz2

The default username is mk and the password is machinekit.

This image boots directly to X so you'll need an HDMI display to test.

Do note that this is still in alpha stage and that the PICnc driver is still being ported.

Cheers
Last edited by kinsa on Fri Apr 10, 2015 6:04 am, edited 1 time in total.
42

Wire
Posts: 78
Joined: Tue Sep 11, 2012 6:46 pm

Re: LinuxCNC

Thu Apr 09, 2015 2:05 pm

I thought the rpi2 was fast enough to do direct GPIO stepping at 1MHz based on previous posts is that not correct? If so what are the advantages of using a rpi2 over a rpi? With the rpi2 and the 80MHz pic what is the fastest step gen do you think it will support?

Thanks,

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Thu Apr 09, 2015 2:48 pm

It's not an issue about how fast the processor can toggle an I/O pin. The issue is the interrupt latency. Arm boards have typical latencies above 20 uSec, it cannot compete with x86 boards with regards to software stepgen. Although software stepgen is limited to below 40kHz step rates.

The only advantage of RPi2 is that now you can have a standalone solution. You can connect a monitor and have access to the GUI locally with all the graphical bells and whistles that the GUI provides without taxing the processor to a crawl.

The RPi2 is more of an upgrade to the front-end. The internals and the step generator is still the same.

If you really need high step rates, then your only option is to use fpga boards. Such as this one: http://store.mesanet.com/index.php?rout ... uct_id=291

I have one fpga board designed for RPi but I haven't had the time to play with it yet.

:)
42

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Fri Apr 10, 2015 6:10 am

I've ported the picnc driver to work with RPi2. The firmware is also updated so you'll need to reflash the firmware before using the latest HAL driver.

The sdcard image is updated as well.

Here's the cyclictest result of the preempt-rt kernel while axis is running:
latency.png
latency.png (35.6 KiB) Viewed 8237 times

Code: Select all

# Total: 009466495 009466451 009466406 009466360
# Min Latencies: 00014 00013 00013 00013
# Avg Latencies: 00035 00029 00026 00025
# Max Latencies: 00348 00156 00136 00169 
# Histogram Overflows: 00000 00000 00000 00000
The max latency is a bit high, but so far machinekit is running OK.
42

Wire
Posts: 78
Joined: Tue Sep 11, 2012 6:46 pm

Re: LinuxCNC

Fri Apr 10, 2015 12:30 pm

Happen to know how that compares to the BBB using the SPUs?

Also what changes did you need to make in the firmware? currently running a fork with a bunch of changes for my laser cutter setup. Just trying to decide if it would be easier to port your changes to mine or to grab your latest and just start over.

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Fri Apr 10, 2015 2:06 pm

Think of the PIC32 as the PRUs of the BBB. Except it's not as fast.

These are the firmware changes:
https://github.com/kinsamanka/PICnc-V2/ ... a9a72bb41c
https://github.com/kinsamanka/PICnc-V2/ ... 12d8d3a0b6
42

Wire
Posts: 78
Joined: Tue Sep 11, 2012 6:46 pm

Re: LinuxCNC

Fri Apr 10, 2015 3:35 pm

Yep knew that part. What I was asking is if there were any benchmarks between the two. Trying to decide if I want to continue down the PICnc path and buy a new RPI2 (only have a first gen RPI right now) or just go buy a BBB and use that for the project.

Just looking to see what the delta in max step gen for 3+ axis is between the two.

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Fri Apr 10, 2015 3:41 pm

The step rates will still be the same as it is still the same hardware step generator.

RPi 2 will only bring improvements on the UI and the rest of the system. It will not improve on the step rates.
42

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Fri Apr 10, 2015 5:21 pm

Wire wrote:I thought the rpi2 was fast enough to do direct GPIO stepping at 1MHz based on previous posts is that not correct? If so what are the advantages of using a rpi2 over a rpi? With the rpi2 and the 80MHz pic what is the fastest step gen do you think it will support?

Thanks,
The 80 MHz pic will give you 80 kHz step rates per channel.

There's also the 200 MHz PIC32s, which could theoretically reach 200 kHz.
42

larry104
Posts: 14
Joined: Sun Jun 09, 2013 8:34 pm

Re: LinuxCNC

Fri Apr 10, 2015 10:03 pm

Hi Kinsa,

I like to give this a try - could you send me a PM in case you have a PICnc-V2-LPT boards left.
Thanks!

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Tue Apr 14, 2015 6:14 am

Just an update, the HAL driver is now updated to support the 1st gen RPi, RPi 2 and Odroid C1 boards.

The 1/2 scale issue that was reported by bfree is now fixed. Please make sure to update the SCALE parameter on your ini file if your'e using the latest HAL version. There's no need to update the picnc firmware for this fix.

Cheers.
42

Return to “Automation, sensing and robotics”