[ Vfdmod ] An easy VFD control over MODBUS RTU

More
5 years 2 months ago #218636 by Aciera
The VFD is sending you an error code 3 (3rd number in the response)
Which, according to the manual means:

3 = The bit and word values indicated in the request are not accessible in the slave.


So it looks like you've got the registers for the requested values in the VFD wrong.

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

More
5 years 2 months ago #218667 by iforce2d
Replied by iforce2d on topic [ Vfdmod ] An easy VFD control over MODBUS RTU
Thanks Aciera. I used a utility called mbpoll  and this bash script to attempt reads from every register, and I always get the same reply
Code:
#!/bin/bash for i in {0..65535} do    mbpoll -b 9600 -1 -P none -r $i -t 4 -v /dev/ttyUSB0 done
Example run:
Code:
chris@cnc:~$ ./test.sh &> out.txt chris@cnc:~$ grep "failed" out.txt | wc -l 65535
So I guess my problem is not actually related to vfdmod. The VFD is simply rejecting all attempts to even read any register whatsoever.

fwiw I read the VFD manual from cover to cover three times searching for any mention of modbus/RS485 and changed all related parameters as necessary, like this (for YL620):
  P00,01 Start/stop command source -> 3: Motor controlled by Modbus RS485
  P03.00 RS485 baud rate -> 3: 9600bps
  P03.01 RS485 address -> 1
  P03.02 RS485 format -> 2: 8N1
  P07.08 1st frequency selection source -> 5: Modbus RS485 given frequency

Setting the first one prevents me from using the onboard panel to start/stop the motor, so I can tell it is having some effect. The P03 ones are also taking effect because if I don't match them with parameters used by the master then the connection doesn't work at all. The last one (P07.08) I can't really check until the other problems are solved, but I set it to RS485 anyway. I wonder if there is some setting needed that is not mentioned in the manual - that would not surprise me since it's a pretty crap manual, and I've seen other people say that their manual didn't even mention the P00.01 option of 3 as above.

Anyway I've been struggling with this for 16 hours straight now and questioning if it's even worth it, need some sleep...

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

More
5 years 2 months ago #218718 by iforce2d
Replied by iforce2d on topic [ Vfdmod ] An easy VFD control over MODBUS RTU
Just an update on my YL620 woes. I eventually gave up trying to use the RS485 port that would normally be used for external PC control. It simply does not accept any messages at all, and always gives "Illegal data value" no matter what.

I noticed in the manual that the built in LCD panel is also communicating via RS485, at 19200 baud and fixed address of 10. I disconnected it and used a logic analyzer to view the signals it was sending. Turns out the manual was wrong, this link runs at 38400 baud! At least the address was correct, and the signal looks like normal modbus.

Then I connected my USB/RS485 adapter to the plug that the LCD panel had been using, and did a factory reset so that control would be returned to that port. And that.... just worked with no problems.

At least, the connection is ok. No errors and the LED display is green, and in the debug output I can see values are being set in the VFD registers without any faults. Now my next problem is that vfdmod never sends the "RunForward" value to command the spindle to start. Here is my setting for that register:
Code:
[Control] Address=0x2000 RunForwardValue=0x0012 RunReverseValue=0x0022 FaultResetValue=0x0080 StopValue=0x0001
And here is what it sends, no matter what I do in the LinuxCNC GUI:
Code:
vfdmod: setting control word value to 1 (0x0001)... [0A][06][20][00][00][01][42][B1] Waiting for a confirmation... <0A><06><20><00><00><01><42><B1>
I can see the other register (command speed) being changed when I click the + button in the GUI to increase the speed. But of course the spindle will not start if it's continuously being sent the StopValue (0x0001) command. I'm new to LinuxCNC so perhaps I'm missing something, but I thought the spindle should start if I disable e-stop (red cross button), then enable motors (orange power button), then click either forward or reverse for motor direction, and then increase the speed.... right?

YouTube video: 

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

More
5 years 2 months ago - 5 years 2 months ago #218724 by Aciera
Have you made the necessary connections in your hal?

net spindle-cmd-rpm => vfdmod.spindle.rpm-in
net spindle-at-speed <= vfdmod.spindle.at-speed
net spindle-cw spindle.0.forward => vfdmod.control.run-forward
net spindle-ccw spindle.0.reverse => vfdmod.control.run-reverse

[edit]
And if you have, can you see the spindle-cw signal go true in the Hal show tool?
Last edit: 5 years 2 months ago by Aciera.

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

More
5 years 2 months ago #218731 by iforce2d
Replied by iforce2d on topic [ Vfdmod ] An easy VFD control over MODBUS RTU
My HAL had this:

net spindle-cmd-rpm => vfdmod.spindle.rpm-in
net spindle-at-speed <= vfdmod.spindle.at-speed
net spindle-cw => vfdmod.control.run-forward
net spindle-ccw => vfdmod.control.run-reverse

With your suggestion I got this result:
./custom.hal:11: Pin 'spindle.0.forward' does not exist

Thanks for the tip though, because now that you pointed out HAL connections as a possible problem, I noticed that the main .hal file had no matching pins called 'spindle-cw' or 'spindle-ccw'. There were only 'spindle-cmd-rpm' and 'spindle-at-speed' as generated by the stepconf wizard. I added connections like this:

net spindle-cw        => motion.spindle-forward
net spindle-ccw        => motion.spindle-reverse

After this when I click on the forward/reverse buttons I can see the correct values being set in the VFD registers. Everything looks good on the software side now, but..... motor doesn't turn. I wonder if there is some other message that needs to be sent when controlling via the port of the LCD panel. Looks like I will be spending some time with the logic analyzer....

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

More
5 years 2 months ago #218825 by iforce2d
Replied by iforce2d on topic [ Vfdmod ] An easy VFD control over MODBUS RTU
(YL620 again) I spent a long time watching the traffic between the LCD panel and the VFD, and found that the panel basically relays the state of the buttons and dial to the VFD, and the VFD tells the panel which LEDs should be lit, and the target frequency. After this I reconnected my USB/RS485 connector and imitated the panel. All messages and replies are exactly the same, but..... the motor never starts.

After two and a half days of continuous struggle and failure I've had just about enough, so I will be giving up and using PWM control instead. Overall I like this vfdmod though, very nice to use.

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

Time to create page: 0.194 seconds
Powered by Kunena Forum