rs485 huanyang speed control
- sw3Dp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 1
11 Jun 2016 18:59 #75830
by sw3Dp
rs485 huanyang speed control was created by sw3Dp
I'm trying to follow a method laid out in by Marco Reps.
Using the custom Hal coding: loadusr -Wn vfd hy_vfd -n vfd -d /dev/ttyUSB0 -p none -r 9600, just generates errors as it can't load /dev/ttyUSB0 or any usb#. Can someone explain in basic terms what this line is doing and what it might look like on my machine, do I need hardware support for the r485? (using linuxcnc 2.7)
Anyone get a hal mod to work for rs485 spindle speed control?
... also is there code i can 'cut and paste' for a z touch plate routine?
Using the custom Hal coding: loadusr -Wn vfd hy_vfd -n vfd -d /dev/ttyUSB0 -p none -r 9600, just generates errors as it can't load /dev/ttyUSB0 or any usb#. Can someone explain in basic terms what this line is doing and what it might look like on my machine, do I need hardware support for the r485? (using linuxcnc 2.7)
Anyone get a hal mod to work for rs485 spindle speed control?
... also is there code i can 'cut and paste' for a z touch plate routine?
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23563
- Thank you received: 4859
11 Jun 2016 19:20 #75831
by andypugh
Yes, you need some sort of hardware support for RS485. What exactly do you have the VFD plugged in to?
The way that I worked out what my USB-to-RS485 dongle was was to open a terminal and typeThen I plugged in the USB dongle, repeated the command, and compared the two lists to see what the new device was.
In my case it was ttyUSB0
If your VFD is not connected to a USB-485 converter then the correct device will be different, but it will need to be one of the devices in /dev/
The meaning of the command is described in the hy_vfd manual page
linuxcnc.org/docs/2.7/html/man/man1/hy_vfd.1.html
The syntax of the loadusr command is here:
linuxcnc.org/docs/2.7/html/man/man1/halcmd.1.html
Replied by andypugh on topic rs485 huanyang speed control
Using the custom Hal coding: loadusr -Wn vfd hy_vfd -n vfd -d /dev/ttyUSB0 -p none -r 9600, just generates errors as it can't load /dev/ttyUSB0 or any usb#. Can someone explain in basic terms what this line is doing and what it might look like on my machine, do I need hardware support for the r485?
Yes, you need some sort of hardware support for RS485. What exactly do you have the VFD plugged in to?
The way that I worked out what my USB-to-RS485 dongle was was to open a terminal and type
ls /dev/tty*
In my case it was ttyUSB0
If your VFD is not connected to a USB-485 converter then the correct device will be different, but it will need to be one of the devices in /dev/
The meaning of the command is described in the hy_vfd manual page
linuxcnc.org/docs/2.7/html/man/man1/hy_vfd.1.html
The syntax of the loadusr command is here:
linuxcnc.org/docs/2.7/html/man/man1/halcmd.1.html
Please Log in or Create an account to join the conversation.
- sw3Dp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 1
11 Jun 2016 21:20 #75835
by sw3Dp
Replied by sw3Dp on topic rs485 huanyang speed control
vfd 2.2kw and 2.2kw 24000 spindle motor, gecko g540, usb to r485 out to rs+ rs- on vfd. Used spindle talker2/windows and though the com port occasionally connected I get the error that "vfd is not responding". Not quiet there on understanding linux, usb port., does usb-rs485(www.ebay.com/itm/331849241245?_trksid=p2...e=STRK%3AMEBIDX%3AIT) needs additional drivers? I am finding more topics scattered in forum but rarely understand as there is an infinite variations of linuxcnc config possibilities. Could be the vfd settings?? it's configured with standard settings. Like tons of asian usb devices they almost make good connection sometimes but flexing the connection from the weight of the wires doesn't help.
... I have read all the hal and linux guides but little of it makes it to understanding so apologies if 'I can't get there from here.'
settings:
PD001=2
PD002=2
PD003=400
PD004=400
PD005=400
PD011=0
PD044=3
PD045=3
PD046=4
PD072=400
PD143=2
PD144=3000
PD163=1
PD164=1
PD165=3
what I would give to get pre-configured stable full house linuxcnc/linux image to start.
... I have read all the hal and linux guides but little of it makes it to understanding so apologies if 'I can't get there from here.'
settings:
PD001=2
PD002=2
PD003=400
PD004=400
PD005=400
PD011=0
PD044=3
PD045=3
PD046=4
PD072=400
PD143=2
PD144=3000
PD163=1
PD164=1
PD165=3
what I would give to get pre-configured stable full house linuxcnc/linux image to start.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23563
- Thank you received: 4859
11 Jun 2016 23:07 #75838
by andypugh
Not as far as I could tell. I used an identical thing and it just worked.
I got a bit elaborate, but only for aesthetic reasons:
forum.linuxcnc.org/forum/18-computer/306...485-connection#72351
The big question is do you see the dongle in /dev/ ?
For me it all "just worked". I plugged in the dongle, a new device appeared in /dev/ and I used that in the loadusr command and there was my VFD.
You do need to configure the VFD as defined in the hy_vfd manpage.
Replied by andypugh on topic rs485 huanyang speed control
does usb-rs485(www.ebay.com/itm/331849241245?_trksid=p2...e=STRK%3AMEBIDX%3AIT) needs additional drivers?
Not as far as I could tell. I used an identical thing and it just worked.
I got a bit elaborate, but only for aesthetic reasons:
forum.linuxcnc.org/forum/18-computer/306...485-connection#72351
The big question is do you see the dongle in /dev/ ?
For me it all "just worked". I plugged in the dongle, a new device appeared in /dev/ and I used that in the loadusr command and there was my VFD.
You do need to configure the VFD as defined in the hy_vfd manpage.
Please Log in or Create an account to join the conversation.
- sw3Dp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 1
12 Jun 2016 05:43 - 12 Jun 2016 16:36 #75846
by sw3Dp
Replied by sw3Dp on topic rs485 huanyang speed control
yes, see the dongle /dev/ ttyUSB0
None of this makes sense fresh stepconf, my vfd settings match the hy_vfd listed settings with the exception of baud rate PD164=1 for 9600 as written in the custom hal, however I changed PD164=2 and it made no dif. Windows can see the dongle, /dev/ sees it but all linuxcnc gives me is the "cannot open com port errno 22." Could it be the vfd failure to communicate or is this a dongle failure (ordered a couple to test). Shouldn't the custom hal load even if the vfd isn't powered?. Nothing more disheartening that hearing "all just worked" so something isn't working here, not the wiring just two connections, not settings, not code(loadusr -Wn vfd hy_vfd -n vfd -d /dev/ttyUSB0 -p none -r 9600)?, all I'm left with is fault with vfd or dongle I'm praying that it's the $4 dongle as this alternative is a nightmare.
None of this makes sense fresh stepconf, my vfd settings match the hy_vfd listed settings with the exception of baud rate PD164=1 for 9600 as written in the custom hal, however I changed PD164=2 and it made no dif. Windows can see the dongle, /dev/ sees it but all linuxcnc gives me is the
Last edit: 12 Jun 2016 16:36 by sw3Dp.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23563
- Thank you received: 4859
12 Jun 2016 10:12 - 12 Jun 2016 10:14 #75848
by andypugh
Replied by andypugh on topic rs485 huanyang speed control
I am using a rather simpler "loadusr" line. Your version is trying to give the component and the pins different names. Mine is
Does your ttyUSB0 disappear when you unplug the dongle?
I am a bit puzzled by the error message you are getting, unless you have paraphrased it? The error message here is different:
github.com/LinuxCNC/linuxcnc/blob/master...g-vfd/hy_comm.c#L695
It might be worth turning on debug mode. In fact it is probably worth doing some testing in a terminal window to take everything else out of the system. Using the -g flag will give more info about what is going on.
Open a terminal window and type:If you don't get an error at this point, then things are looking good, and you can tryto see if comms starts to happen and the motor turns
loadusr -W hy_vfd -d /dev/ttyUSB0
Does your ttyUSB0 disappear when you unplug the dongle?
I am a bit puzzled by the error message you are getting, unless you have paraphrased it? The error message here is different:
github.com/LinuxCNC/linuxcnc/blob/master...g-vfd/hy_comm.c#L695
It might be worth turning on debug mode. In fact it is probably worth doing some testing in a terminal window to take everything else out of the system. Using the -g flag will give more info about what is going on.
Open a terminal window and type:
halrun
loadusr -W -g hy_vfd -d /dev/ttyUSB0
show pin
setp hy_vfd.enable 1
setp hy_vfd.speed-command 600
setp hy_vfd.spindle-forward 1
setp hy_vfd.spindle-on 1
Last edit: 12 Jun 2016 10:14 by andypugh.
The following user(s) said Thank You: jbar
Please Log in or Create an account to join the conversation.
- sw3Dp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 1
12 Jun 2016 16:29 #75861
by sw3Dp
Replied by sw3Dp on topic rs485 huanyang speed control
I keep thinking there must be a typo somewhere but don't see it and the errors make me think I haven't got linux on the pc correctly using a live debian-wheezy would doing an dual boot install load differently? Going to run a cat5 to the garage see if that triggers something (then I'm just going to flap my wings and see if that helps.)
When the dongle is unplugged /dev/ is empty
halrun
loadusr -W -g hy_vfd -d /dev/ttyUSB0
loadusr: invalid option -- 'g'
then tried
loadusr -W hy_vfd -d/dev/ttyUSB0
open: permission denied
ERROR Can't open the device /dev/ttyUSB0 (errno 13)
here is boot log from linuxcnc 2.7, see error msg
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/realtime-3.4-9-rtai-686-pae/modules/linuxcnc
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.5
LINUXCNC - 2.7.0
Machine configuration directory is '/home/user/linuxcnc/configs/sw3Dp'
Machine configuration file is 'sw3Dp.ini'
INIFILE=/home/user/linuxcnc/configs/sw3Dp/sw3Dp.ini
PARAMETER_FILE=linuxcnc.var
TASK=milltask
HALUI=halui
DISPLAY=axis
Starting LinuxCNC...
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
Starting HAL User Interface program: halui
Found file(REL): ./sw3Dp.hal
Found file(REL): ./custom.hal
ERROR Can't open the device /dev/ttyUSB0 (errno 22)
vfd: ERROR: couldn't open serial device
Shutting down and cleaning up LinuxCNC...
Killing task linuxcncsvr, PID=4435
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
Debug file information:
open: Permission denied
./custom.hal:4: waitpid failed hy_vfd vfd
./custom.hal:4: hy_vfd exited without becoming ready
4435
PID TTY STAT TIME COMMAND
Stopping realtime threads
When the dongle is unplugged /dev/ is empty
halrun
loadusr -W -g hy_vfd -d /dev/ttyUSB0
loadusr: invalid option -- 'g'
then tried
loadusr -W hy_vfd -d/dev/ttyUSB0
open: permission denied
ERROR Can't open the device /dev/ttyUSB0 (errno 13)
here is boot log from linuxcnc 2.7, see error msg
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/realtime-3.4-9-rtai-686-pae/modules/linuxcnc
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.5
LINUXCNC - 2.7.0
Machine configuration directory is '/home/user/linuxcnc/configs/sw3Dp'
Machine configuration file is 'sw3Dp.ini'
INIFILE=/home/user/linuxcnc/configs/sw3Dp/sw3Dp.ini
PARAMETER_FILE=linuxcnc.var
TASK=milltask
HALUI=halui
DISPLAY=axis
Starting LinuxCNC...
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
Starting HAL User Interface program: halui
Found file(REL): ./sw3Dp.hal
Found file(REL): ./custom.hal
ERROR Can't open the device /dev/ttyUSB0 (errno 22)
vfd: ERROR: couldn't open serial device
Shutting down and cleaning up LinuxCNC...
Killing task linuxcncsvr, PID=4435
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
Debug file information:
open: Permission denied
./custom.hal:4: waitpid failed hy_vfd vfd
./custom.hal:4: hy_vfd exited without becoming ready
4435
PID TTY STAT TIME COMMAND
Stopping realtime threads
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23563
- Thank you received: 4859
12 Jun 2016 16:57 #75863
by andypugh
Error code 13 (according to a Google search) is a permissions problem.
I wonder if you are running from a normal user account rather than an admin account?
Maybe try plugging in the dongle and
Replied by andypugh on topic rs485 huanyang speed control
Odd, the manpage says that works. But never mind.loadusr -W -g hy_vfd -d /dev/ttyUSB0
loadusr: invalid option -- 'g'
loadusr -W hy_vfd -d/dev/ttyUSB0
open: permission denied
ERROR Can't open the device /dev/ttyUSB0 (errno 13)
Error code 13 (according to a Google search) is a permissions problem.
I wonder if you are running from a normal user account rather than an admin account?
Maybe try plugging in the dongle and
sudo chmod 666 /dev/ttyUSB0
halrun
loadusr -W hy_vfd -d /dev/ttyUSB0
show pin
exit
Please Log in or Create an account to join the conversation.
- sw3Dp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 1
12 Jun 2016 17:19 #75864
by sw3Dp
Replied by sw3Dp on topic rs485 huanyang speed control
I think you may be right there seems to be a deficiency in my linux understanding user accounts will try working that ... in the meantime tried calling on the beast for help and it produced this
halcmd: show pin
Component Pins:
Owner Type Dir Value Name
5 float OUT 0 hy_vfd.ACV
5 float OUT 0 hy_vfd.CNST
5 bit OUT FALSE hy_vfd.CNST-bracking
5 bit OUT FALSE hy_vfd.CNST-command-rf
5 bit OUT FALSE hy_vfd.CNST-jog
5 bit OUT FALSE hy_vfd.CNST-jogging
5 bit OUT FALSE hy_vfd.CNST-run
5 bit OUT FALSE hy_vfd.CNST-running
5 bit OUT FALSE hy_vfd.CNST-running-rf
5 bit OUT FALSE hy_vfd.CNST-track-start
5 float OUT 0 hy_vfd.CNTR
5 float OUT 0 hy_vfd.Cont
5 float OUT 0 hy_vfd.DCV
5 float OUT 0 hy_vfd.OutA
5 float OUT 0 hy_vfd.OutF
5 float OUT 0 hy_vfd.Rott
5 float OUT 0 hy_vfd.SetF
5 float OUT 0 hy_vfd.Tmp
5 bit IN FALSE hy_vfd.enable
5 float OUT 0 hy_vfd.freq-lower-limit
5 float OUT 0 hy_vfd.frequency-command
5 bit OUT FALSE hy_vfd.hycomm-ok
5 float OUT 0 hy_vfd.max-freq
5 float OUT 0 hy_vfd.rated-motor-current
5 float OUT 0 hy_vfd.rated-motor-rev
5 float OUT 0 hy_vfd.rated-motor-voltage
5 float IN 0 hy_vfd.speed-command
5 bit OUT FALSE hy_vfd.spindle-at-speed
5 float IN 0.02 hy_vfd.spindle-at-speed-tolerance
5 bit IN FALSE hy_vfd.spindle-forward
5 bit IN FALSE hy_vfd.spindle-on
5 bit IN FALSE hy_vfd.spindle-reverse
5 float OUT 0 hy_vfd.spindle-speed-fb
halcmd: show pin
Component Pins:
Owner Type Dir Value Name
5 float OUT 0 hy_vfd.ACV
5 float OUT 0 hy_vfd.CNST
5 bit OUT FALSE hy_vfd.CNST-bracking
5 bit OUT FALSE hy_vfd.CNST-command-rf
5 bit OUT FALSE hy_vfd.CNST-jog
5 bit OUT FALSE hy_vfd.CNST-jogging
5 bit OUT FALSE hy_vfd.CNST-run
5 bit OUT FALSE hy_vfd.CNST-running
5 bit OUT FALSE hy_vfd.CNST-running-rf
5 bit OUT FALSE hy_vfd.CNST-track-start
5 float OUT 0 hy_vfd.CNTR
5 float OUT 0 hy_vfd.Cont
5 float OUT 0 hy_vfd.DCV
5 float OUT 0 hy_vfd.OutA
5 float OUT 0 hy_vfd.OutF
5 float OUT 0 hy_vfd.Rott
5 float OUT 0 hy_vfd.SetF
5 float OUT 0 hy_vfd.Tmp
5 bit IN FALSE hy_vfd.enable
5 float OUT 0 hy_vfd.freq-lower-limit
5 float OUT 0 hy_vfd.frequency-command
5 bit OUT FALSE hy_vfd.hycomm-ok
5 float OUT 0 hy_vfd.max-freq
5 float OUT 0 hy_vfd.rated-motor-current
5 float OUT 0 hy_vfd.rated-motor-rev
5 float OUT 0 hy_vfd.rated-motor-voltage
5 float IN 0 hy_vfd.speed-command
5 bit OUT FALSE hy_vfd.spindle-at-speed
5 float IN 0.02 hy_vfd.spindle-at-speed-tolerance
5 bit IN FALSE hy_vfd.spindle-forward
5 bit IN FALSE hy_vfd.spindle-on
5 bit IN FALSE hy_vfd.spindle-reverse
5 float OUT 0 hy_vfd.spindle-speed-fb
Please Log in or Create an account to join the conversation.
- sw3Dp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 1
12 Jun 2016 19:05 - 12 Jun 2016 19:08 #75870
by sw3Dp
Replied by sw3Dp on topic rs485 huanyang speed control
Thank you andypugh for chasing my tail with me, much ado about nothing!! Such an idiot to have avoided dual boot pc ... learning curves, (fingers must be fully extended when flapping wings.)
I had been just running off a live disc install, seems obvious now, that didn't give me permission to really use linuxcnc, explains a lot of glitches and miss steps, now I gots speed and accuracy. No doubt the root cause of why the g540 with relay wasn't controlling the spindle but I like the simplified wiring of the rs485, like you said 'all too easy' when done properly.
Just had to really install linux first, live disc is FUBAR, but it inspired me to find simplified wiring and hook the garage to network, no more thumb drives.
I had been just running off a live disc install, seems obvious now, that didn't give me permission to really use linuxcnc, explains a lot of glitches and miss steps, now I gots speed and accuracy. No doubt the root cause of why the g540 with relay wasn't controlling the spindle but I like the simplified wiring of the rs485, like you said 'all too easy' when done properly.
Just had to really install linux first, live disc is FUBAR, but it inspired me to find simplified wiring and hook the garage to network, no more thumb drives.
Last edit: 12 Jun 2016 19:08 by sw3Dp.
Please Log in or Create an account to join the conversation.
Time to create page: 0.080 seconds