LinuxCNC


580 posts   Page 1 of 24   1, 2, 3, 4, 5 ... 24
by kinsa » Fri Feb 15, 2013 2:57 pm
Hi,

I have successfully managed to control a small MF70 CNC mill using RPi running LinuxCNC with a Xenomai kernel using a PIC32 based add-on card.

Here is the youtube link: http://youtu.be/WLIo7TA82xE

Details on how to create a customized Raspbian image is here: http://wiki.linuxcnc.org/cgi-bin/wiki.p ... nomaiBuild

Details on the add-on card will follow.

Regards,

Kinsa

Image

UPDATES:
Instructions on how to run Machinekit/Linuxcnc is on this page
Last edited by kinsa on Fri Sep 19, 2014 8:11 am, edited 3 times in total.
42
Posts: 290
Joined: Sat Dec 01, 2012 10:16 pm
by MrGreg » Fri Feb 15, 2013 9:30 pm
looks V good, V impressed... :)

Really looking forward to the details on the PIC. I hope to try it out as soon as practical

I had been following the thread on the Linuxcnc forum with mixed feelings, but you seem to have cracked it.

Many thanks for your work and post
Posts: 47
Joined: Sun Jun 10, 2012 7:25 pm
by kinsa » Mon Feb 18, 2013 9:07 am
Thanks!

I've setup a google code page here: http://code.google.com/p/picnc/
42
Posts: 290
Joined: Sat Dec 01, 2012 10:16 pm
by MrGreg » Thu Feb 21, 2013 12:01 am
@ kinsa

A few dumb questions...
1.
Would you post a higher res .png of the schematic here:
http://code.google.com/p/picnc/w/list
It's rather unreadable. The IO connections are really blurred. Looks like a PIC32mx 764...??
Also any suggestions for a stock dev board to mount the PIC

2.
Loaded up your xenomai image and ran the tests as per:
http://wiki.linuxcnc.org/cgi-bin/wiki.p ... ld#Testing
Xenomai latency ran OK and as expected

latency-test 100us 1ms
returned (over ssh):

rpi@rpi-linuxcnc:~$ latency-test 100us 1ms
Traceback (most recent call last):
File "/usr/local/bin/pyvcp", line 99, in <module>
main()
File "/usr/local/bin/pyvcp", line 81, in main
pyvcp0 = Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1712, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
Waiting for component 'lat' to become ready...
lat.hal:6: pyvcp exited without becoming ready
rpi@rpi-linuxcnc:~$


Is this to be expected at this stage in the project without further addition of software/hardware?

3.
Is it possible to run your RPi version of Linuxcnc in "sim" mode with/without "miniemc" to get a feel for how it runs without hardware attached?

If so... How?...What's needed? A guide for "dummies" would be good

Many thanks again
Posts: 47
Joined: Sun Jun 10, 2012 7:25 pm
by kinsa » Thu Feb 21, 2013 12:32 am
Hi,

1. I have updated the wiki with a link to the pdf file. You can use any PIC32 development boards. I have used a chipkit max32. A cheaper option would be the UBW32 board. You can use Arduino also but you'll be limited by the SPI speed. Actually any boards that has a high speed SPI interface will do.

2. You need to enable X11 forwarding in your ssh session. If you are using a unix based os, issue the following command: ssh -X -l rpi <ipaddress>.

3. Once you have enable X11 forwarding, just run "linuxcnc" and then select any of the configurations under the "sim" branch.

The miniemc2 web interface is not included; it is not yet ready.

Good luck!
42
Posts: 290
Joined: Sat Dec 01, 2012 10:16 pm
by MrGreg » Thu Feb 21, 2013 11:12 pm
Great, Thanks!

The .pdf version is readable now. I hope to get a board up and running at some point in the next few weeks.

The ssh command worked fine under Ubuntu and ran the std axis mm example in sim just fine.
However
Tried to run ssh with another RPi. It seemed to start up OK displaying the initial screens,Config Selector, Manual Tool changer, then fell over after choosing sim axis mm, returning the following:

rpi@rpi-linuxcnc:~$ linuxcnc
LINUXCNC - 2.5.1
Machine configuration directory is '/usr/local/share/doc/linuxcnc/examples/sample-configs/sim/axis'
Machine configuration file is 'axis_mm.ini'
Starting LinuxCNC...
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 3 (X_GetWindowAttributes)
Resource id in failed request: 0xffffffff
Serial number of failed request: 499
Current serial number in output stream: 500
Shutting down and cleaning up LinuxCNC...
Cleanup done
LinuxCNC terminated with an error. You can find more information in the log:
/home/rpi/linuxcnc_debug.txt
and
/home/rpi/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal
rpi@rpi-linuxcnc:~$ exit


I haven't investigated the logs as yet
Any ideas?
Posts: 47
Joined: Sun Jun 10, 2012 7:25 pm
by kinsa » Fri Feb 22, 2013 1:00 am
Were you running both at the same time? My WM crashes whenever I close one of the instance. :D

You can use any of the PIC32MX5XX/6XX/7XX chips.
42
Posts: 290
Joined: Sat Dec 01, 2012 10:16 pm
by MrGreg » Fri Feb 22, 2013 2:05 pm
Nope !
Just one at a time.
To expand on what happened:

Tried the std Pi to linuxcnc Pi a few times with reboots in between, and got the same result, as prev post. Re tested with Ubuntu to linuxcnc Pi, worked OK as before.

Then tried Win7 +Putty+Xming to linuxcnc PI. OOOOOOh..!! Took some faffing about to get it to sort of working not very well. No preview and V jumpy refresh and then crashed/locked up.

Tried again with Ubuntu, seemed to run OK, but believe bad exit from Windows session corrupted axis.ini/sample gcode. All manner of errors relating to limits, etc.

Wiped linuxcnc Pi card and reloaded:

Re tried std Pi to linuxcnc Pi, much the same result? as before.
Re tried Ubuntu to linuxcnc Pi. As before, worked OK

For Ref info & logs
1. Terminal output

rpi@rpi-linuxcnc:~$ linuxcnc
LINUXCNC - 2.5.1
Machine configuration directory is '/usr/local/share/doc/linuxcnc/examples/sample-configs/sim/axis'
Machine configuration file is 'axis_mm.ini'
Starting LinuxCNC...
No option 'tto_g11' in section: 'DEFAULT'
No option 'show_program' in section: 'DEFAULT'
No option 'show_rapids' in section: 'DEFAULT'
No option 'program_alpha' in section: 'DEFAULT'
No option 'show_live_plot' in section: 'DEFAULT'
No option 'show_tool' in section: 'DEFAULT'
No option 'show_extents' in section: 'DEFAULT'
No option 'show_offsets' in section: 'DEFAULT'
No option 'show_machine_limits' in section: 'DEFAULT'
No option 'show_machine_speed' in section: 'DEFAULT'
No option 'show_distance_to_go' in section: 'DEFAULT'
No option 'dro_large_font' in section: 'DEFAULT'
No option 'block_delete' in section: 'DEFAULT'
No option 'optional_stop' in section: 'DEFAULT'
No option 'recentfiles' in section: 'DEFAULT'
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 3 (X_GetWindowAttributes)
Resource id in failed request: 0xffffffff
Serial number of failed request: 499
Current serial number in output stream: 500
Shutting down and cleaning up LinuxCNC...
Cleanup done
LinuxCNC terminated with an error. You can find more information in the log:
/home/rpi/linuxcnc_debug.txt
and
/home/rpi/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal
rpi@rpi-linuxcnc:~$




2. Linuxcnc_debug file

Can not find -sec MOT -var MOT -num 1
Can not find -sec IO -var IO -num 1
Can not find -sec LINUXCNC -var NML_FILE -num 1
Can not find -sec EMC -var NML_FILE -num 1
1586
PID TTY STAT TIME COMMAND
1629
PID TTY STAT TIME COMMAND
1629 pts/0 S+ 0:06 milltask -ini /usr/local/share/doc/linuxcnc/examples/sample-configs/sim/axis/axis_mm.ini
PID TTY STAT TIME COMMAND
Stopping realtime threads
Unloading hal components


3. linuxcnc_print

RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/local/bin
LINUXCNC_TCL_DIR=/usr/local/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/linuxcnc
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/local/share/linuxcnc/tcl/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.5
INIFILE=/usr/local/share/doc/linuxcnc/examples/sample-configs/sim/axis/axis_mm.ini
PARAMETER_FILE=sim_mm.var
TASK=milltask
HALUI=halui
DISPLAY=axis
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
Starting HAL User Interface program: halui
Starting TASK program: milltask
Starting DISPLAY program: axis
Killing task linuxcncsvr, PID=1586
Killing task milltask, PID=1629
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments


So any thoughts / ideas?

Anyone else tried Stock std (Raspbian) Pi to host Linuxcnc Pi?

( PS...Cheers for the info on the PIC chip options)
Posts: 47
Joined: Sun Jun 10, 2012 7:25 pm
by kinsa » Fri Feb 22, 2013 4:52 pm
To be honest, we are on the bleeding edge here :). This is not a normal use case for linuxcnc.

I think the problem is with the axis gui and or the Xming settings.

Please try the mini interface and tklinux, if both works then we can file a bug report.

Regards.
42
Posts: 290
Joined: Sat Dec 01, 2012 10:16 pm
by MrGreg » Fri Feb 22, 2013 10:06 pm
kinsa wrote:To be honest, we are on the bleeding edge here :). This is not a normal use case for linuxcnc.

.


:) :) :) !

I was rather hoping some of the other 500+ readers of this post might have taken it for a test drive and thrown in comments/impressions/experiences/etc

Anyways...

Briefly tried "mini" interface It runs OK Pi to Pi :) Circa 20 - 30% cpu with backplot
So that's Good!

Not fussed about spending time messing with Xming at the mo. I was just curious to see if it worked on a Win host.

I'll try Tk and some other gcode files and generally tinker about with it to get a better picture of what's going on over the next few days.

Looking V good so far!

Cheers
Posts: 47
Joined: Sun Jun 10, 2012 7:25 pm
by kinsa » Sat Mar 02, 2013 12:22 am
The board arrived yesterday :)

Image
42
Posts: 290
Joined: Sat Dec 01, 2012 10:16 pm
by MrGreg » Sun Mar 03, 2013 10:37 pm
The board...


Will there be more, like a volume for resale?
If so, do you have an outline capability spec & price point in mind?

BTW Looks V good...!

Do tell us more
Posts: 47
Joined: Sun Jun 10, 2012 7:25 pm
by kinsa » Mon Mar 04, 2013 1:21 am
MrGreg wrote:Will there be more, like a volume for resale?

I haven't thought about it yet. This is still under development ;)

BTW, BOM and gerber files are in the repository for those interested in building this board.

Cheers!
42
Posts: 290
Joined: Sat Dec 01, 2012 10:16 pm
by TonyD » Mon Mar 04, 2013 1:50 pm
Nice looking board. What PIC is on it?
Tony
User avatar
Posts: 341
Joined: Thu Sep 08, 2011 10:58 am
Location: Newcastle, UK
by kinsa » Mon Mar 04, 2013 11:46 pm
TonyD wrote:Nice looking board. What PIC is on it?

It's a PIC32MX764F128H.
42
Posts: 290
Joined: Sat Dec 01, 2012 10:16 pm
by kinsa » Thu Mar 07, 2013 1:01 pm
MrGreg wrote:Great, Thanks!

The .pdf version is readable now. I hope to get a board up and running at some point in the next few weeks.

The ssh command worked fine under Ubuntu and ran the std axis mm example in sim just fine.
However
Tried to run ssh with another RPi. It seemed to start up OK displaying the initial screens,Config Selector, Manual Tool changer, then fell over after choosing sim axis mm, returning the following:

rpi@rpi-linuxcnc:~$ linuxcnc
LINUXCNC - 2.5.1
Machine configuration directory is '/usr/local/share/doc/linuxcnc/examples/sample-configs/sim/axis'
Machine configuration file is 'axis_mm.ini'
Starting LinuxCNC...
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 3 (X_GetWindowAttributes)
Resource id in failed request: 0xffffffff
Serial number of failed request: 499
Current serial number in output stream: 500
Shutting down and cleaning up LinuxCNC...
Cleanup done
LinuxCNC terminated with an error. You can find more information in the log:
/home/rpi/linuxcnc_debug.txt
and
/home/rpi/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal
rpi@rpi-linuxcnc:~$ exit


I haven't investigated the logs as yet
Any ideas?


Try installing libgl1-mesa-swx11
42
Posts: 290
Joined: Sat Dec 01, 2012 10:16 pm
by MrGreg » Thu Mar 07, 2013 9:24 pm
Well that worked...!

The sim Axis GUI now runs Pi to Pi, if a little slow and notchy on the backplot. (to be expected given that it is running remote) Client gui Pi is at about 60+% cpu

Many thanks again !

How's the custom "PICnc" development board working out? I'm looking forward to doing a real evaluation on hardware at some point in the future.

Do keep us updated & thanks again

Cheers
Posts: 47
Joined: Sun Jun 10, 2012 7:25 pm
by kinsa » Fri Mar 08, 2013 1:35 am
Any of the python based UI are cpu hogs. I think it needs to be optimized for this architecture.

The mini interface with backplot works fine as long as the output doesn't get too complex. A reset on the output solves the issue.

I'm nowhere near my machine at the moment so hardware development is on hold. If you're interested, I still have some bare ver A0 PCBs. I can arrange to have it shipped to you.

Regards
42
Posts: 290
Joined: Sat Dec 01, 2012 10:16 pm
by MrGreg » Fri Mar 08, 2013 9:30 pm
I think that is a Big Yes Please!

Would you PM me, and let me know how to proceed. I would be more than happy to cover shipping and other expenses.

Cheers...!
Posts: 47
Joined: Sun Jun 10, 2012 7:25 pm
by kinsa » Wed Mar 13, 2013 1:18 pm
Here's the schematic of the reprap pololu board using a 28-pin DIP PIC32:

http://picnc.googlecode.com/git/hardware/PICnc_Jr.pdf

Note that this is not yet tested.

Cheers!
42
Posts: 290
Joined: Sat Dec 01, 2012 10:16 pm
by buildrob » Mon Mar 18, 2013 9:30 am
This is an interesting project - someone just sent me link to it (thanks Lars).

I was proposing something somewhat related in the reprap forums:
http://forums.reprap.org/read.php?147,189757

I had in mind that the Pi-based Reprap software interface could be written with a sufficient generalised SPI interface that you could also connect an existing Arduino based controller board (eg, via SPI or I2C) to do the same as your PIC board.

I'm not suggesting you shouldn't proceed with the PICnc shield but this would expand the applicability of the project. This way there is a massive pool of potential users who can start using your Pi project without throwing away their current Arduino controller hardware.
Posts: 2
Joined: Sun Mar 17, 2013 12:21 pm
by kinsa » Mon Mar 18, 2013 11:38 am
Hi,

The PIC32 was chosen due to the tight realtime demands of LinuxCNC. Specifically, the presence of rx/tx spi buffers and the DMA was the reason why this board works.

I think arduino would work if we take out the realtime component of LinuxCNC and just reuse the gcode interpreter. It's the same what rtstepper had done except using the SPI interface instead of the usb port.

BTW, PIC32 runs the SPI as slave at ~16 MHz clock speed. At this speed the data throughput approaches that of the PC lpt port.

(Note: Here is a post that shows why using an avr as an spi slave at high speed is not easy).

Cheers!
42
Posts: 290
Joined: Sat Dec 01, 2012 10:16 pm
by buildrob » Mon Mar 18, 2013 12:00 pm
Ahh ok I see - yeah that's pretty impressive if you can drive it at that SPI speed using DMA transfers as well.

Yeah that's not something you're going to get with an Arduino. At that transfer rate you could pretty much drive them directly from the rPI side (although I imagine you can do some neat tricks with the DMA interface). Do you have any description of your interface between the two boards?
Posts: 2
Joined: Sun Mar 17, 2013 12:21 pm
by kinsa » Mon Mar 18, 2013 12:57 pm
buildrob wrote:Ahh ok I see - yeah that's pretty impressive if you can drive it at that SPI speed using DMA transfers as well.

Yeah that's not something you're going to get with an Arduino. At that transfer rate you could pretty much drive them directly from the rPI side (although I imagine you can do some neat tricks with the DMA interface). Do you have any description of your interface between the two boards?


BTW, I'm referring to the PIC32 DMA.

Are you referring to the communication protocol or the hardware interface?

If hardware, it is just a normal SPI interface; 1 clk, 2 data bus and a chip select. The chip select is omitted on the smaller board (PICnc Jr) due to lack of pins. The uart is used for firmware upgrades and a set of i/o is used for handshaking.

There is no formal communication protocol yet as everything is still in a state of flux. The SPI sends and receives data at the same time and the system is configured to transfer 64 bytes at one go (this is the max RPi buffer size). This is done every 1ms. Currently only position commands and position feedback are being transferred. Each command/feedback is 4 bytes long, so there is still a lot of unused space.
42
Posts: 290
Joined: Sat Dec 01, 2012 10:16 pm
by MrGreg » Fri Mar 22, 2013 10:42 pm
@ Kinsa

What is the situation with updates & upgrades

I'm guessing "updates" OK?
"upgrades" Not! OK?

I'm re running some tests (again.. :( !) on a fresh install and by force of habit ran a update.

Also
Running some tests with lxde installed, (again) which also involve selective related upgrades by default. Do you see a problem with this?
Posts: 47
Joined: Sun Jun 10, 2012 7:25 pm