Compiling Altivar VFD Modbus comp

More
11 Mar 2015 05:21 #56647 by Swapper
Hi!
i have a problem getting the Altivar VFD Modbus comp to compile on my 2.8 system.

The things i have tried are:
downloaded files from:
git.mah.priv.at/gitweb?p=emc2-dev.git;a=...b0dd7283fe7496741167

Did a:
atv# make
The required program "comp" could not be found
The required program "comp" could not be found
Makefile:7: *** Required files for building components not present. Install emc2-dev. Stop.

Where can i find comp?

i asked in the linuxcnc channel and there is a thing called halcompile, apprently it does not support .c userland comps.
But i tried anyway..

atv# halcompile --compile --userspace atv_vfd.c
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 atv_vfd /tmp/tmpUl75xA/atv_vfd.c -Wl,-rpath,/lib -L/lib -llinuxcnchal
/tmp/tmpUl75xA/atv_vfd.c: In function âmainâ:
/tmp/tmpUl75xA/atv_vfd.c:646:1: warning: the frame size of 4288 bytes is larger than 2560 bytes [-Wframe-larger-than=]
/tmp/ccg3lMd7.o: In function `write_data':
/tmp/tmpUl75xA/atv_vfd.c:233: undefined reference to `preset_single_register'
/tmp/tmpUl75xA/atv_vfd.c:234: undefined reference to `preset_single_register'
/tmp/ccg3lMd7.o: In function `read_data':
/tmp/tmpUl75xA/atv_vfd.c:295: undefined reference to `read_holding_registers'
/tmp/tmpUl75xA/atv_vfd.c:300: undefined reference to `read_holding_registers'
/tmp/tmpUl75xA/atv_vfd.c:305: undefined reference to `read_holding_registers'
/tmp/tmpUl75xA/atv_vfd.c:309: undefined reference to `read_holding_registers'
/tmp/tmpUl75xA/atv_vfd.c:314: undefined reference to `read_holding_registers'
/tmp/ccg3lMd7.o:/tmp/tmpUl75xA/atv_vfd.c:319: more undefined references to `read_holding_registers' follow
/tmp/ccg3lMd7.o: In function `main':
/tmp/tmpUl75xA/atv_vfd.c:515: undefined reference to `modbus_init_rtu'
/tmp/tmpUl75xA/atv_vfd.c:519: undefined reference to `modbus_connect'
/tmp/tmpUl75xA/atv_vfd.c:627: undefined reference to `preset_single_register'
/tmp/tmpUl75xA/atv_vfd.c:628: undefined reference to `preset_single_register'
/tmp/tmpUl75xA/atv_vfd.c:643: undefined reference to `modbus_close'
collect2: error: ld returned 1 exit status
make: *** [atv_vfd] Error 1

All help appreciated.
/Nils

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

More
11 Mar 2015 07:12 - 11 Mar 2015 07:15 #56655 by dgarrett
I experimetned with the files and got it too build run-in-place (no testing)
using the attached zipfile with some name (emc2-->linuxcnc) modifications
$ mkdir /tmp/tst  # make a tst directory in /tmp
$ # copiy the download of atv_vfd.zip to the /tmp/tst/ directory
$ cd /tmp/tst
$ unzip atv_vfd.zip
$ cd atv_vfd
$ source your_rip_root/scripts/rip-environment # real important !
$ make clean         # clean any leftovers
$ make                  # default is to show stuff from the find-* scripts
$ make atv_vfd     # compile -- no errors
$ make install        # install to rip  bin dir (untested)

The code dates to 2011 and doesn't use libmodbus so it probably could use a lot of updates
Attachments:
Last edit: 11 Mar 2015 07:15 by dgarrett. Reason: attach zip file

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

More
11 Mar 2015 20:10 - 11 Mar 2015 20:11 #56675 by Swapper
Hi!
With the version and guidance you supplied i managed to compile the comp!
Thank you!

But when i load it and show the pins they show no values.
Or should it not show the values ?

The serial coms works since i have tested to poll values via "modpoll" software on the same machine on the same comport.
/bin# halrun
halcmd: loadusr atv_vfd -d /dev/ttyACM0 -M -v
halcmd: atv_vfd: device='/dev/ttyACM0', baud=19200, bits=8, parity='even', stopbits=1, address=1, verbose=0
Opening /dev/ttyACM0 at 19200 bauds (even)
halcmd: show pin
Component Pins:
Owner   Type  Dir         Value  Name
     5  bit   OUT         FALSE  atv_vfd.at-speed
     5  bit   IN          FALSE  atv_vfd.enable
     5  bit   OUT         FALSE  atv_vfd.estop
     5  bit   IN          FALSE  atv_vfd.is-estop
     5  float OUT             0  atv_vfd.main-volt
     5  float OUT             0  atv_vfd.max-freq
     5  float OUT             0  atv_vfd.min-freq
     5  bit   OUT         FALSE  atv_vfd.modbus-ok
     5  float OUT             0  atv_vfd.motor-curr
     5  float OUT             0  atv_vfd.motor-power
     5  float OUT             0  atv_vfd.motor-volt
     5  float OUT             0  atv_vfd.out-freq
     5  float OUT             0  atv_vfd.out-rev
     5  float OUT             0  atv_vfd.rat-mot-curr
     5  float OUT             0  atv_vfd.rat-mot-rev
     5  float OUT             0  atv_vfd.rat-mot-volt
     5  float IN              0  atv_vfd.speed-command
     5  bit   IN          FALSE  atv_vfd.spindle-on
     5  s32   OUT             0  atv_vfd.status
     5  bit   OUT         FALSE  atv_vfd.std-mot-freq

halcmd:
Last edit: 11 Mar 2015 20:11 by Swapper.

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

More
12 Mar 2015 05:52 #56718 by andypugh

But when i load it and show the pins they show no values.


What happens if you try
setp atv_vfd.enable 1
?

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

More
20 Mar 2015 04:05 #57024 by Swapper
Nothing happens when i do that.
Is there any good way to debug and see what is being sent out and received?

Any other ideas?

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

More
20 Mar 2015 14:37 #57031 by Swapper
i tried running it and sniffing the serial port and its not putting out any data when i start it.

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

More
20 Mar 2015 17:21 #57032 by andypugh

i tried running it and sniffing the serial port and its not putting out any data when i start it.


If you send other data to ttyACM0 do you see serial port activity?

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

More
20 Mar 2015 19:43 #57033 by fupeama
Hi,
I wrote this program many years ago. Before EMC renames to LINUXCNC.
I had many problems with comunication because only one (from 3) conveter rs232 to rs485 was functional.
I had no success with convert USB to rs485.
At first you can try comercial soft powersuite for ATV to test raw comunication.
I suppose you have setup vfd for modbus comunication. It is describes in file popis.
setup VFD for modbus communication

Drive menu
communication 1.9
modbus network - adress 1
baud rate 38.4
format 8-E-1

command 1.6
ref.1 chanel - modbus
stop key priority - yes
profile - Not separ
ref.2 switching - ch1 active
ref.2 chanel - HMI (Graphic Terminal)
copy channel 1<>2- cmd+ref
F4 key assign - T/K ( you can switch Terminal vs. MODBUS)
HMI cmd. -Bumpless
now you can switch terminal/modbus by F4


you have to set pin enable in LINUXCNC to start read-write loop in program.
pin modbus-ok indicates comunication with atv.
then you can read a write other pins.

sorry for my english :-) I hope you understand what i want to say.
Martin

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

More
25 Mar 2015 01:30 #57156 by Swapper

i tried running it and sniffing the serial port and its not putting out any data when i start it.


If you send other data to ttyACM0 do you see serial port activity?


Hi
Yes the "mb2hal" component works and i can read values from the VFD without much issue.
The downside of using mb2hal is that there are none of the logic built in that there is in the altivar comp.
Tried getting it to run by writing the hex values to the registers in the manual, not much success since i'm a blunt tool on hex conversions...

i have noticed that the com is not closed correctly when i close halrun it keeps running and i have to kill the process with kill -9 and then halrun -U
Then i can start halrun again, to me that indicates a problem with the code that its "looping" and does not catch a exit.

fupeama:
i have successfully commissioned and tried the VFD with the same USB > R485 converter from a windows computer with the schneider software and i can run/configure stop and so with that.
The altivar comp is doing all those init things when it starts to communicate with the VFD, its also looks like it sets back some values when exeting.

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

More
25 Mar 2015 21:08 #57178 by fupeama

i have noticed that the com is not closed correctly when i close halrun it keeps running and i have to kill the process with kill -9 and then halrun -U
Then i can start halrun again, to me that indicates a problem with the code that its "looping" and does not catch a exit.


yes this behavior is in case communication is not established.


Now I try make two serial ports connected back to back by socat

socat -d -d PTY: PTY and read ser port in terminal window
sudo cat /dev/pts/3

run atv_vfd comp and I can see comunication from program. (without vfd) only command from atv_vfd.

you can try run atv_vfd with parram -v (verbose) debug information.

I dont remember exactly, but schneider software uses more sofisticated comumication with vfd.
Have you set up vfd for mdb communication?
Martin

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

Time to create page: 0.128 seconds
Powered by Kunena Forum