huanyang vfd modbus plugin - not working?

More
12 Jun 2015 03:12 #59723 by giggler999
Hi,

I finally got around to fitting a new spindle. Yep it's a cheap chinese huanyang inverter for a 2.2kw (80mm dia.) spindle package.

The good, it works, I've got some electrical noise to sort out with my ESTOP logic but generally I'm happy. However getting Scott's plugin working is another thing.

1). I've it's all wired + powered ok. Manual control works
2). I've got the RS485 chip fitted
3). Spindletalker2 in windows, works if I set the drive to 9600 baud. Iffy probably down to how the C# program is written but it works. The baud issue is in their C# code.
4). Installed linuxcnc plugin, ok. make and make install on my box fine.
5). Had to rename the custom.xml or I forget something like that but it shows on screen
6). When drive in 19200baud, it talks and screen updates with min/max freq.
7). After power button, M3 S10000 and .... drive clicks a relay but nothing
8). M5, relay clicks again (assumed off)

Back in manual mode, buttons work.

OK since comms over RS485 works in both windows (SpindleTalker2) and this plugin, I assume that is not directly the issue.

However, something is not right because it's not turn on the spindle. The state LED on GUI changes from red to green but besides relay click, nothing.

The plugging has a "-v" to turn debugging on, however it appears to be on all the time. I have not changed the modload command and switch is not there but if I run emc from terminal I get all the serial message stuff as if "-v" specified.

I think either the comments and some of the code in Spindletalker2 are wrong or incomplete or the comms in this plug-in are wrong because I looked up what is being sent to turn the spindle on in C# and it's different. Basically the 3rd byte has a comment as being length field and both software set it to 1 however this plugin sends another byte [31] before [crc] which i think is odd.

Here's my log, with a bit of text I added by hand decoding SpindleTalker2

EMC log

I hope I've posted the above code OK for forum rules and all that. Now can any bright spark give me some suggestion?

Regards,

gigger999

Please Log in or Create an account to join the conversation.

More
14 Jun 2015 18:53 #59808 by giggler999
Well know one seems to know then...

I've found a bit more about my machine control issues.

1. I am using EMC2 v2.4.3 under ubuntu. Is this to old?
2. Added more debug. It seems the spindle speed when on, is frequency 1Hz. When stopped 0Hz. The actual S<speed> value does not seem to be passing on to the plug-in.

From custom.hal, it looks like it is connected to the python script:

# connect the spindle RPM to the VFD
# Note: spindle-cmd created by stepconf wizard
net spindle-cmd => spindle-vfd.speed-command


I downloaded the plug-in source from:

github.com/bebro/linuxcnc-huanyang-vfd

but I do not know if there is much difference in versions that other people are running? I do know that it displays the RPM in register units as in 3000 for 24K RPM while I have seen some screen shots of this fixed. It would be good if there was one repository for this plug-in as I have seen other downloads on cnczone, another forum and it is not clear which to take?

Any suggestions would be great...

Regards,

giggler999

Please Log in or Create an account to join the conversation.

More
15 Jun 2015 02:15 #59821 by giggler999
Got a bit further.

I upgraded to linuxcnc 2.6.8. Now the plugin fails to build. I sorted that out and can now make + make install OK. I changed makefile

old:
LFLAGS := -Wl,-rpath,$(LIBDIR) -L$(LIBDIR) -lemchal

replaced:
LFLAGS := -Wl,-rpath,$(LIBDIR) -L$(LIBDIR) -llinuxcnchal

to get building. And "find-modinc" to get "/usr/share/linuxcnc/Makefile.modinc".

I cannot seem to use the serial port in the plug-in anymore.

LINUXCNC - 2.6.8
Machine configuration directory is '/home/giggler/linuxcnc/configs/8x4router'
Machine configuration file is '8x4router.ini'
Starting LinuxCNC...
spindle-vfd: device='/dev/ttyS0', baud=19200, bits=8, parity='none', stopbits=1, address=1, verbose=1, PID=6101
Opening /dev/ttyS0 at 19200 bauds (none)
errno 5
tcsetattr
: Input/output error
spindle-vfd: ERROR: couldn't open serial device
custom.hal:5: hy_vfd exited without becoming ready
Shutting down and cleaning up LinuxCNC...

Actual failing code is:

if (tcsetattr(mb_param->fd, TCSANOW, &tios) < 0) {
perror("tcsetattr\n");

return -1;

}


errno=5, EIO error. Strangely perhaps it is something to do with the linker change I make, i.e. now using library "liblinuxcnchal.so" instread of "libemchal.so"?

Is there another library that I should be using rather than the one I selected because of the name change from emc?

Someone must have some useful thoughts to help with this topic?

Regards,

giggler

Please Log in or Create an account to join the conversation.

More
15 Jun 2015 07:36 #59830 by alan_3301
Have you tried the binary that came with it already?

I'm not familiar with that error, but maybe some instance already has the port open, and it isn't releasing it.
Maybe try rebooting?

The issue with the speed command not reaching the VFD has been discussed here: linuxcnc.org/index.php/english/forum/24-...nc-27?start=30#59299

Please Log in or Create an account to join the conversation.

More
15 Jun 2015 15:02 #59832 by giggler999
alan_3301,

thanks for the reply. I am reading about the speed no passing on now, cheers.

regarding the serial, I thought that so I rebooted but still the same problem. Also after it fails I tried cutecom and that successfully opens the port and uses it so I think it might be a library link issue. Before I changed the library name in Makefile, it was complaining about _IOM_ and then gave out the -femchal line. Odd now that that the setattrib for serial is returning MIO (errno=5) now it has built.

Please Log in or Create an account to join the conversation.

More
25 Aug 2015 04:14 #61762 by craigw
You may have got it working since it's been a couple months since your last post here, but if not, are you sure your RS485 port is ttyS0? Normally that is the first on board COM port. (COM1 in Windows) You also mentioned it works with Spindle Talker in Windows at 9600 baud. You have LinuxCNC configured for 19200, not 9600.


Starting LinuxCNC...
spindle-vfd: device='/dev/ttyS0', baud=19200, bits=8, parity='none', stopbits=1, address=1, verbose=1, PID=6101
Opening /dev/ttyS0 at 19200 bauds (none)
errno 5
tcsetattr
: Input/output error
spindle-vfd: ERROR: couldn't open serial device


-Craig

Please Log in or Create an account to join the conversation.

Time to create page: 0.068 seconds
Powered by Kunena Forum