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

Re: LinuxCNC

Thu Nov 06, 2014 4:14 am

Btw, make sure the fets are driven ti saturation. Maybe you'll need an additional driver in between the output pin and fet gate.
42

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

Re: LinuxCNC

Thu Nov 06, 2014 1:27 pm

Using these:
https://www.fairchildsemi.com/datasheet ... 6670AS.pdf

For a Vgs of 3.0V and a Vds of 5V my Id should peek out around 30A which is way overkill for my application.

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

Re: LinuxCNC

Sat Nov 08, 2014 6:46 am

kinsa what does the stepwidth do in the LinuxCNC HAL driver?

ie:
txBuf[0] = 0x4746433E; /* this is config data (>CFG) */
txBuf[1] = stepwidth;


I know very little about how LinuxCNC HAL works but if I am guessing correctly it looks like it only gets called once during start up.
Does sound right?

Looking to add hardware PWM to the code. I think I have the pic end sorted out but want to be able to modify the base freq without recompiling / reprogramming pic. Depending on what stepwidth does thinking of taking over the upper 16 bits and using it to set the divider of the PWM timer.

As for the channel control was just going to add a new set of commands to set the PWM when needed.

Under what conditions would stepwidth need to be changed and can it be changed on the fly?

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

Re: LinuxCNC

Sat Nov 08, 2014 6:59 am

Wire wrote:kinsa what does the stepwidth do in the LinuxCNC HAL driver?

ie:
txBuf[0] = 0x4746433E; /* this is config data (>CFG) */
txBuf[1] = stepwidth;


I know very little about how LinuxCNC HAL works but if I am guessing correctly it looks like it only gets called once during start up.
Does sound right?

Looking to add hardware PWM to the code. I think I have the pic end sorted out but want to be able to modify the base freq without recompiling / reprogramming pic. Depending on what stepwidth does thinking of taking over the upper 16 bits and using it to set the divider of the PWM timer.

As for the channel control was just going to add a new set of commands to set the PWM when needed.

Under what conditions would stepwidth need to be changed and can it be changed on the fly?
The stepwidth is the maximum width of the step pulse for the stepper driver.

Here's the old code that implements PWM https://gist.github.com/kinsamanka/94ba7940e4e222c844c8, I just haven't had the time to update the current code :)

Hope this helps.
42

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

Re: LinuxCNC

Sat Nov 08, 2014 7:08 am

Btw, that code is for pic32mx764. I'll try to update the PICnc-V2 code later.
42

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

Re: LinuxCNC

Sat Nov 08, 2014 9:09 am

Is there any way for LinuxCNC to update that value without recompiling the HAL driver? Or is that just a build time value.

Thanks again will take a look at the sample code. Got most of the updates done but have not had a chance to test it yet.

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

Re: LinuxCNC

Sat Nov 08, 2014 9:16 am

Wire wrote:Is there any way for LinuxCNC to update that value without recompiling the HAL driver? Or is that just a build time value.

Thanks again will take a look at the sample code. Got most of the updates done but have not had a chance to test it yet.
You mean the step width? It's a run time parameter which you set when you load the hal driver:

Code: Select all

loadrt picnc stepwidth=n
I'll upload the new code today.
42

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

Re: LinuxCNC

Sat Nov 08, 2014 11:57 am

I've pushed the updated code with PWM support on the output pins.

It can be enabled by adding the following to the hal file:

Code: Select all

setp picnc.xxx.pwm.enable 1
Where xxx is either spindle, mist or flood.

The name for the PWM input pin is

Code: Select all

picnc.xxx.pwm.duty
The PWM freq is set to 1 kHz but can be changed using the pwmfreq parameter in Hz:

Code: Select all

loadrt picnc pwmfreq=n
Do note that this is hot off the press, I don't have the hardware to test at the moment ;)

Cheers
42

JASM123
Posts: 54
Joined: Fri Sep 19, 2014 3:25 am

Re: LinuxCNC

Tue Nov 11, 2014 3:41 am

Hi kinsa I tried to modified the MF70.ini to obtain a great velocity of my motors, how can I change the mode (full, half,... step) in the MF70.ini file??

Regards

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

Re: LinuxCNC

Tue Nov 11, 2014 3:48 am

The step gen code maxes out at 40kHz with the PICnc V2. To change the step mode you need to change the strapping on the stepper motor drivers. Not sure which ones your using but mine support 1/16, 1/8, 1/4, 1/2, and 1. Note as you go up from 1/16 to 1 your total speed will double but your total resolution is cut in half. Also note there can be some weirdness (lost steps) if running in full step mode with some drivers and motor setups.

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

Re: LinuxCNC

Tue Nov 11, 2014 5:35 am

Also play with the acceleration settings. Just make sure the stepgen value is at least 1.5 times the max value.
42

JASM123
Posts: 54
Joined: Fri Sep 19, 2014 3:25 am

Re: LinuxCNC

Fri Nov 14, 2014 2:57 pm

Hello Kinsa
I have realized testing for the stepper motor and Linux CNC, but when I tried to move with the JOG button (+ and -) the motor doesn't rotate, I disable the E pin (Enable for the pololu Drivers A4988) and the motor already rotates but after I push many times the JOG button it sent me error and the Stop Indicator/button turns to green. What will be the problem??
note the Home inputs are enable to +5v

thank you so much and regards

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

Re: LinuxCNC

Fri Nov 14, 2014 3:08 pm

JASM123 wrote:Hello Kinsa
I have realized testing for the stepper motor and Linux CNC, but when I tried to move with the JOG button (+ and -) the motor doesn't rotate, I disable the E pin (Enable for the pololu Drivers A4988) and the motor already rotates but after I push many times the JOG button it sent me error and the Stop Indicator/button turns to green. What will be the problem??
note the Home inputs are enable to +5v

thank you so much and regards
Please post some error logs or screenshots.
42

JASM123
Posts: 54
Joined: Fri Sep 19, 2014 3:25 am

Re: LinuxCNC

Fri Nov 14, 2014 3:59 pm

Hi kinsa
I'm in the College, right now , when I arrive in my house I post the screenshot, but basically I move my motor in manually mode, whit the JOG and the motor moves (when I disable the Pin 6 (EN) of the pic32 to the pololu Driver), but after certain time it sent me this error.
Thank you, when I arrive to my home I post the screenshot

JASM123
Posts: 54
Joined: Fri Sep 19, 2014 3:25 am

Re: LinuxCNC

Fri Nov 14, 2014 10:11 pm

Hi kinsa
There are the error that occurs when I tried to move for a long time the JOG in this case de axis 0 (x), first I couldn't can move the axis when the pin 6 of pic32 is connected to my pololu driver in the Enable Pin for this I have to disable this pin to move with the JOG X the motor.
Attachments
Error JOG_terminal.gif
Error JOG_terminal.gif (15.18 KiB) Viewed 3158 times

JASM123
Posts: 54
Joined: Fri Sep 19, 2014 3:25 am

Re: LinuxCNC

Fri Nov 14, 2014 10:20 pm

and this is the error in Linux CNC interface, I have to connect the pin6 of pic32 to the enable pin of the pololu driver , is necessary this connection????

regards
Attachments
JOGXinterface.gif
JOGXinterface.gif (55.31 KiB) Viewed 3157 times

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

Re: LinuxCNC

Fri Nov 14, 2014 10:32 pm

Can you please post your hal and ini file? It looks like your acceleration setting is too high.
42

JASM123
Posts: 54
Joined: Fri Sep 19, 2014 3:25 am

Re: LinuxCNC

Fri Nov 14, 2014 10:43 pm

The hal file and the INI file are same that your files, I have no changed anything. https://gist.github.com/kinsamanka/318d75851d803a7311c7

JASM123
Posts: 54
Joined: Fri Sep 19, 2014 3:25 am

Re: LinuxCNC

Fri Nov 14, 2014 10:46 pm

I don't have connected the CS pin to the pin 25 of the pic32 because I don't know what number of pin is the CS in the raspberry this could be the problem??

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

Re: LinuxCNC

Fri Nov 14, 2014 11:26 pm

Open up a terminal and run halmeter and monitor the ready and spi fault signals.
42

JASM123
Posts: 54
Joined: Fri Sep 19, 2014 3:25 am

Re: LinuxCNC

Fri Nov 14, 2014 11:45 pm

It sent me the next error:
Attachments
halmeter.gif
halmeter.gif (10.97 KiB) Viewed 3059 times

JASM123
Posts: 54
Joined: Fri Sep 19, 2014 3:25 am

Re: LinuxCNC

Sat Nov 15, 2014 12:09 am

Sorry kinsa I didn't remembering how to run this but remember too, this is the result: it send me a false in the halmeter and in the monitor it sen me a "extension RANDR missing on display 10.0
Attachments
Halrun.gif
Halrun.gif (46.88 KiB) Viewed 3043 times

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

Re: LinuxCNC

Sat Nov 15, 2014 12:17 am

How were you able to do the halrun tests then? That's the first time I've seen that error.

You can also run:

Code: Select all

halcmd show picnc.ready
halcmd show picnc.spi_fault
42

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

Re: LinuxCNC

Sat Nov 15, 2014 12:18 am

Monitor it after the error happens.
42

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

Re: LinuxCNC

Sat Nov 15, 2014 12:20 am

JASM123 wrote:and this is the error in Linux CNC interface, I have to connect the pin6 of pic32 to the enable pin of the pololu driver , is necessary this connection????

regards
Pin 6 should be connected.

CS pin is not used in this setup.
42

Return to “Automation, sensing and robotics”