n9wxu
Posts: 6
Joined: Fri Dec 18, 2015 4:40 am

Re: LinuxCNC

Fri Dec 18, 2015 8:48 pm

A PIC32 runs approximately 1MIPS/MHz. @ 80Mhz it takes 3.5uS to perform 4 channels of step/direction. A better estimate of instruction count is 70 instructions per channel.
Some of the instructions are interrupt overhead. I still think there are some savings possible.

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

Re: LinuxCNC

Sat Dec 19, 2015 10:39 pm

Great work :)

I'll put your contributions on a separate branch as this is a totally different version.

I haven't read the code yet but the stepgen code of V2 was kept that way so that it will be a drop-in replacement of the original software-based stepgen.

If we would be interfacing with new stepper drivers only then a lot of the old code can be stripped out.

Cheers.
42

n9wxu
Posts: 6
Joined: Fri Dec 18, 2015 4:40 am

Re: LinuxCNC

Sat Dec 19, 2015 11:22 pm

I can place everything back into stepgen... now that this version is working, it can go back easily. Then the core timer abstraction doesn't change.
I did refactor the getters/setters to stepgen to separate the SPI data format from the stepgen implementation. This will simplify the later change to USB.

The bulk of the hardware change is actually in the header file. I did rename that v3.

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

Re: LinuxCNC

Sun Dec 20, 2015 1:53 am

Usb is not a realtime interface.

Machinekit/linuxcnc will not work with usb for realtime control.
42

n9wxu
Posts: 6
Joined: Fri Dec 18, 2015 4:40 am

Re: LinuxCNC

Sun Dec 20, 2015 2:08 am

Just posted an update. 200khz step rate on all 4 axis.
I also made changes to HAL to match the step generator.
I have not tested the PWM's and the inputs yet.
There are additional inputs on my hardware and I have not enabled those.

candangelen
Posts: 3
Joined: Mon Dec 28, 2015 6:26 am

Re: LinuxCNC

Mon Dec 28, 2015 7:13 am

EDIT:
Hi everyone, I bought a cnc router 3020 with a motor driver unit.
The motor driver unit has a parallel port input.
Do any of you know? How do I connect motor driver unit to FRDM-KL25Z.
Is there any FRDM-KL25Z's pin connection schema for parallel input.
Last edited by candangelen on Tue Dec 29, 2015 3:41 am, edited 1 time in total.

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

Re: LinuxCNC

Mon Dec 28, 2015 10:47 pm

candangelen wrote:Hi everyone, I bought a cnc router 3020 with a motor driver unit.
The motor driver unit has a parallel port input.
Do any of you know? How do I connect motor driver unit to FRDM-KL25Z.
Is there any FRDM-KL25Z's pinout schema for parallel input.

Think you have the wrong thread. The PICnc uses a Microchip micro vs the FRDM-KL25Z is a freescale device. The firmware and device pinouts are not interchangeable.

candangelen
Posts: 3
Joined: Mon Dec 28, 2015 6:26 am

Re: LinuxCNC

Tue Dec 29, 2015 3:12 am

Wire wrote:
candangelen wrote:Hi everyone, I bought a cnc router 3020 with a motor driver unit.
The motor driver unit has a parallel port input.
Do any of you know? How do I connect motor driver unit to FRDM-KL25Z.
Is there any FRDM-KL25Z's pinout schema for parallel input.

Think you have the wrong thread. The PICnc uses a Microchip micro vs the FRDM-KL25Z is a freescale device. The firmware and device pinouts are not interchangeable.
Thank you for your response. I understand that.
Do you know? Can I connect the motor driver unit to Raspberry pi + linux cnc?
If that is possible, what do I need? Regards.

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

Re: LinuxCNC

Tue Dec 29, 2015 3:37 am

I think only cncwood has a working FRDM-KL25Z at the moment.

You will need to add a buffer/driver between the KL25Z and your stepper driver. The board cannot drive them directly.

I would suggest that you build the PICnc-V2 board as the effort will be the same. You can use a perf board if you don't have the pcb.

The KL25Z port was a proof of concept only. If you don't know how to modify the firmware to fit your needs, I would suggest that you stick to PIC32.

Cheers
42

candangelen
Posts: 3
Joined: Mon Dec 28, 2015 6:26 am

Re: LinuxCNC

Tue Dec 29, 2015 4:08 am

kinsa wrote:I think only cncwood has a working FRDM-KL25Z at the moment.

You will need to add a buffer/driver between the KL25Z and your stepper driver. The board cannot drive them directly.

I would suggest that you build the PICnc-V2 board as the effort will be the same. You can use a perf board if you don't have the pcb.

The KL25Z port was a proof of concept only. If you don't know how to modify the firmware to fit your needs, I would suggest that you stick to PIC32.

Cheers
Thank you for your help,
I decided. I will build a PICnc-V2 board.
Regards.

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

Re: LinuxCNC

Tue Dec 29, 2015 5:29 am

candangelen wrote: Thank you for your response. I understand that.
Do you know? Can I connect the motor driver unit to Raspberry pi + linux cnc?
If that is possible, what do I need? Regards.
The information you need is on the first post.
42

gmarconi2
Posts: 1
Joined: Sat Jan 02, 2016 9:56 pm

Re: LinuxCNC

Sat Jan 02, 2016 10:09 pm

Thank you all
Thanks to you I was able to use LinuxCNC raspberry 2 using hal_gpio with debian MachineKit
I would use Picnc v2, where I can buy a card that is already assembled, without implementing it yourself.

I can use a mesa 7i90 spi

greetings Giampiero

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

Re: LinuxCNC

Wed Jan 06, 2016 2:47 pm

I don't sell boards, please check with bfree if he will supply just the completed board only.

His page is here.
42

xt550
Posts: 12
Joined: Sun Mar 23, 2014 12:44 pm

Re: LinuxCNC

Sat Jan 09, 2016 2:07 pm

Happy new year!
Where is the latest picnc.hex (pic32mx150f128b.cfg) file for a V2 card ?
or
do i use the picnc.hex as per https://github.com/kinsamanka/PICnc-V2/ ... e-Firmware?
When i do i get the following:
[email protected]:/usr/local/PICnc-V2/firmware$ make
/usr/local/pic32-tools/bin/pic32-gcc -EL -g -mips32r2 -mprocessor=32MX150F128B -O3 -Wextra -Wall -fno-exceptions -ffunction-sections -fdata-sections -mno-smart-io -O -I. -I. -MT main.o -MD -MP -MF .deps/main.dep -c -o main.o main.c
/usr/local/pic32-tools/bin/pic32-gcc: 1: /usr/local/pic32-tools/bin/pic32-gcc: Syntax error: "(" unexpected
make: *** [main.o] Error 2

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

Re: LinuxCNC

Sat Jan 09, 2016 11:33 pm

What OS and compiler version are you using?

You can use the pre-compiled to flash your board.
42

xt550
Posts: 12
Joined: Sun Mar 23, 2014 12:44 pm

Re: LinuxCNC

Sun Jan 10, 2016 8:37 am

Raspbian GNU/Linux 7 (wheezy)(rpi-machinekit-1.0.img.bz2 )
and the one from:
git clone git://git.code.sf.net/p/openocd/code openocd-code

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

Re: LinuxCNC

Sun Jan 10, 2016 8:43 am

are you compiling the firmware using RPi?

Code: Select all

/usr/local/pic32-tools/bin/pic32-gcc: 1: /usr/local/pic32-tools/bin/pic32-gcc: Syntax error: "(" unexpected
make: *** [main.o] Error 2
this error is due to wrong pic32-gcc architecture.
42

xt550
Posts: 12
Joined: Sun Mar 23, 2014 12:44 pm

Re: LinuxCNC

Sun Jan 10, 2016 10:56 am

the file on page 8
From: Fri Sep 13, 2013 12:40 pm
Works on the V2 card?
just to make sure
download/file.php?id=4603

mevon
Posts: 1
Joined: Tue Jan 26, 2016 10:42 pm

Re: LinuxCNC

Tue Jan 26, 2016 10:50 pm

Hello Kinsa,

Grats on the PiCnCV2 and MachineKit release, I think its great somebody has put in all this efforts to port LinuxCNC to the RasPi. Being a little familiar to the LinuxCNC configuration, I was wondering if MachineKit was designed to use the HAL directly with the PIC controller you made or does it still need the .HAL file and the .INI file in the configuration/startup folder like LinuxCNC needs? Because I have been looking at this thread, maybe I missed it, but all I saw was an example of the INI file and no HAL file for the other part of the setup. Also, I would suggest you include these files in the GIT so ppl would be able to find them easily. Again, thanks for the great work and keep going on, this project is becoming great!

Mevon

bfree
Posts: 11
Joined: Fri Feb 06, 2015 9:13 pm

Re: LinuxCNC

Sun Feb 07, 2016 6:20 pm

Hello,

Have a question for the group. Are drivers for USB wi-fi dongles included in the RPi and RPi2 images? Have folks had any success and, if so, what devices or chipsets were used? Am looking to add this network interface for occasional use on my system.

Kinsa, I just saw your response to candangelen on Jan 6. I do have some bare PICnc-V2 boards from my CNCTRK project available.

Still having fun!
Regards,
Bob

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

Re: LinuxCNC

Sun Feb 07, 2016 11:26 pm

No drivers.

But I will be upgrading all the images soon.

Requests are welcome ;-)
42

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

Re: LinuxCNC

Mon Feb 08, 2016 9:17 pm

kinsa wrote:No drivers.

But I will be upgrading all the images soon.

Requests are welcome ;-)
Can I request you upgrade the images with support for anholts gpu drivers, the current libgl1-mesa-swx11 packages account for about 31% of cpu usage when running axis.

Also pusshing debian to add the most recent libwebsockets/zmq/czmq would make it a lot easier to stop dependency problems and conflicts with those required by machinekit.

bfree
Posts: 11
Joined: Fri Feb 06, 2015 9:13 pm

Re: LinuxCNC

Tue Feb 09, 2016 4:14 pm

Regarding the addition of Wi-Fi drivers in a new image, here are a couple that I would like to see included:
1. From the CanaKit, RPi 2 model B kit using the RT5370 chipset
2. Kootek #KT-RPWF using the Realtek RTL8188CUS chipset
These were purchased from Amazon.
Information on other/better choices is welcome.
Thanks,
Bob

semmo
Posts: 1
Joined: Tue Feb 09, 2016 10:32 pm

Re: LinuxCNC

Sat Feb 13, 2016 9:35 am

Hi jam1,

I am testing machinekit with my RPi 2 with hal_gpio. I tested the X axis with hal_gpio_demo and it work very good, but in the configuration of my mill I have some trouble with the hal files (costum.hal, my-mill.hal, ...)
Could you please post the code from your configuration it would be very helpful

Cheers

Sorry for my poor Englisch
jam1 wrote:This is my latest ini file

Code: Select all

[EMC]
MACHINE = my-micro_step-mill
DEBUG = 0

[DISPLAY]
DISPLAY = axis
EDITOR = gedit
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
ARCDIVISION = 64
GRIDS = 10mm 20mm 50mm 100mm 1in 2in 5in 10in
MAX_FEED_OVERRIDE = 1.2
MIN_SPINDLE_OVERRIDE = 0.5
MAX_SPINDLE_OVERRIDE = 1.2
DEFAULT_LINEAR_VELOCITY = 2.50
MIN_LINEAR_VELOCITY = 0
MAX_LINEAR_VELOCITY = 25.00
INTRO_GRAPHIC = machinekit.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/pi/linuxcnc/nc_files
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm

[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python

[TASK]
TASK = milltask
CYCLE_TIME = 0.010

[RS274NGC]
PARAMETER_FILE = linuxcnc.var

[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
COMM_WAIT = 0.010
BASE_PERIOD = 100000
SERVO_PERIOD = 1000000

[HAL]
HALFILE = my-micro_step-mill.hal
HALFILE = custom.hal
POSTGUI_HALFILE = custom_postgui.hal

[TRAJ]
AXES = 3
COORDINATES = X Y Z
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
CYCLE_TIME = 0.010
DEFAULT_VELOCITY = 2.50
MAX_VELOCITY = 25.00

[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl

[AXIS_0]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 750.0
STEPGEN_MAXACCEL = 937.5
SCALE = 320.0
FERROR = 1
MIN_FERROR = .25
MIN_LIMIT = -100.0
MAX_LIMIT = 100.0
HOME_OFFSET = 0.0

[AXIS_1]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 750.0
STEPGEN_MAXACCEL = 937.5
SCALE = 320.0
FERROR = 1
MIN_FERROR = .25
MIN_LIMIT = -100.0
MAX_LIMIT = 100.0
HOME_OFFSET = 0.0

[AXIS_2]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 750.0
STEPGEN_MAXACCEL = 937.5
SCALE = 320.0
FERROR = 1
MIN_FERROR = .25
MIN_LIMIT = -100.0
MAX_LIMIT = 100.0
HOME_OFFSET = 0.0
This run flawlessly for the file 3DChips.ngc. I can see the motor shafts turning according to the plan. Very smooth and very fast. Very happy.

VikTan
Posts: 11
Joined: Wed Nov 11, 2015 2:36 pm
Location: Bratislava

Re: LinuxCNC

Sat Mar 05, 2016 1:26 pm

Hi,

I found an article about experimental hardware accelerated OpenGL driver for Raspberry Pi.
http://hexus.net/tech/news/graphics/904 ... l-support/

I want to ask, now I using image RPi2-machinekit-1.0 and there is low performance of LinuxCNC GUI on RasPi2. It is caused by software accelerated OpenGL or it is completely different problem? Big ngc files also makes GUI performance slower. Trajectory generation works without any problem.

Thanks,
Viktor

Return to “Automation, sensing and robotics”