hybris
Posts: 52
Joined: Mon Jun 03, 2013 8:50 pm
Location: Tyrol / Austria

Re: LinuxCNC

Sun Sep 15, 2013 4:24 pm

kinsa wrote:

Code: Select all

/*    PORT USAGE
 *
 *   Pin Port  Dir   Signal
 *
 *   9   RA2   OUT   OUTPUT 0
 *   10  RA3   OUT   OUTPUT 1
 *   4   RB0   OUT   DATA
 *   5   RB1   OUT   MISO
 *   14  RB5   OUT   Status LED
 *   15  RB6   OUT   DIR_A
 *   16  RB7   OUT   STEP_A
 *   17  RB8   OUT   DIR_Z
 *   18  RB9   OUT   STEP_Z
 *   21  RB10  OUT   DIR_Y
 *   22  RB11  OUT   STEP_Y
 *   23  RB12  OUT   DIR_X
 *   24  RB13  OUT   STEP_X
 *
 *   3   RA1   IN    DATA REQUEST
 *   6   RB2   IN    MOSI
 *   26  RB15  IN    SCLK
 *
 *   2   RA0   IN    unused
 *   12  RA4   IN    unused
 *   7   RB3   IN    unused
 *   11  RB4   IN    unused
 *   25  RB14  IN    unused
 *
 *
 */
yes, i can confirm that

just downloaded the newest version befor compiling the firmware

hybris
Posts: 52
Joined: Mon Jun 03, 2013 8:50 pm
Location: Tyrol / Austria

Re: LinuxCNC

Sun Sep 15, 2013 4:33 pm

oh wait, i equiped my board also with the resistors and capacitors which are only for the use of a 3d printer.
maybe this causes the problemes, because i have a potential on the pins, what do you think?

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

Re: LinuxCNC

Mon Sep 16, 2013 9:43 am

hybris wrote:oh wait, i equiped my board also with the resistors and capacitors which are only for the use of a 3d printer.
maybe this causes the problemes, because i have a potential on the pins, what do you think?
I don't think it would matter. BTW, it's better to test without the other chips connected (U1 and U3).

I've uploaded a new but untested firmware and hal driver. Run the following to download:

Code: Select all

git clone -b hybris http://code.google.com/p/picnc/
To compile the HAL driver, just issue the following command:

Code: Select all

comp --install hal_spi.c
For testing, observe the LED and run the following commands

Code: Select all

loadrt threads name1=test period1=1000000
loadrt hal_spi

addf spi.read test
addf spi.update test
addf spi.write test
start
The pin spi.ready should switch to 1 after the start command. If it doesn't then there is a problem with the SPI communication.
42

hybris
Posts: 52
Joined: Mon Jun 03, 2013 8:50 pm
Location: Tyrol / Austria

Re: LinuxCNC

Mon Sep 16, 2013 10:20 am

thanks a lot for your help! :)

Code: Select all

comp --install hal_spi.c
produce some errors:
hal_spi.c:295:13: error: invalide storage class for function 'write_spi'
same for update
hal_spi.c: 422:19: error incompatible types when assigning to type 'spi_data_t'
also "invalid operands to binary | (have 'spi_data_t' and 'int')"
and more in connection with 'spi_data_t'

maybe a problem with the declaration?

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

Re: LinuxCNC

Mon Sep 16, 2013 10:31 am

hybris wrote:thanks a lot for your help! :)

Code: Select all

comp --install hal_spi.c
produce some errors:
hal_spi.c:295:13: error: invalide storage class for function 'write_spi'
same for update
hal_spi.c: 422:19: error incompatible types when assigning to type 'spi_data_t'
also "invalid operands to binary | (have 'spi_data_t' and 'int')"
and more in connection with 'spi_data_t'

maybe a problem with the declaration?
there's a missing "}" :)

update by running

Code: Select all

git pull
42

hybris
Posts: 52
Joined: Mon Jun 03, 2013 8:50 pm
Location: Tyrol / Austria

Re: LinuxCNC

Mon Sep 16, 2013 10:56 am

kinsa wrote: there's a missing "}" :)
:D

but now:

Code: Select all

loadrt hal_spi
HAL: ERROR: pin_new(spi.pin.1.out) called with already-initialized memory
same for 2,3 and 4 and also spi.ready

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

Re: LinuxCNC

Mon Sep 16, 2013 11:31 am

hybris wrote:
kinsa wrote: there's a missing "}" :)
:D

but now:

Code: Select all

loadrt hal_spi
HAL: ERROR: pin_new(spi.pin.1.out) called with already-initialized memory
same for 2,3 and 4 and also spi.ready
try again, there will be extra in and out pins. :)
42

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

Re: LinuxCNC

Mon Sep 16, 2013 11:34 am

Sorry as I don't have my RPi with me. You'll be my lab rat ;)
42

hybris
Posts: 52
Joined: Mon Jun 03, 2013 8:50 pm
Location: Tyrol / Austria

Re: LinuxCNC

Mon Sep 16, 2013 12:45 pm

kinsa wrote:Sorry as I don't have my RPi with me. You'll be my lab rat ;)
nothing to apologize for :)

tried again, it worked i think (no errors)
run halmeter after start, but spi.ready -> FALSE :(

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

Re: LinuxCNC

Mon Sep 16, 2013 1:06 pm

Do you have spare PIC32's?

This problem could either be the chip or RPi. RPi can be easily checked by using the test spi driver.

I'll try to check the new firmware to verify that it works within this week.

Cheers!
42

hybris
Posts: 52
Joined: Mon Jun 03, 2013 8:50 pm
Location: Tyrol / Austria

Re: LinuxCNC

Mon Sep 16, 2013 1:09 pm

yes, i've got another one

thanks, so i'll check the RPi

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

Re: LinuxCNC

Mon Sep 16, 2013 1:11 pm

BTW, make sure your RPi is not overclocked as it would affect the SPI speed.
42

hybris
Posts: 52
Joined: Mon Jun 03, 2013 8:50 pm
Location: Tyrol / Austria

Re: LinuxCNC

Mon Sep 16, 2013 2:30 pm

is it possible that i'm missing hal_rpspi.c? or it's just not able to create it!?
because i'm getting an error one more time :(

Code: Select all

gcc: error: driver: No such file or directory

hybris
Posts: 52
Joined: Mon Jun 03, 2013 8:50 pm
Location: Tyrol / Austria

Re: LinuxCNC

Mon Sep 16, 2013 2:36 pm

kinsa wrote:BTW, make sure your RPi is not overclocked as it would affect the SPI speed.
hmm, maybe.. default frequency is 700, i'm running it with 800
gonna change it

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

Re: LinuxCNC

Tue Sep 17, 2013 8:28 am

hybris wrote:
kinsa wrote:BTW, make sure your RPi is not overclocked as it would affect the SPI speed.
hmm, maybe.. default frequency is 700, i'm running it with 800
gonna change it
I have replicated your issue.

I'm looking into the problem.

Cheers
42

siamect
Posts: 8
Joined: Thu Sep 12, 2013 1:57 pm

Re: LinuxCNC

Tue Sep 17, 2013 1:26 pm

Hi and thats for helping me...
I'm trying to run the setup described here http://www.raspberrypi.org/phpBB3/viewt ... 03#p399603 then is a raspbian image with a bunch of packages. Simulation works fine with the web interface.

I have connected the MAX32 board and compiled and installed the picnc.hex (now configured with spi chan 2) and it seems to work after connecting the miso, mosi, the clock signal, CE, rdy, req, aux and gnd. The LED is flickering faster, I can measure on the signals ok and that the timebase 1 ms is kept (rdy signal).
I have a problem that the E-stop error is always thee so I cannot do anything.

Code: Select all

linuxcnc /opt/linuxcnc/configs/MF70/MF70.ini
LINUXCNC - 2.6.0~pre
Machine configuration directory is '/opt/linuxcnc/configs/MF70'
Machine configuration file is 'MF70.ini'
Starting LinuxCNC...
io started
halcmd loadusr io started
task pid=3071
Found config string X Y Z
Init NML connection
Try to establish NML connection
Try to calloc 1 blocks of 1408 bytes
Try to calloc 1 blocks of 56 bytes
Try to calloc 1 blocks of 17056 bytes
Try to calloc 1 blocks of 17056 bytes
Try to calloc 1 blocks of 17056 bytes
Try to calloc 1 blocks of 17056 bytes
Try to calloc 1 blocks of 17056 bytes
emcTaskInit: using builtin interpreter
Found config string X Y Z
Try to establish NML connection
NML connected
command (EMC_AXIS_INCR_JOG) cannot be executed until the machine is out of E-stop and turned on
command (EMC_AXIS_INCR_JOG) cannot be executed until the machine is out of E-stop and turned on
command (EMC_AXIS_INCR_JOG) cannot be executed until the machine is out of E-stop and turned on
command (EMC_AXIS_INCR_JOG) cannot be executed until the machine is out of E-stop and turned on
command (EMC_AXIS_INCR_JOG) cannot be executed until the machine is out of E-stop and turned on
command (EMC_AXIS_INCR_JOG) cannot be executed until the machine is out of E-stop and turned on
command (EMC_AXIS_INCR_JOG) cannot be executed until the machine is out of E-stop and turned on
I studied the schematic of the Picnc and the Picnc-jr and I can see some differences, the Jr has some Estop signals in the Rpi connector and the picnc does not.

What is the correct, minimal wiring for this to work with the MAX32 board. Where do I connect e-stop and limit switches?
Thanks again.
Martin

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

Re: LinuxCNC

Tue Sep 17, 2013 2:35 pm

I've fixed the issue and I have tested it as well.

To test, run the following halrun commands:

Code: Select all

loadrt threads name1=test period1=1000000
loadrt hal_spi

setp spi.0.scale 100
setp spi.0.maxaccel 10

addf spi.read test
addf spi.update test
addf spi.write test
start
loadusr halmeter
Select/monitor spi.0.position-fb and issue the following command:

Code: Select all

setp spi.0.position-cmd 1000
The position feedback should increment to 1000 and there should be output on the X step pin. Send a negative value and the dir pin should change.

Do note that I've implemented only 3 axis at the moment.
42

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

Re: LinuxCNC

Tue Sep 17, 2013 10:54 pm

siamect wrote:Hi and thats for helping me...
I'm trying to run the setup described here http://www.raspberrypi.org/phpBB3/viewt ... 03#p399603 then is a raspbian image with a bunch of packages. Simulation works fine with the web interface.

I have connected the MAX32 board and compiled and installed the picnc.hex (now configured with spi chan 2) and it seems to work after connecting the miso, mosi, the clock signal, CE, rdy, req, aux and gnd. The LED is flickering faster, I can measure on the signals ok and that the timebase 1 ms is kept (rdy signal).
I have a problem that the E-stop error is always thee so I cannot do anything.

Code: Select all

linuxcnc /opt/linuxcnc/configs/MF70/MF70.ini
LINUXCNC - 2.6.0~pre
Machine configuration directory is '/opt/linuxcnc/configs/MF70'
Machine configuration file is 'MF70.ini'
Starting LinuxCNC...
io started
halcmd loadusr io started
task pid=3071
Found config string X Y Z
Init NML connection
Try to establish NML connection
Try to calloc 1 blocks of 1408 bytes
Try to calloc 1 blocks of 56 bytes
Try to calloc 1 blocks of 17056 bytes
Try to calloc 1 blocks of 17056 bytes
Try to calloc 1 blocks of 17056 bytes
Try to calloc 1 blocks of 17056 bytes
Try to calloc 1 blocks of 17056 bytes
emcTaskInit: using builtin interpreter
Found config string X Y Z
Try to establish NML connection
NML connected
command (EMC_AXIS_INCR_JOG) cannot be executed until the machine is out of E-stop and turned on
command (EMC_AXIS_INCR_JOG) cannot be executed until the machine is out of E-stop and turned on
command (EMC_AXIS_INCR_JOG) cannot be executed until the machine is out of E-stop and turned on
command (EMC_AXIS_INCR_JOG) cannot be executed until the machine is out of E-stop and turned on
command (EMC_AXIS_INCR_JOG) cannot be executed until the machine is out of E-stop and turned on
command (EMC_AXIS_INCR_JOG) cannot be executed until the machine is out of E-stop and turned on
command (EMC_AXIS_INCR_JOG) cannot be executed until the machine is out of E-stop and turned on
I studied the schematic of the Picnc and the Picnc-jr and I can see some differences, the Jr has some Estop signals in the Rpi connector and the picnc does not.

What is the correct, minimal wiring for this to work with the MAX32 board. Where do I connect e-stop and limit switches?
Thanks again.
Martin
Hi,

The e-stop signals are not yet used/configured. Add this to your hal file to disable the e-stop error:

Code: Select all

# estop loopback
#net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in
# this exits the machine out of e-stop
setp iocontrol.0.emc-enable-in true
Note that the original PICnc code is currently not updated. I still have to port the updates I've made on the small PICs.

The minimum signal you'll need are SPI (mosi,miso,sclk), rdy, req, mclr and gnd.
42

siamect
Posts: 8
Joined: Thu Sep 12, 2013 1:57 pm

Re: LinuxCNC

Tue Sep 17, 2013 11:42 pm

Thanks a gazillion :D
Martin

hybris
Posts: 52
Joined: Mon Jun 03, 2013 8:50 pm
Location: Tyrol / Austria

Re: LinuxCNC

Wed Sep 18, 2013 7:50 am

followed your instructions, got no errors but there was no effect on spi.0.position-fb :(
also changed the frequency

what could be the problem?
do you think the problem could be solved by using this setup?
http://www.raspberrypi.org/phpBB3/viewt ... 03#p399603

thanks a lot for your help!

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

Re: LinuxCNC

Wed Sep 18, 2013 8:30 am

hybris wrote:followed your instructions, got no errors but there was no effect on spi.0.position-fb :(
also changed the frequency

what could be the problem?
do you think the problem could be solved by using this setup?
http://www.raspberrypi.org/phpBB3/viewt ... 03#p399603

thanks a lot for your help!
Did the ready signal changed to true?

I think there is an issue with your hardware. Maybe issues with power or with the decoupling capacitors.

Can you try the breadboard version first? Just wire up a basic circuit containing just the pic32 and decoupling caps.
42

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

Re: LinuxCNC

Wed Sep 18, 2013 8:57 am

hybris wrote:followed your instructions, got no errors but there was no effect on spi.0.position-fb :(
also changed the frequency

what could be the problem?
do you think the problem could be solved by using this setup?
http://www.raspberrypi.org/phpBB3/viewt ... 03#p399603

thanks a lot for your help!
Make sure to upgrade both firmware and HAL driver
42

siamect
Posts: 8
Joined: Thu Sep 12, 2013 1:57 pm

Re: LinuxCNC

Wed Sep 18, 2013 1:55 pm

kinsa wrote: The minimum signal you'll need are SPI (mosi,miso,sclk), rdy, req, mclr and gnd.
Hi and thanks for your help.
I tried to only connect those but it didn't work so I added CE but still no luck, then I added AUX and then it works.
I can run it from the web interface.

When I try to run the DISPLAY=mini then I still get these errors no matter wht I try to do:

"command (EMC_AXIS_HOME) cannot be executed until the machine is out of E-stop and turned on"

When I say "it works" it means no apparent errors but I haven't tested the pulse/direction signals yet...

siamect
Posts: 8
Joined: Thu Sep 12, 2013 1:57 pm

Re: LinuxCNC

Wed Sep 18, 2013 2:06 pm

forget what I said, it works with the mini display too.... just some function keys and the thing started working... :D

hybris
Posts: 52
Joined: Mon Jun 03, 2013 8:50 pm
Location: Tyrol / Austria

Re: LinuxCNC

Wed Sep 18, 2013 2:13 pm

slowly but surely i'm stumped :?

first i build up the breadboard circuit
then i flashed the pic with the picnc_bb.hex file, installed the picnc_bb hal driver and unloaded the linux spi driver,
started halrun and typed in:

Code: Select all

loadrt threads name1=test period1=1000000
loadrt siggen
loadrt hal_picnc_bb
setp picnc-bb.0.maxaccel1
setp picnc-bb.0.maxvel 2
setp picnc-bb.0.scale 1000
setp picnc-bb.0.enable 1

addf picnc-bb.read-spi test
addf picnc-bb.stepgen test
addf picnc-bb.write-spi test
start
loadusr halmeter

setp picnc-bb.0.position-cmd 100
i observed the picnc-bb.0.position-fb, but it didn't change the value :(
also i checked the signals with a scope, no usable signals, not the x axis step pin, or dir pin, even the mosi or miso pin didn't show a usable signal

do you have any idea? many thanks! :)
Last edited by hybris on Fri Oct 11, 2013 12:43 pm, edited 1 time in total.

Return to “Automation, sensing and robotics”