Page 31 of 41

Re: LinuxCNC

Posted: Mon Nov 17, 2014 8:41 pm
by JASM123
Wire wrote:I think the line you want to edit is "SCALE = 1200.0" under each of the [AXIS_x] statements in the .ini file. Have not played with that part yet so may be off.
Hi Wire thank you , I would try this and post my results, thank you so much

Re: LinuxCNC

Posted: Mon Nov 17, 2014 9:05 pm
by kinsa
JASM123 wrote:Hi kinsa thank you for responding,
Ok I see, but this new configuration in which variable of the INI or in the HAL file have to change,in the INI file there are variables such as Base period, Servo period, in which variable I have to change to obtain this new resolution (1/2)??

Wire's answer is correct :)

It's on the INI file, the scale parameter under each axis.

Re: LinuxCNC

Posted: Mon Nov 17, 2014 10:49 pm
by MrGreg
As Wire suggested,
you need to change the SCALE= value in the .ini file.
These will be under the AXIS sections toward the end of the .ini file for each of your axes.
You shouldn't need to change anything else if that solves your problem. There are other parameters to tune if you still have problems with insufficient torque, but try that one first.

EDIT
Kinsa got there before me :)

Re: LinuxCNC

Posted: Mon Nov 17, 2014 11:53 pm
by kinsa
Just an update on machinekit, here's the current state of the remote UI's that can run on different platforms:

http://youtu.be/H8gfsly2EjE

I haven't updated the RPi repo yet to take advantage of this, expect within a weeks time.

Cheers.

Re: LinuxCNC

Posted: Sat Dec 06, 2014 2:56 pm
by mung
kinsa wrote:Just an update on machinekit, here's the current state of the remote UI's that can run on different platforms:

http://youtu.be/H8gfsly2EjE

I haven't updated the RPi repo yet to take advantage of this, expect within a weeks time.

Cheers.
Have you made profiling test of machine kit against linuxcnc, I am wondering if the zeroMQ and other changes have slowed performance compared with original ARM builds made from the bitmuster code.

Is there a chance step rates could be higher if using the pic board with the earlier linuxcnc code base?

I am still wondering which route to take for best performance, I ran machine kit a few months back and it seemed slower but never had a chance to do any proper tests. I am thinking that maybe beaglebone will be better but still waiting to see how everything progress. The pi should be better in someways if the vc4 is used for stepper control, but this is still dependent on opengl drivers being better on pi than beaglebone, which is currently not the case.

Re: LinuxCNC

Posted: Mon Dec 08, 2014 12:34 am
by kinsa
The RPi as client for QtQuickVcp isn't ready yet as there's a bug on the arm version of QT5.

As a server, it works as expected. There's no additional stuff needed to make it work.

I haven't done any profiling between the linuxcnc and machinekit. I would not expect to see any difference performance-wise between the two as the 0MQ is only currently used for remote interfaces.

The maximum step rates for PICnc is fixed. If you need higher rates then you'll need a faster uC or use an FPGA. BBB is also a good alternative :)

Re: LinuxCNC

Posted: Sat Dec 20, 2014 2:31 pm
by xt550
I have soldered the picnc card and need a pic/drawing or description on how to connect it with a raspberry and a small summary of pic programing and installing the Pi software and where to get it.
I have some knowledge bout this, but not enough.....

thank you in advance

Re: LinuxCNC

Posted: Sat Dec 20, 2014 11:20 pm
by kinsa
xt550 wrote:I have soldered the picnc card and need a pic/drawing or description on how to connect it with a raspberry and a small summary of pic programing and installing the Pi software and where to get it.
I have some knowledge bout this, but not enough.....

thank you in advance
Which version of the card have you made?

Re: LinuxCNC

Posted: Sun Dec 21, 2014 5:58 am
by xt550
v2

Re: LinuxCNC

Posted: Mon Dec 22, 2014 1:17 am
by kinsa
The compiled firmware can be downloaded here.

If you don't have a pic32 programmer you can follow the instructions here to program the board using RPi.

The rest of the instructions can be found here.

As for the SPI wiring, use a flat cable and keep it as short as possible:

Code: Select all

                   Ribbon Cable

                   +-------------> (6)
                   |
      MOSI (19) <----------------> (5)
                   |
                   +-------------> (8)
RPI                |                     PICnc
      MISO (21) <----------------> (7)     P3
                   |
                   +-------------> (2) 
                   |
      SCLK (23) <----------------> (1)
                   |
      GND  (25) <--+-------------> (4)

Re: LinuxCNC

Posted: Mon Dec 29, 2014 9:57 pm
by nroff-man
hi
kinsa wrote: If you don't have a pic32 programmer you can follow the instructions here to program the board using RPi.
A few months back I finished PIC32 support in my ICSP PIC programming app which
supports RPi GPIO.

You may consider testing this because I think it will be simpler, uses less connections
(ICSP not JTAG) and probably faster (can support programming executive).

I would have mentioned this before but have been mostly documenting things and
now have something presentable.

You can check out these pages if you are interested for more information.

app: http://wiki.kewl.org/dokuwiki/projects:k8048
pic32 PE: http://wiki.kewl.org/dokuwiki/projects: ... figuration
RPi ICSP: http://wiki.kewl.org/dokuwiki/boards:rpi

some docs are new so can contain errors or oversights, please mention when you
spot them or have improvements.

thx, good luck

edit:typo

Re: LinuxCNC

Posted: Tue Jan 13, 2015 2:54 am
by vtpi
Kinsa, I've been trying to read through this whole thread a little at a time -- quite a bit still to go. I started at the beginning, after I saw a link from the LinuxCNC wilki. I have run LinuxCNC from an older computer parallel port to drive a gantry mill, so am familiar with it that way.

You mentioned here briefly the possibility using an Arduino board, in conjunction with the RPi, though speed would be limited. Before I saw this thread, I had set up an RPi B+ running Raspbian connected via USB to an Arduino Uno r3 board running Grbl. The Arduino is connected to a screw terminal shield board to break out the lines for individual commercial stepper drivers.

The Pi runs GRBL Controller user interface by zapmaker http://zapmaker.org/raspberry-pi/runnin ... pberry-pi/ that caches the G-code commands to send to the Arduino. The display update is quite slow and jerky, and somewhat primitive compared to LinuxCNC, although it does function well as a CNC controller otherwse.

I was wondering, since you mentioned it early on, whether it would be possible to run LinuxCNC as the user interface to control the Arduino running Grbl, in place of zapmaker's Grbl controller?

Also, In reading about your PIC board solution (which I do understand is faster) I'm still not clear on whether the board is something I would build myself or whether it is a stock PIC board. I do see all the links to your software and firmware, and the means of programming the PIC using the Pi, but have somehow just missed the physical board info.

Sorry to post a dumb question, if I have!

Thanks for all your fascinating work on LinuxCNC and the RPi.

Re: LinuxCNC

Posted: Wed Jan 14, 2015 1:47 am
by kinsa
There's no suitable high speed, realtime communication between RPi and Arduino that's why it is not feasible for step generation under MachineKit/LinuxCNC.
vtpi wrote: I was wondering, since you mentioned it early on, whether it would be possible to run LinuxCNC as the user interface to control the Arduino running Grbl, in place of zapmaker's Grbl controller?
As it is, It's not possible as they are totally different implementations. You can recycle the UI interface to work with Grbl but it's not a simple task.
vtpi wrote:Also, In reading about your PIC board solution (which I do understand is faster) I'm still not clear on whether the board is something I would build myself or whether it is a stock PIC board. I do see all the links to your software and firmware, and the means of programming the PIC using the Pi, but have somehow just missed the physical board info.

Sorry to post a dumb question, if I have!

Thanks for all your fascinating work on LinuxCNC and the RPi.
All the hardware info is on the repository: https://github.com/kinsamanka/PICnc-V2/ ... r/hardware. The boards were designed using KiCad and the resulting gerber files are also included.

You can also build the board using perfboards if you just want to test it out.

I have some spare boards left but I'm away at the moment and wont be back till the end of the month.

Cheers

Re: LinuxCNC

Posted: Sat Jan 17, 2015 5:46 pm
by vtpi
Thanks Kinsa. I'd be interested in a board.

Re: LinuxCNC

Posted: Thu Feb 05, 2015 2:32 pm
by kinsa
vtpi wrote:Thanks Kinsa. I'd be interested in a board.
Please check your PM.

Re: LinuxCNC

Posted: Thu Feb 05, 2015 8:56 pm
by vtpi
Hi Kinsa,

I received a blank PM from you, and I couldn't PM back because the forum message indicates that you have private messaging turned off. I'll check PMs regularly if you want to retry....

Thanks!

Re: LinuxCNC

Posted: Fri Feb 06, 2015 9:30 pm
by bfree
Hello,

Am new to this forum and first want to say thank you to Kinsa for the picnc-V2 board and all the effort that has gone into getting LinuxCNC running in the RPi. I have several years experience with the LinuxNC and am now trying to implement this system.

I am writing to request clarification on the SPI wiring. I found the ribbon cable wiring shown below but the CS signal is not shown. So far, I have not been able to trace through the code but I "think" the CS (Pin 3) signal is wired to GPIO8 at Pin 24 on the RPi but would like to know for sure.

Will someone provide information on the wiring for me, please.

Thanks,
Bob

Ribbon Cable

+-------------> (6)
|
MOSI (19) <----------------> (5)
|
+-------------> (8)
RPI | PICnc
MISO (21) <----------------> (7) P3
|
+-------------> (2)
|
SCLK (23) <----------------> (1)
|
GND (25) <--+-------------> (4)

Re: LinuxCNC

Posted: Fri Feb 06, 2015 11:13 pm
by kinsa
bfree wrote:Hello,

Am new to this forum and first want to say thank you to Kinsa for the picnc-V2 board and all the effort that has gone into getting LinuxCNC running in the RPi. I have several years experience with the LinuxNC and am now trying to implement this system.

I am writing to request clarification on the SPI wiring. I found the ribbon cable wiring shown below but the CS signal is not shown. So far, I have not been able to trace through the code but I "think" the CS (Pin 3) signal is wired to GPIO8 at Pin 24 on the RPi but would like to know for sure.

Will someone provide information on the wiring for me, please.

Thanks,
Bob

Ribbon Cable

+-------------> (6)
|
MOSI (19) <----------------> (5)
|
+-------------> (8)
RPI | PICnc
MISO (21) <----------------> (7) P3
|
+-------------> (2)
|
SCLK (23) <----------------> (1)
|
GND (25) <--+-------------> (4)
Hi,

Welcome to the forum!

The CS pin is unused in this application as it slows down the maximum SPI speed. This is a limitation with the PIC32 chip.

Cheers

Re: LinuxCNC

Posted: Fri Feb 06, 2015 11:24 pm
by bfree
Thank you for the reply!
I'm off to the lab...
Regards,
bfree

Re: LinuxCNC

Posted: Sat Feb 07, 2015 1:08 am
by kinsa
vtpi wrote:Hi Kinsa,

I received a blank PM from you, and I couldn't PM back because the forum message indicates that you have private messaging turned off. I'll check PMs regularly if you want to retry....

Thanks!
Send me your address at Image

Re: LinuxCNC

Posted: Thu Feb 12, 2015 2:01 am
by bfree
Hello,

Happy camper here as I just got my machine up and running. I did learn a thing or two along the way, as always. Am posting my experience just in case someone encounters similar hurdles.

Using a PICnc-V2 (LPT version) and RPi B+, I followed instructions in the following two links to load an image, program the PIC, and get things pretty close to working (faster LED flashing):

http://www.raspberrypi.org/forums/viewt ... 34#p658034

https://github.com/kinsamanka/PICnc-V2/wiki

However, there were tweaks required to gain full functionality; these are described below.

1) The example HAL configuration, MF70.hal, appeared to need one more critical line added to enable output signals to appear on the 25 pin connector; I added this line to MF70.hal:

setp picnc.out.enable 1

2) The PICnc-V2 is made to be compatible with the parallel port stepper definitions used by LinuxCNC. Well, there are actually TWO standards used for the parallel ports by LinuxCNC, Sherline and Xylotex. The PICnc-V2 outputs appear to follow the latter definition. Here's a reference:

http://linuxcnc.org/docs/html/config/stepconf.html

As luck would have it, all my machines are wired for the Sherline definition. So, I altered the hardware.h port definitions to swap the four Step and Direction output pins and re-compiled the firmware for the PIC. This was a learning experience but all seems to have gone well and the machine is in motion. Yeah!

3) Finally, I found the SCALE required for a given motion was 1/2 of the value used in the other LinuxCNC machines I have used -- with this same hardware. For example, a SCALE = 142.222 required a scale value of 71.111 to achieve an equivalent motion. Anyone know why this is so?

That's it. All-in-all not too difficult a process to get this working on the RPi. Kudos to kinsa for a stable bit of software and hardware design; like many things Linux, It Just Works!

Regards,
bfree

Re: LinuxCNC

Posted: Thu Feb 12, 2015 2:35 am
by kinsa
Thanks for testing! :D

Sorry for the incomplete documentation.
bfree wrote: 1) The example HAL configuration, MF70.hal, appeared to need one more critical line added to enable output signals to appear on the 25 pin connector; I added this line to MF70.hal:

setp picnc.out.enable 1
This pin should actually be tied to machine start. Try replacing it with the following:

Code: Select all

net estop-out => picnc.out.enable
bfree wrote: 2) The PICnc-V2 is made to be compatible with the parallel port stepper definitions used by LinuxCNC. Well, there are actually TWO standards used for the parallel ports by LinuxCNC, Sherline and Xylotex. The PICnc-V2 outputs appear to follow the latter definition. Here's a reference:

http://linuxcnc.org/docs/html/config/stepconf.html

As luck would have it, all my machines are wired for the Sherline definition. So, I altered the hardware.h port definitions to swap the four Step and Direction output pins and re-compiled the firmware for the PIC. This was a learning experience but all seems to have gone well and the machine is in motion. Yeah!
I will update the docs. Can you please post your changes so that the alternative firmware will be available to others.
bfree wrote: 3) Finally, I found the SCALE required for a given motion was 1/2 of the value used in the other LinuxCNC machines I have used -- with this same hardware. For example, a SCALE = 142.222 required a scale value of 71.111 to achieve an equivalent motion. Anyone know why this is so?

That's it. All-in-all not too difficult a process to get this working on the RPi. Kudos to kinsa for a stable bit of software and hardware design; like many things Linux, It Just Works!

Regards,
bfree
Hmm, I need to take a look at this.

Good luck and thanks for posting your results.

Cheers.

PS. now that RPi version 2 is out I'll expect that the UI now will be snappier ;)

Re: LinuxCNC

Posted: Thu Feb 12, 2015 2:58 am
by bfree
Here is the firmware.h file I modified to generate Sherline compatible Step and Direction signals on the PICnc-V2, LPT version board. Only the Step and Direction ports were altered; other signals are unchanged.

hardware.h for Sherline definition folows

Code: Select all

/*    Copyright (C) 2014 GP Orcullo
 *
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 */

#ifndef __HARDWARE_H__
#define __HARDWARE_H__

#define SYS_FREQ		(48000000ul)    /* 48 MHz */
#define GetSystemClock()	(SYS_FREQ)
#define	GetPeripheralClock()	(GetSystemClock())
#define	GetInstructionClock()	(GetSystemClock())

#define SPICHAN			2

/*    PORT USAGE
 *
 *	Pin	Port	Dir	Signal
 *
 *	2	RA0	OUT	SPINDLE_ENABLE
 *	3	RA1	OUT	MIST_ENABLE
 *	9	RA3	OUT	STEP_Z
 *	10	RA2	OUT	DIR_Z
 *	12	RB4	OUT	STEP_X
 *	4	RB0	OUT	FLOOD_ENABLE
 *	5	RB3	OUT	DIR_A
 *	6	RB2	OUT	ENABLE
 *	7	RB1	OUT	STEP_A
 *	11	RA4	OUT	DIR_X
 *	14	RB5	OUT	Status LED
 *	21	RB12	OUT	DIR_Y
 *	22	RB11	OUT	MISO
 *	23	RB10	OUT	STEP_Y
 *
 *	15	RB6	IN	HOME_A
 *	16	RB7	IN	HOME_Z
 *	17	RB8	IN	HOME_Y
 *	18	RB9	IN	HOME_X
 *	24	RB13	IN	MOSI
 *	25	RB14	IN	CS
 *	26	RB15	IN	SCLK
 *
 */

#define LED_TOGGLE		(LATBINV = BIT_5)
//#define LED_TOGGLE

#define STOP_IN			(PORTBbits.RB5)
#define HOME_A_IN		(PORTBbits.RB6)
#define HOME_X_IN		(PORTBbits.RB9)
#define HOME_Y_IN		(PORTBbits.RB8)
#define HOME_Z_IN		(PORTBbits.RB7)

#define ENABLE_LO		(LATBCLR = BIT_2)
#define ENABLE_HI		(LATBSET = BIT_2)
#define SPINDLE_EN_LO		(LATACLR = BIT_0)
#define SPINDLE_EN_HI		(LATASET = BIT_0)
#define MIST_EN_LO		(LATACLR = BIT_1)
#define MIST_EN_HI		(LATASET = BIT_1)
#define FLOOD_EN_LO		(LATBCLR = BIT_0)
#define FLOOD_EN_HI		(LATBSET = BIT_0)

#define STEP_X_LO		(LATBCLR = BIT_4)
#define STEP_X_HI		(LATBSET = BIT_4)
#define DIR_X_LO		(LATACLR = BIT_4)
#define DIR_X_HI		(LATASET = BIT_4)

#define STEP_Y_LO		(LATBCLR = BIT_10)
#define STEP_Y_HI		(LATBSET = BIT_10)
#define DIR_Y_LO		(LATBCLR = BIT_12)
#define DIR_Y_HI		(LATBSET = BIT_12)

#define STEP_Z_LO		(LATACLR = BIT_3)
#define STEP_Z_HI		(LATASET = BIT_3)
#define DIR_Z_LO		(LATACLR = BIT_2)
#define DIR_Z_HI		(LATASET = BIT_2)

#define STEP_A_LO		(LATBCLR = BIT_1)
#define STEP_A_HI		(LATBSET = BIT_1)
#define DIR_A_LO		(LATBCLR = BIT_3)
#define DIR_A_HI		(LATBSET = BIT_3)

#endif /* __HARDWARE_H__ */
Hope this helps.
Regards,
bfree

Re: LinuxCNC

Posted: Fri Feb 13, 2015 4:43 am
by kinsa
bfree wrote:3) Finally, I found the SCALE required for a given motion was 1/2 of the value used in the other LinuxCNC machines I have used -- with this same hardware. For example, a SCALE = 142.222 required a scale value of 71.111 to achieve an equivalent motion. Anyone know why this is so?
What was the servo period that you used originally?

Re: LinuxCNC

Posted: Fri Feb 13, 2015 10:51 pm
by bfree
This is what I find on two laptops. I'll confess to not knowing the full impact if the settings, other than its impact on maximum speed of an axis. My application does not require high speed.

Compaq:
BASE PERIOD 25000
SERVO PERIOD 1000000
SCALE=142.222
Thinkpad:
BASE PERIOD 25000
SERVO PERIOD 1000000
SCALE=142.222
RPi:
BASE PERIOD 100000
SERVO PERIOD 1000000
SCALE=71.111

Thanks,
bfree