er85
Posts: 8
Joined: Fri May 15, 2015 3:29 pm

Re: LinuxCNC

Tue Aug 04, 2015 4:06 am

Nice work. I need 4 axis (X1, X2, Y, Z) and inputs from a torch height controller for a plasma cutter. I think I miss 3 inputs but I have plans to extend it with a rotating axle in the future.

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

Re: LinuxCNC

Tue Aug 04, 2015 4:16 am

If X1 and X2 are synchronous (ie never are moved independently) you can get away with a 3 axis board. If your going with external stepper drivers my board would do it. Downside is the firmware as I have a few projects that need to get done before I can get back to the code.

er85
Posts: 8
Joined: Fri May 15, 2015 3:29 pm

Re: LinuxCNC

Thu Aug 06, 2015 2:29 am

I need to home the X-motors individually. I think I will solve this I/O-problem by mounting an external board like an Arduino in the plasma cutting unit to handle signals over a USB serial port as these should not require the same accuracy as stepping signals. Then the I/O's should be enough for a 5-axis machine with a single picnc board. :)

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

Re: LinuxCNC

Thu Aug 06, 2015 4:06 am

You can also use the RPi gpio. There's already a HAL gpio driver that would suit your needs as long as the signals don't need fast real time access.
42

er85
Posts: 8
Joined: Fri May 15, 2015 3:29 pm

Re: LinuxCNC

Mon Aug 10, 2015 7:21 am

It wasn't easy but finally I got the PICnc board running! And now I'm almost finished programming the basics of the plasma control unit including HAL-driver and it seems to work pretty well. It reads signals with 100hz but up to 500hz or so should be possible at 115200bps.

Just a tip: I use XMing to show the X window on my PC while working on the Pi.. very nice. :) Just enable X11 forwarding in putty, start XMing and type "startlxde" in the ssh window.

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

Re: LinuxCNC

Tue Aug 11, 2015 8:27 pm

Did anyone get linuxcnc/RT Kernel to work on the new Raspi2 yet - if yes, could you quickly elaborate what steps you did?

Thanks a bunch!

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

Re: LinuxCNC

Wed Aug 12, 2015 4:39 am

Here's an image running preempt_rt kernel: http://0ptr.link/files/RPi2-machinekit-1.0.img.bz2

I haven't worked on it for a while as my RPi2 was repurposed as a media server ;)
42

cncwood
Posts: 24
Joined: Fri Feb 28, 2014 10:17 pm

Re: LinuxCNC

Tue Aug 25, 2015 8:08 am

hi Kinsa!

I already have a cnc with a raspberry + FRDM-KL25Z and linuxcnc -
this works wonderfully.

Does this combination with the new Raspberry Pi 2 Model B?
Is the expiration of the installation the same?

Thanks

kangus
Posts: 18
Joined: Tue Aug 07, 2012 12:05 am

Re: LinuxCNC

Fri Aug 28, 2015 7:41 pm

cncwood wrote:I already have a cnc with a raspberry + FRDM-KL25Z and linuxcnc -
this works wonderfully.
Thanks
More Info on the FRDM-KL25Z please! I have several of those laying around.

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

Re: LinuxCNC

Sun Sep 20, 2015 12:54 am

cncwood wrote:hi Kinsa!

I already have a cnc with a raspberry + FRDM-KL25Z and linuxcnc -
this works wonderfully.

Does this combination with the new Raspberry Pi 2 Model B?
Is the expiration of the installation the same?

Thanks
Sorry for the late reply, Google tagged the notification as spam :-/

Just add 0x1F000000 to
BCM2835_PERI_BASE when working on RPi2
(https://github.com/kinsamanka/PICnc-V2/ ... .h#L79-L80).
42

cncwood
Posts: 24
Joined: Fri Feb 28, 2014 10:17 pm

Re: LinuxCNC

Thu Sep 24, 2015 10:34 am

hi kinsa,

Thanks for your answer!

Do I have the FRDM board recompile?

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

Re: LinuxCNC

Thu Sep 24, 2015 12:46 pm

There's no change to the firmware, only the hal driver needs to be updated.
42

jam1
Posts: 47
Joined: Tue Oct 21, 2014 5:51 pm

Re: LinuxCNC

Sun Sep 27, 2015 7:16 pm

Hi all,
I just dowloaded a machinekit ( rpi-machinekit-1.0.img.bz2) image for Rpi B+ . The Pi is booting fine but I cannot login using
login: mk
password: machinekit

Is there another way to log into the system? I tried both with SSH and directly.

Secondly, does the Rpi2 image works on the B+ ?

Thanks

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

Re: LinuxCNC

Sun Sep 27, 2015 11:15 pm

It's pi/raspberry for that image.

The RPi2 image only works for version 2 and vice-versa.
42

jam1
Posts: 47
Joined: Tue Oct 21, 2014 5:51 pm

Re: LinuxCNC

Mon Sep 28, 2015 10:01 am

Thank you very much, it was not clear from the instructions or from any forum posts that I could find.
To login in, I did
ssh -X [email protected]
pw :raspberrypi

but the login prompt is
[email protected]:~$

It works beautifully in simulation mode. Now I have a lot to learn.

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

Re: LinuxCNC

Mon Sep 28, 2015 10:58 am

There's a link to the wiki on the first post.

Good luck, let us know how it goes.

Cheers.
42

jam1
Posts: 47
Joined: Tue Oct 21, 2014 5:51 pm

Re: LinuxCNC

Tue Sep 29, 2015 1:13 am

Now for the next step, I want to connect to the driver board from Adafruit MotorShield V2. It needs to be driven by I2C and so far I did not find much info on how to do that. Most pins definitions in HAL devices do not used SDA/SCL signals. I have the drivers written in C from Rpi and Adafruit. From what I understand, it needs to be a module which HAL can execute. There is a python file about the PCA9685 but I would like to use the C version. Is there a procedure to make that into a module without having to compile the whole machinekit from source? And I would like to do that on the Rpi itself.

thanks

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

Re: LinuxCNC

Tue Sep 29, 2015 2:03 am

AFAIK, no one has used I2C for motor control on machinekit as the interface is slow. Machinekit needs to control the drives every millisecond, at minimum, to achieve realtime control.

There's not enough bandwidth available for I2C that's why the SPI interface is used by PICnc board.
42

jam1
Posts: 47
Joined: Tue Oct 21, 2014 5:51 pm

Re: LinuxCNC

Wed Sep 30, 2015 12:46 pm

Ok. A little progress here but still some problems.

With all the following done on the Pi.
I did follow the instruction to compile from source as describe here http://www.machinekit.io/docs/building-from-source/

First, I have the machinekit binary installed on the SD card. The card has now 2 partition with on 6 GB partition empty. I formatted this with ext4. After booting from this card, I mounted this third partition to /home/pi/machinekit and started the long process of setting up for compiling. Note that some files did not have proper key signature in which cases I had to bypass the approval. After a while the complete program was compiled. I may have missed some steps or this is not possible to do on the Pi, but after running linuxcnc, the first screen appears and then the next process stop saying this :

Code: Select all

[email protected]:~/machinekit/machinekit$ linuxcnc
MACHINEKIT - 0.1
Machine configuration directory is '/home/pi/machinekit/machinekit/configs/sim/axis'
Machine configuration file is 'axis_rostock.ini'
Starting Machinekit...
/home/pi/machinekit/machinekit/scripts/realtime: line 168:  5697 Illegal instruction     ${rtapi_msgd} --instance=$INSTANCE $NAME_CMD --rtmsglevel=$DEBUG --usrmsglevel=$DEBUG --halsize=$HAL_SIZE $MSGD_OPTS
rtapi_msgd startup failed - aborting
even with halrun

Code: Select all

[email protected]:~/machinekit/machinekit$ halrun
msgd:0 stopped
rtapi:0 stopped
/home/pi/machinekit/machinekit/scripts/realtime: line 168:  5852 Illegal instruction     ${rtapi_msgd} --instance=$INSTANCE $NAME_CMD --rtmsglevel=$DEBUG --usrmsglevel=$DEBUG --halsize=$HAL_SIZE $MSGD_OPTS
rtapi_msgd startup failed - aborting
/home/pi/machinekit/machinekit/scripts/realtime: line 168:  5854 Illegal instruction     ${rtapi_app} --instance=$INSTANCE $RTAPI_APP_OPTS
rtapi_app startup failed - aborting
/home/pi/machinekit/machinekit/scripts/realtime: line 168:  5856 Illegal instruction     halcmd ping
/home/pi/machinekit/machinekit/scripts/halrun: line 150:  5857 Illegal instruction     $INTERACTIVE
/home/pi/machinekit/machinekit/scripts/halrun: line 152:  5858 Illegal instruction     halcmd stop
/home/pi/machinekit/machinekit/scripts/halrun: line 153:  5859 Illegal instruction     halcmd unload all
It seems that rtapi is not loaded and I cannot load it.

Now, if I go back to the original /usr/bin/halrun, it gives the same response.

Should I give up on this method of only using the Pi to compile machinekit? I do NOT want to crosscompile from my desktop.

Some guidance required

Thanks again

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

Re: LinuxCNC

Wed Sep 30, 2015 2:46 pm

I haven't checked the docs for a while but it looks like you're compiling for a different arm instruction set.

You don't really need to compile machinekit to create a hal driver. You can compile out of tree drivers using the comp command. More info can be found here: https://github.com/machinekit/machineki ... p.asciidoc
42

jam1
Posts: 47
Joined: Tue Oct 21, 2014 5:51 pm

Re: LinuxCNC

Wed Sep 30, 2015 2:50 pm

That's what I thought first but with the binary, comp is not included

Code: Select all

[email protected]:~$ halrun
rtapi:0 stopped
msgd:0 stopped
halcmd: comp
<stdin>:1: Unknown command 'comp'
halcmd: 
halcmd: exit
[email protected]:~$ comp
-bash: comp: command not found
[email protected]:~$ 
if I try to get comp

Code: Select all

[email protected]:~$ sudo apt-get install machinekit-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package machinekit-dev

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

Re: LinuxCNC

Wed Sep 30, 2015 3:17 pm

Did you use my repository? More info here

The debs can be found here.
42

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

Re: LinuxCNC

Wed Sep 30, 2015 3:20 pm

42

jam1
Posts: 47
Joined: Tue Oct 21, 2014 5:51 pm

Re: LinuxCNC

Wed Sep 30, 2015 6:14 pm

Success!

I had to start from a fresh install of raspbian wheezy image.

Except for a small error in one of your script

sudo sh -c 'echo "deb http://0ptr.link/raspbian wheezy main' > \
/etc/apt/sources.list.d/rpi-machinekit.list"

which should be

sudo sh -c "echo 'deb http://0ptr.link/raspbian wheezy main' > \
/etc/apt/sources.list.d/rpi-machinekit.list"

comp finally works
Thanks

jam1
Posts: 47
Joined: Tue Oct 21, 2014 5:51 pm

Re: LinuxCNC

Fri Oct 02, 2015 4:35 pm

Some progress on my setup of trying to use machinekit with the Pi controlling the steeper driver A4988 directly.

First, I found that there is a hal_gpio driver in the machinekit-master git. I just copied it to my setup and by doing loadrt hal_gpio inside halrun , I have control of the io pins on the rpi.

Secondly, by looking at the parallel port driver *hal and *ini files, I had the idea of just changing the pin definition to match the new hal_gpio pin name and it works.

So far, I was able to start machinekit and by removing the estop and turning the machine on, I saw vith a voltmeter and the hal watch screen that the pin states are in fact changing.

I was very happy to see that.
Now, I have to make a stepper motor runs.

Return to “Automation, sensing and robotics”