wj200_vfd failed setp wj200_vfd.0.mbslave (solved)

More
22 Feb 2016 07:35 #70470 by bob8020
Very happy to have found linuxcnc, I'm new to CNC but had no difficulty in the setup of an XYX gantry router, using a Mesa 7i76 to steppers and a Hitachi WJ200 VFD using FWD, REV and 0-10v analog frequency control inputs. Everything about LinuxCNC has been very intuitive and easy to use.

So of course I tried to add modbus (mostly to read back WJ200 status) and it is *almost* working... but not quite.

My .hal file is created using the pncconf wizard. Then I manually added these two lines to the .hal file right after the other loadrt lines:

loadusr -W wj200_vfd
setp wj200_vfd.0.mbslaveaddr 1

Unfortunately after adding those two lines, linuxcnc fails immediately with this error:

LINUXCNC - 2.7.4
...
./my_LinuxCNC_machine.hal:12: parameter or pin 'wj200_vfd.0.mbslaveaddr' not found
...

If I leave out the setp then things start up OK but of course wj200_vfd does nothing. I looked at the source and have read the very helpful postings from Eric (green751) but don't understand what I am doing wrong.

I was able to confirm that the rs485 connection is OK. It uses /dev/ttyS0 through a converter to RS-485, and tested like this:

modpoll -m rtu -b 9600 -d 8 -s 1 -p none -r 2 /dev/ttyS0

I can see the actual VFD frequency from the above modpoll command, and it changes as I change the frequency from the keypad on the VFD, so I think that the modbus hardware is all working fine.

In fact, by leaving out the setp command in the .hal file, I can actually run linuxcnc and use the Mesa analog output to vary the spindle output while watching the speed change in a terminal window running modpoll. So I think that all the hardware is likely OK and I am making some newby mistake in those two lines in the .hal file. Of course, while trying to run modbus within linuxcnc, I was *not* using modpoll, as obviously we don't want two programs talking to the same serial port. The modpoll test was only to check the physical wiring to the VFD. I also tried setting the Hitachi to modbus input (a couple A commands) that made no difference.

As an experiment, I did also pull a source tree and change the array in wj200_vfd.comp from [10] to [16] but no change in results.

Thanks in advance to anyone who can clue me in as to getting modbus alive.

***SOLVED***

In some linuxcnc postings i.e. June 10, 2014 on the setp line says wj200_vfd and I notice that the driver is installed as /usr/bin/wj200_vfd

Fortunately, just as I was about to post the above asking for help, I found one more posting from Mar 9, 2015 that has the setp wj200-vfd

Yes, the param name has a hyphen, while pretty much everywhere else we use an underscore.

The fix is to add this to the .hal

loadusr -W wj200_vfd
setp wj200-vfd.0.mbslaveaddr 1

So I wanted to post this to maybe help the next person with a Hitachi VFD as this was not at all obvious and even after staring at the code. Also it was less than obvious how to read the VFD using modpoll, so maybe that command will help someone too

Cheers,

Bob

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

Time to create page: 0.052 seconds
Powered by Kunena Forum