Hitachi WJ200 Setup

More
09 Aug 2017 22:49 #97265 by gjvander
Hitachi WJ200 Setup was created by gjvander
Hi,

My first post on the forum, and complete noob to Linux. Trying to switch my PCNC1100 over to LinuxCNC. I have a Hitachi WJ200 that I had working with Brains in Mach3. Trying to duplicate setup in some manner, but it has been a struggle. I am also planning to add DL06 to the system, hence the desire for Classicladder.

First thing - I am using the Ch340 RS485 USB device. It appears to work since Modpoll shows correct values (16.90 Hz etc).



I have Classicladder configured with the same parameters:



My question is how do check if Classicladder is talking to the VFD before I start trying to connect pins etc? Can I pull up parameters somewhere and see the 1690 number, for instance? What minimum configuration do I need to in Classicladder under the "Modbus I/O register setup" tab.

I get a communication error from LCNC on startup for Modbus, which makes me think that LCNC is not talking to the VFD.

Regards,

Geo
Attachments:
More
10 Aug 2017 03:01 #97268 by Todd Zuercher
Replied by Todd Zuercher on topic Hitachi WJ200 Setup
There is a modbus driver included with Linuxcnc specifically for the WJ200 VFD.
linuxcnc.org/docs/html/man/man9/wj200_vfd.9.html
Have you given it a try?
More
10 Aug 2017 12:40 #97283 by gjvander
Replied by gjvander on topic Hitachi WJ200 Setup
Yes, I did try the Wj200 driver. My understanding is that it is hard coded to ttyS0 (which I verified when I found the module on Github), while the CH340 mounts as ttyUSB0 on my machine. I did try to do a soft link (ln -s) to map USB0 to ttyS0, and the module does show up in LCNC. However, when I try to use setp to get any type of response out the VFD,I get no results.

So it is a little bit frustrating to debug the system blindly.

I also tried to recompile the driver with USB0 in there, but the amount of errors that followed was highly problematic for somebody like me who is new to Linux. If you are willing to walk me through the process of recompiling, that would be greatly appreciated.

Open to suggestions. Again, my first goal is just to verify that I am seeing any interaction between LCNC and the VFD.

Geo
More
10 Aug 2017 15:14 #97297 by Todd Zuercher
Replied by Todd Zuercher on topic Hitachi WJ200 Setup
My suggestion is that someone really should rewrite this driver so that it can accept different configuration options similar to most of the other VFD drivers. (No, I don't expect you to do that.)

I am no expert at using Halcompile (barely even a novice), but I have used it a couple of times. (With a whole lot of help from others here.)

Tell us exactly what you did? (What files you changed, what you changed in them, and what filenames you saved them as and where and what were the error messages you encountered?)
More
10 Aug 2017 23:19 #97320 by gjvander
Replied by gjvander on topic Hitachi WJ200 Setup
Todd,

Not sure I have the files in the right directory? I just created a directory under my home directory:

/home/gjvander/linuxcnc/VFD

If not corrcet, please be specific about the location.

See below for error.

Geo
Attachments:
More
14 Aug 2017 15:55 #97464 by andypugh
Replied by andypugh on topic Hitachi WJ200 Setup

Todd Zuercher wrote: My suggestion is that someone really should rewrite this driver so that it can accept different configuration options similar to most of the other VFD drivers. (No, I don't expect you to do that.)


Even better, the person who wrote the driver should document the command-line parameters:

github.com/LinuxCNC/linuxcnc/blob/master.../wj200_vfd.comp#L171

It looks like you can use
loadusr wj200 device="/dev/ttyUSB0"

Some experimentation might be required...
More
16 Aug 2017 15:06 #97581 by gjvander
Replied by gjvander on topic Hitachi WJ200 Setup
Andy,

Thanks for the response. I did try a few variation of device parameter, but all of them gave errors.

I will follow up with a post to show what I tried and what errors I got.

On the plus side, I have Classicladder talking to the WJ200 without errors. I can turn on the spindle and set speed with setp commands. Now I have to figure out how to connect to LCNC spindle logic.

Geo
More
17 Aug 2017 14:34 #97629 by andypugh
Replied by andypugh on topic Hitachi WJ200 Setup
It is important not to have spaces between device and = and the string
More
02 Jun 2018 15:57 - 02 Jun 2018 15:58 #111461 by javelin
Replied by javelin on topic Hitachi WJ200 Setup
I am looking at the wj200 as well. If I understand this correctly the loadusr wj200 device="/dev/ttyUSB0" should work will it not? I know the Huanyang vfd drive is "hard coded" to ttyS0 but when using the usb 485 everyone uses ttyUSB0 for connection via the built in driver within lcnc.

I have been debating between going with another huanyang inverter after I blew mine up or upgrading it to the wj200. My problem is that I dont want to sink a lot of time into CL yet. At a later time I may come back to play with that part of lcnc more. It seems that most of the people here use the huanyang inverters for rs485 connections.
Last edit: 02 Jun 2018 15:58 by javelin.
More
06 Jul 2018 07:11 - 06 Jul 2018 07:19 #113537 by oro06
Replied by oro06 on topic Hitachi WJ200 Setup
i'm having same issue , eg unable to change default device value (even if source seems to have this implemented). i'm sure the wj200 is properly connected as
./modpoll -b9600 -d8 -s1 -pnone -r1 -c8 /dev/ttyUSB0 resturn correct value (50.00 Hz) in my case.

starting from base cd install , here what i did to compile the driver having changed the hard coded "/dev/tty0" with "/dev/ttyUSB0"

we need some aditionnal packages

needed packages (modbus-dev and linuxcnc-dev and git for the linuxcnc repo)
sudo apt-get install modbus-dev linuxcnc-dev git

#clone linuxcnc repo
mkdir dev
cd dev
git clone github.com/LinuxCNC/linuxcnc.git

cd linuxcnc/src/hal/user_comps/wj200_vfd

#some include and lib dirs need to be added manually so we need to generate .c from .comp
halcompile --preprocess wj200_vfd.comp
#now wj200_vfd.c is here you can edit it to change/test

#compile to have the cmd line
halcompile --compile wj200_vfd.com
#this will give an error but display the cmd line
#copy then paste it to a new cmd line

#change /tmp/xxxxxxx/wj200_vfd.c to ./wj200_vfd.c
#add at the end -I/usr/include/modbus because modbus.h include is in a subdir (this is a i)
#add -std=c99 because we got a for loop error
#add -lmodus because linker need it (this a L)

so the command should look something like this :
gcc -Os -g -I. -I/usr/realtime-3.4-9-rtai-686-pae/include -I. -I/usr/realtime-3.4-9-rtai-686-pae/include -I/usr/include/i386-linux-gnu -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -fno-math-errno -funsafe-math-optimizations -fno-rounding-math -fno-signaling-nans -fcx-limited-range -mhard-float -DRTAI=3 -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -Wframe-larger-than=2560 -URTAPI -U__MODULE__ -DULAPI -Os -o wj200_vfd ./wj200_vfd.c -Wl,-rpath,/lib -L/lib -llinuxcnchal -lmodbus
gcc -Os -g -I. -I/usr/realtime-3.4-9-rtai-686-pae/include -I. -I/usr/realtime-3.4-9-rtai-686-pae/include -I/usr/include/i386-linux-gnu -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -fno-math-errno -funsafe-math-optimizations -fno-rounding-math -fno-signaling-nans -fcx-limited-range -mhard-float -DRTAI=3 -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -Wframe-larger-than=2560 -URTAPI -U__MODULE__ -DULAPI -Os -o wj200_vfd ./wj200_vfd.c -Wl,-rpath,/lib -L/lib -llinuxcnchal -I/usr/include/modbus -std=c99 -lmodbus


#then you get a binary, it need to be moved to the proper place
#change owner
sudo chown root:root wj200_vfd
#change attributes
sudo chmod 755 wj200_vdf
#save original
sudo mv /usr/bin/wj200_vfd /usr/bin/wj200_vfd.orig
#move the freshly compiled driver
sudo mv wj200_vfd /usr/bin/wj200_vfd

#then start linuxcnc for testing...
Last edit: 06 Jul 2018 07:19 by oro06. Reason: move file to proper place
Time to create page: 0.153 seconds
Powered by Kunena Forum