MODBUS Issue

Post anything you want to discuss with others about the software.

MODBUS Issue

Postby Parkgrr » Tue Mar 30, 2021 6:24 am

Hi Folks!

Banging my head against the wall trying to get UCCNC to talk to my VFD for the first time. I wish I had one question but there's quite a few possible roads. I feel a bit needy asking such a broad question but I'm an absolute n00b in this regard so any advice on how to start narrowing things down is very welcome.

Here are the facts:
UCCNC => Ethernet to RS485 Adapter => Yaskawa GPD 515 G5 VFD

VFD:
-VFD can receive modbus via RS485
-VFD is connected to the RS485 adapter via its two leads which I've confirmed are firmly fixed. The Eth-RS485 adapter I'm using has a ground terminal which is at present unused as my VFD dictates that the Tx/Rx twisted cable's shield should not be terminated anywhere but at the VFD's control circuit.
-VFD's only user variable on-board properties are baud rate, parity, and slave number. It's data bit is fixed at 8 and its stop bit is fixed at 1.
ETH>RS485 ADAPTER:
-the Eth>RS485 adapter comes with a config tool within which I've set data bit, stop bit, parity, and baud to match the VFD as well as a fixed IP. I'm not sure what to do with other params like remote IP, local port, and remote IP and have let them be. I left HTTP port at 80.
UCCNC:
Within ModbusMaster I'm getting a 'connection OK'. To test functionality quickly I've chosen to attempt connection using MODBUSEZ (thanks Dan!) with modbusmaster disabled. Within MODBUSEZ I am set to the following:
COM port 3 (what was found automatically), matching baud and stop bit, Multiple registers (VFD Manual indicates such), and registers set up as follows:

VFD Manual's Addresses
Computing these numbers almost melted my brain but I pulled out
ON/OFF Address: 0001
Frequency Address: 0002
Spindle on CW: 0001
Spindle on CCW: 0003
Spindle off: 0000

Truth be told I have about 0 confidence these are correct. I'm doin my best here.

1. Is there any way I can check that any data is reaching my VFD even if the wrong data? I'm getting no indication from the onboard readout. I've downloaded various serial port/COM monitors to see if I can see what's being passed back and forth but either I'm using the wrong utilities or nothing is being passed back and forth. Any good diagnostic tools for modbus?

2. Do those addresses look right to you?

I will post screenshots tomorrow when I'm back at the machine

Best, thank you so much.
Parkgrr
 
Posts: 18
Joined: Mon Dec 07, 2020 9:12 am

Re: MODBUS Issue

Postby spumco » Tue Mar 30, 2021 11:38 am

Not an expert, but firt thoughts...

1. VFD parameters set to accept external control via MODBUS? i.e. is the VFD programmed properly?
2. A really cheap USB to RS485 converter might be used to check your ETH-RS485 box. Maybe run two terminal programs and see if your computer can 'talk to itself' or to another computer across the serial connection with the two converters.

I'm sure someone else will be along who can be of more help.

-R
spumco
 
Posts: 291
Joined: Mon Oct 03, 2016 10:10 pm

Re: MODBUS Issue

Postby Soler » Tue Mar 30, 2021 8:37 pm

Hi,

A lot of VFD's are different to setup up with Modbus but I'm sure we can get it to work.

For Start/ stop, Forward / Reverse these are all going to the same register 001. The format of the 8 data-bits is then manipulated to get the desired result, I have converted the binary numbers to decimal

A Stop command would look like
00000000 = 0
A Start command would look like
10000000 = 128
Run Forward
1000000 = 128
Run Reverse
1100000 = 192

On your VFD the following parameters need to be set
Parameter b1-01 (180h) should be set to 2
Parameter b1-02 (181h) should be set to 2

Unfortunately the link you provided to the manual runs out after page 6-3!!

How are you communicating to the drive in the software

I have edited the following for a macro loop which should work for you, it reads the status of LEDs on the main UI and then updates the Modbus Master in UCCNC
Code: Select all
string SpindleSpeedValue;   // SetSpindleSpeed screen object string
double SSpeedValue;       // SetSpindleSpeed screen object converted
ushort SFrequency;      // Spindle speed frequency to VFD
ushort RunSpindle = 0;    // Spindle Run
bool SpindleCwLED = AS3.GetLED(50);  //Spindle Cw LED
bool SpindleCcwLED = AS3.GetLED(51);  //Spindle Ccw LED

if(SpindleCwLED)
{
RunSpindle = 128;
}
if(SpindleCcwLED)
{
RunSpindle = 192;
}

//if either forward or revers direction are used, turn the spindle on, else turn off. Please check this as I have not tested this, this should check that neither Forward or reverse are active
if(!SpindleCwLED || !SpindleCcwLED)
{
RunSpindle=0;
}


SpindleSpeedValue = AS3.Getfield(2451);         // Get the Spindle speed from the UI
SSpeedValue = Convert.ToDouble(SpindleSpeedValue);   // Concert string to double
SFrequency = (ushort) (SSpeedValue / 60);      // Frequency = Spindle S-word / 0.6
exec.SetModbusregister(2, SFrequency);         // This frequency will be sent to VFD

exec.SetModbusregister(1, RunSpindle);  // sets run or stop and direction
exec.DospinCW();



Then setup your connection in modbus master and the function to send this to the spindle, in the above example I have used registers 1,2,3 but you can change these, let me know how you get on.

Andy
Modbus Controls for UCCNC and Mach
Wifi Modbus Relay without using pins on your break out board
M-Controls
Soler
 
Posts: 27
Joined: Sun Feb 02, 2020 12:20 am

Re: MODBUS Issue

Postby A_Camera » Wed Mar 31, 2021 7:23 am

Parkgrr wrote:Truth be told I have about 0 confidence these are correct. I'm doin my best here.

Hi,
I am sorry you have issues, but I think unless you find somebody who has the same setup, you must solve it on your own. I would start with reading ALL the manuals once again, starting with the USR ETH - RS485 converter. I use a similar one (USR-TCP232-410s) without issues, but I remember I had some issues to start it up, though that was several years ago and I forgot what the problem was. This is mine:

Image

I don't use the driver Dan created, I am using the Modbus plugin built in the UCCNC. I have a Bosch Rexroth VFD, so not even that is the same as yours. Nevertheless, unless the USR is communicating with your PC properly, you never going to get it right with UCCNC. To check all communication, you must open the monitor window of USR-VCOM server software. I opened also Modbus Master and it looks like this for me. If you see a lot of red then obviously there is a problem. The Data Monitor, as well as the server software COM and NET fields and also Modbus Master are all constantly updated, so it should continuously show green flow of messages. How fast that is, depends on your settings.

Image

It is important that Modbus Master shows all in green over a longer period, if not then you have some issues. Maybe you did not set the communication speed right at all ends...? Check VFD, USR, PC port and UCCNC Modbus Master all the way. Everything must be right. There is a web interface to the USR with different tools, use them to check your device. Also of course, it is important that you have all the codes and addresses for your VFD. I would also fix the IP addresses so the the devices use always the same address.

Anyway, mine has been running like this for several years and I am very happy with the USR converter as well. I have never used the driver Dan created, so I can't help regarding that part. As I understood, Dan is no longer active on any forum, so there is no support for the driver software he created.
A_Camera
 
Posts: 542
Joined: Tue Sep 20, 2016 11:37 am

Re: MODBUS Issue

Postby Parkgrr » Wed Mar 31, 2021 10:22 am

Gentlemen thank you so much for your thoughtful replies!

Andy thank you for those address numbers, I re-did some of my math from scratch based on my understanding below, would love if you wouldn't mind looking at it? Thanks for the macro, unfortunately I wish I knew the first thing about using it :roll: . This if my first motion control project and I'm currently in the 'get the thing running' phase and am just not quite there yet. I'm using Dan's plugin because it essentially asks for command addresses/a few other essentials and does most of the rest. It seems at the moment to be a good way to confirm that I can talk to my VFD, and then I'll likely move back to Modbusmaster (especially since it was mentioned he is no longer active and I might find myself SOL in a few years). I checked those settings you referenced as well as all the rest in my VFD and they are, to my understanding, correct for what I'm trying to do.

I made some progress. I'd fooled myself into thinking that my RS485 adapter was behaving properly as a COM port, however I found out that the plugin was *actually* recognizing the wireless USB pendant I'm using and trying to talk through that, after removing that I saw that the system thought there was no COM serial port at all and was able to troubleshoot connections issues between my system and the RS485 Ethernet adapter. Using the same software you screenshotted @ A_camera I can see that UCCNC is indeed lambasting that VFD with information (looks about identical to what you posted except nothing coming in from 'NET' which is VFD=>COM information I'm assuming).

It's pretty clear that either 1.) What I'm sending the VFD is wack and it can't do anything with it or 2.) I'm not actually communicating with the VFD at all.

I'm getting on the phone with Yaskawa tomorrow about the not communicating at all possibility (their phone support is A+), however in the mean time I wonder if y'all might check my work on what I'm actually sending to the VFD?

Dan's plugin wants a 4 digit hex for the following commands:

Here's what the manual reads + my math on the right
Simultaneous Broadcast registers (write only):
----------Register---Bit no---Data Set ----- register x16 + bit position/number
STOP -------001------ 0 -------0 -------- 1x16 + 0 = 16 or 0010 hex
RUN-------- 001------ 0------- 1 -------- 1x16 + 128 = 144 or 0090 hex
FWD RUN --- 001 ------1------- 0 -------- 1x16 + 0 = 16 or 0010 hex
REV RUN---- 001 ------1------- 1 -------- 1x16 + 64 = 80 or 0050 hex
FREQ REF --- 002------------------------- 0020 hex
[Frequency reference 6000 = 100% (1)]
Parkgrr
 
Posts: 18
Joined: Mon Dec 07, 2020 9:12 am

Re: MODBUS Issue

Postby Soler » Wed Mar 31, 2021 7:19 pm

The steps I would take would be to first setup a connection to the VFD in Modbus master
Screenshot 2021-03-31 at 19.50.39.png


These are the settings I have, set yours accordingly, this is using a USB Adapter but at you are using a Ethernet to RS485 you probably need to use setting like, specifying the IP address etc
these
Screenshot 2021-03-31 at 19.53.24.png


Then you need to add a basic function, we will use the start stop command
This is writing to the register 8192 on my VFD, the value it is writing is the value in UCCNC register 1 (remember these registers start at 0)
For your VFD you only need to write to 2 registers, 001 for start stop fwd and reverse and 002 for freq. To write to register 001 for start and stop, please change 8192 in the picture to 1

Screenshot 2021-03-31 at 19.58.38.png



Click start loops and it should tell you if it is communicating to the VFD, check the time at the end of the function, this should be updating to show there are communication loops taking place.
Screenshot 2021-03-31 at 19.55.54.png


I presume they is a way to check running / FWD / Rev on the VFD display without having the spindle attached. When your ready in the variable table select cell 1 ( not cell 0) and enter a value of 128 to start the spindle or 0 to stop the spindle, the variables are entered as ushort and not Hex numbers in the variable table. This should send the command to the VFD to start or stop the spindle.


Once this is working we can get on to the macro.

Thanks

Andy
Modbus Controls for UCCNC and Mach
Wifi Modbus Relay without using pins on your break out board
M-Controls
Soler
 
Posts: 27
Joined: Sun Feb 02, 2020 12:20 am

Re: MODBUS Issue

Postby Soler » Wed Mar 31, 2021 7:42 pm

Just to add I don't think you will be able to use the plugin from Dan as this is expecting to see a com port and as default the USR ETH - RS485 does not appear as a com port unless you install 2.3.2. VCOM Application mentioned in the manual.

I use one of these to the VFD, DSD TECH SH-U11F Isolated USB to RS485 RS422 Converter, there are also cheaper USB sticks but I found those hit and miss.

Thanks

Andy
Modbus Controls for UCCNC and Mach
Wifi Modbus Relay without using pins on your break out board
M-Controls
Soler
 
Posts: 27
Joined: Sun Feb 02, 2020 12:20 am

Re: MODBUS Issue

Postby A_Camera » Wed Mar 31, 2021 9:00 pm

As Andy says. Follow his advice. The only thing I will add is that I think you should buy a cheap USB RS485 dongle and get started with that. Once that works you can move to the USR ETH virtual port. Right now it is just making things more complicated. An USB dongle costs 5$ so instead of wasting a lot of time, you will waste 5$. That was the way I did as well even though I have 40 years of experince in data communication, electronics and programming. Start simple, especially without previous experience in the field and with the equipment.
A_Camera
 
Posts: 542
Joined: Tue Sep 20, 2016 11:37 am

Re: MODBUS Issue

Postby dezsoe » Wed Mar 31, 2021 9:03 pm

No! He has to use COM port, becuse his USR does not speak Modbus IP. As he wrote he has to install the VCOM virtual COM port driver and use it as a local serial port.
dezsoe
 
Posts: 1421
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: MODBUS Issue

Postby Soler » Wed Mar 31, 2021 9:42 pm

dezsoe wrote:No! He has to use COM port, becuse his USR does not speak Modbus IP. As he wrote he has to install the VCOM virtual COM port driver and use it as a local serial port.



Not sure I agree Dezsoe, a USB to Modbus dongle will work with this VFD making a simpler Com port connection. Once this is up and running and sure the communication is working then it makes the switch over to the USR more simple as only one part of the system is being changed at one time.

Thanks

Andy
Modbus Controls for UCCNC and Mach
Wifi Modbus Relay without using pins on your break out board
M-Controls
Soler
 
Posts: 27
Joined: Sun Feb 02, 2020 12:20 am

Next

Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: laki and 9 guests