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

Re: LinuxCNC

Fri Mar 22, 2013 10:52 pm

These commands should be OK:

Code: Select all

apt-get update
apt-get upgrade
But not these:

Code: Select all

apt-get update
apt-get dist-upgrade
Cheers!
42

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

Re: LinuxCNC

Tue Mar 26, 2013 2:23 pm

Sorry late to this thread and have a few questions.

So it looks like you have emc2 (now linuxcnc) running on the PI and can do up to 4 channels at 80kHz.
(did I get that right?)

Now I know anything else running on the PI will cause the max step rate to degrade. Was that 80kHz just running one channel or multiples? Also is there any left over headroom on the PI to control and monitor a spindle motor (USB to serial and just some polling commands to get speed and power readings back to display and send the appropriate commands to turn on/off when needed)

If so it sounds like the PI is a way better option that the semi modern pc that maxes out at 35kHz over the pll port.

Also on the non step/dir IO can you use all of them as digital inputs/outputs? The machine I want to use this on needs all 30 IO for all the various limit switches and controls (vac, ect) build details here:
http://www.cnczone.com/forums/diy_cnc_r ... 8x7x7.html

Hopefully the answer is a yes. If so going to lay up a new board with all the required isolation and level translation needed to make this driver combination more useful to a larger group of machines (plus keep the PI from getting fried. Lost many a PC on larger machines due to no isolation.)

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

Re: LinuxCNC

Tue Mar 26, 2013 3:16 pm

The bottleneck is the 64 bytes SPI buffer of RPi; this board runs the SPI clock at 16MHz, the maximum is 32MHz. Somebody is actually working on getting the Mesa boards working if you need better performance.

I haven't tested the limits yet as I don't have the equipment to do so. The 80 khz is for all all 4 channels simultaneously. Note that this is the hardware implementation of the software stepgen, it will share the same granularity issues at the top end of the range.

As long as the data fits within the 64 bytes (actually 62 bytes in actual tests) it should ffit your needs.

Cheers!
42

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

Re: LinuxCNC

Tue Mar 26, 2013 3:49 pm

Is there any documentation on what is used today in that 64 byte buffer?

(I am a hardware guy by trade so not exactly sure where to look)

If you could run the SPI bus at the full 32MHz would that increase the max step rate supported? (from a software point of view) If I know your protocol format would be easy enough to do a small FPGA with a hardware stepper and a 32MHz rated SPI interface on the back end.

If that does not help any due to bottlenecks on the RPi end will just go with the PIC.

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

Re: LinuxCNC

Tue Mar 26, 2013 6:24 pm

There is no defined protocol yet, its free for all at the moment :)

The 80 kHz is the hardware limitation of pic32.

Running the SPI at 32 MHz just improves the throughput; you can transfer twice the amount at the same time. At the moment, the 4 axes needs 16 bytes of data (4x32bits); there is still ample of bits left for digital I/O.
42

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

Re: LinuxCNC

Tue Mar 26, 2013 6:46 pm

Any idea what the max throughput the PI end could support if the hardware end was not the bottle neck?

If I drop a stepper core in a FPGA a 2MHz step rate is easy to obtain (assuming we can feed it fast enough) Just not sure how your current software / hardware works.

Since I am going to have to lay out a larger card would be willing to do the hardware port to a FPGA to get the faster step rates for those who need them. But I don't have any idea how to get started on the software side to support this sort of update to the linuxCNC code.

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

Re: LinuxCNC

Tue Mar 26, 2013 11:50 pm

The base thread runs every 1ms (RPi talks to the board at this rate). Running the base thread higher than this rate and the limiting factor would be the jitter, which maxes out at around 60us.

At 16MHz SPI clock, the data throughput is comparable to an LPT port.
42

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

PICnc Breadboard version

Wed Mar 27, 2013 12:57 pm

Here is the schematic of the breadboard version of PICnc

Image

Image

Image

Image

Schematics in PDF: http://db.tt/91kWCPFh

The firmware for this board is still being developed.

Cheers!
42

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

Re: LinuxCNC

Wed Mar 27, 2013 2:39 pm

Ok a little confused but have not looked at any of the code yet so that is why....

If the base thread currently updates on 1ms samples and each channel has 4 bytes of data that gives me a theoretical max step clock rate of only 16kHz when doing compound movements.

(assuming every 1ms your sending 4 bytes encoded in 2 bytes of direction and 2 bytes of step pulses to divide the 1ms window into smaller time slices)

I am not so concerned about bandwidth but more on accuracy and regularity on compound movements. (ie when cutting a circle it comes out as a circle and the bit travels at a constant speed during the arc)

Or am I totally off base and your sending some sort of encoded Gcode and doing the math on the PIC to calculate the circle?

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

Re: LinuxCNC

Wed Mar 27, 2013 3:17 pm

Sorry, I did not make myself clear.

The data that is being transferred consists of position commands, 32 bits per channel, and some digital IO commands. The reply from the board would be the current position feedback, 32 bits per channel, and the status of the input pins. The maximum number of bytes per transfer is 64, the actual usable bytes is 62. As long as your application doesn't exceed the SPI buffer size per transfer then it is doable.

Regarding the maximum step rate, the limit is with the uC/FPGA board. For PICnc board, it maxes out at 80 kHz/channel.

The 1 ms base thread is the default rate for LinuxCNC. Running at a higher rate is possible but for RPi we are already pushing the limits.
42

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

Re: LinuxCNC

Sat Mar 30, 2013 12:23 am

The Pololu board is alive :)

Image
42

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

Re: LinuxCNC

Mon Apr 01, 2013 2:44 am

RPi can now program PIC32 chips. No need for Pickit programmer. :)

See here: https://code.google.com/p/picnc/wiki/Op ... Programmer

Cheers!
42

MrGreg
Posts: 66
Joined: Sun Jun 10, 2012 7:25 pm

Re: LinuxCNC

Mon Apr 01, 2013 11:46 pm

Thanks for posting this and doing the work to make it happen!
Much appreciated.
I have just ordered some bit & bobs to build one!

BTW Do you have general recommended values for R , R1 , C for the MCLR pin
And
C value for Vcap pin

Or are they device specific, and need to be derived from PIC datasheets?

Cheers!

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

Re: LinuxCNC

Tue Apr 02, 2013 12:46 am

I normally connect MCLR to Vdd with 1k resistor. You can safely omit R and C.

The Vcap needs to be a low ESR capacitor. A 10uf ceramic will do. Tantalum would work as well.

Good luck!
42

MrGreg
Posts: 66
Joined: Sun Jun 10, 2012 7:25 pm

Re: LinuxCNC

Thu Apr 11, 2013 9:13 pm

I am encountering a couple of problems with your wiki guides

Trying to get the MPIDE running on an RPi as per
https://code.google.com/p/picnc/wiki/CompilingFirmware

Returns the following:

Code: Select all

[email protected] ~ $ tar --wildcards -xvzf mpide-0023-linux-*.tgz  'mpide-*/hardware/pic32/compiler/pic32-tools'
tar:  mpide-*/hardware/pic32/compiler/pic32-tools: Not found in archive
tar: Exiting with failure status due to previous errors
[email protected] ~ $
It does successfully install on Ubuntu and compiles the picnc firmware.
(picnc.hex is what we are needing for the OpenOCD RPi Programmer Right?)

Next problem:

Following this guide,

https://code.google.com/p/picnc/wiki/Op ... Programmer

Returns:

Code: Select all

[email protected] /usr/src/openocd-code $ ./bootstrap

+ aclocal
autom4te: cannot create autom4te.cache: No such file or directory
aclocal: autom4te failed with exit status: 1

[email protected] /usr/src/openocd-code $ 
Both of the above were run on a current and updated version Raspbian. What am I missing?

Cheers

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

Re: LinuxCNC

Thu Apr 11, 2013 10:56 pm

MrGreg wrote:I am encountering a couple of problems with your wiki guides

Trying to get the MPIDE running on an RPi as per
https://code.google.com/p/picnc/wiki/CompilingFirmware

Returns the following:

Code: Select all

[email protected] ~ $ tar --wildcards -xvzf mpide-0023-linux-*.tgz  'mpide-*/hardware/pic32/compiler/pic32-tools'
tar:  mpide-*/hardware/pic32/compiler/pic32-tools: Not found in archive
tar: Exiting with failure status due to previous errors
[email protected] ~ $
It does successfully install on Ubuntu and compiles the picnc firmware.
(picnc.hex is what we are needing for the OpenOCD RPi Programmer Right?)
Sorry, this has to be done on a PC. There is an experimental MPIDE compiler for RPi located here: http://chipkit.s3.amazonaws.com/index.html . I haven't tested this yet though.
MrGreg wrote: Next problem:

Following this guide,

https://code.google.com/p/picnc/wiki/Op ... Programmer

Returns:

Code: Select all

[email protected] /usr/src/openocd-code $ ./bootstrap

+ aclocal
autom4te: cannot create autom4te.cache: No such file or directory
aclocal: autom4te failed with exit status: 1

[email protected] /usr/src/openocd-code $ 
Both of the above were run on a current and updated version Raspbian. What am I missing?

Cheers
The directory should be writable by the "pi" user. Just run the following command:

Code: Select all

[email protected] /usr/src/openocd-code $ sudo chmod a+rw .
42

MrGreg
Posts: 66
Joined: Sun Jun 10, 2012 7:25 pm

Re: LinuxCNC

Sat Apr 13, 2013 6:46 pm

OK
Following the wiki, but with prefix

Code: Select all

sudo chmod a+rw .
./bootstrap ran but with errors

Code: Select all

[email protected] /usr/src/openocd-code $ sudo chmod a+rw .
[email protected] /usr/src/openocd-code $ ./bootstrap
+ aclocal
+ libtoolize --automake --copy
+ autoconf
+ autoheader
+ automake --gnu --add-missing --copy
cp: cannot create regular file `doc/mdate-sh': Permission denied
doc/Makefile.am:1: installing `doc/mdate-sh'
doc/Makefile.am:1:     error while copying
cp: cannot create regular file `doc/texinfo.tex': Permission denied
doc/Makefile.am:1: installing `doc/texinfo.tex'
doc/Makefile.am:1:     error while copying
[email protected] /usr/src/openocd-code $ 
?

Cheers & thanks for the support

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

Re: LinuxCNC

Sat Apr 13, 2013 7:26 pm

Try

Code: Select all

[email protected] /usr/src/openocd-code $ sudo chmod a+rw -R /usr/src/openocd-code 
If that doesn't work, prefix all commands with "sudo".

Sorry as I don't have my RPi with me and I normally run as root, too lazy to type "sudo" :D

Cheers!
42

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

Re: LinuxCNC

Sun Apr 14, 2013 12:13 pm

I've caught another issue with compiling OpenOCD and I've updated the wiki.

Here's a precompiled binary: http://db.tt/eNO3m2FT

Installing it by running the command:

Code: Select all

sudo tar xvzf openocd.bin.tar.gz -C /
This will install the files under /usr/local directory.

Then continue with the Create configuration files step.

Cheers!
42

MrGreg
Posts: 66
Joined: Sun Jun 10, 2012 7:25 pm

Re: LinuxCNC

Tue Apr 16, 2013 11:34 pm

Had some more probs with the compile, not sure what actually may have been built/installed/left over..?
Gave up on that given the binary now published.
So,
I've installed your binary of openOCD for RPi. The dir & file structure look to be as expected. Created the configs as per wiki and checked the first one to verify it was where it should be and was what it should be.

Now for the problems:

Rebooted with PICnc board attached as per wiki
During the boot screens, I noticed a strange and unexpected reports

Home directory / not ours

Repeated some several times. (Not seen this before) Otherwise booted up OK and went into GUI as normal.
Opened a terminal and entered (picnc.hex in my pi home dir)


Code: Select all

[email protected] ~ $ sudo pic32openocd picnc.hex

sudo: pic32openocd: command not found

[email protected] ~ $ 

Ideas on what may be happening here?

Cheers

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

Re: LinuxCNC

Wed Apr 17, 2013 12:11 am

MrGreg wrote:Had some more probs with the compile, not sure what actually may have been
Home directory / not ours
No Idea what that error is :D

MrGreg wrote:

Code: Select all

[email protected] ~ $ sudo pic32openocd picnc.hex

sudo: pic32openocd: command not found

[email protected] ~ $ 
I forgot to add ./.

Code: Select all

[email protected] ~ $ sudo ./pic32openocd picnc.hex
Just copy the script to the /usr/local/bin directory so that there's no need to type ./

Code: Select all

[email protected] ~ $ sudo cp pic32openocd /usr/local/bin
Sorry for the headaches!
42

Beutrocks
Posts: 52
Joined: Mon Apr 22, 2013 4:00 am

How do I attach the 3 motors or some board

Mon Apr 22, 2013 4:09 am

Hi Would like to know if I can go an alternative route to using linstepper and how to connect/configure steppers on breadboard picnc board thx. Aka which jack do I use to connect steppers or driver board or whatever's needed and where did you get those jacks so that the flat pins from pic board go into small round pins for board.

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

Re: LinuxCNC

Mon Apr 22, 2013 12:52 pm

Hi,

Connector P3 contains the step/dir signals for three axes. I have not fixed the signal assignments because it will depend on how you wire up the board. The pin assignments are easily changed in the firmware.

Typical pin assignments could be:

Code: Select all

PIN - Signal
1 - X Step
2 - X Dir
3 - Y Step
4 - Y Dir
5 - Z Step
6 - Z Dir
The round plugs are called DIN plugs. I just sourced them out from my local electronics store.

Cheers!
42

Beutrocks
Posts: 52
Joined: Mon Apr 22, 2013 4:00 am

Re: LinuxCNC

Tue Apr 23, 2013 2:13 am

Thanks a lot one more question and I think I'll get the rest. How did you make orwhere did you get those pins that are on board and go from board to linistepper and how would I connect that to an alternative to linistepper IE what type of connector plug or port goes from picnc board to linistepper box in YouTube video. Thanks for the help.

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

Re: LinuxCNC

Tue Apr 23, 2013 2:55 am

Hi,

Are you referring to the row of pins? They are called pin headers, you can get them cheaply on ebay.

I will post a connection diagram later.

Cheers!
42

Return to “Automation, sensing and robotics”