Delta MS300 VFD, RS485, RPI4, QTdragon, getting it to work

More
04 Jan 2024 11:02 - 04 Jan 2024 11:20 #289755 by Calysto
I'm trying to get my VFD to work via RS485. I've tried al kinds of things, one thing i know, is that is does communicatie via /dev/ACM0. I used the standard drivers like GS2 for that, but those drivers don't seem to have the right communications with my VFD.

I looked at M2BHAL and classic ladder, but that is just to complicated. Thats hard to say... :-)
I don't know anything about modbus, but I do understand DMX (for lighting, that's a similar protocol)

I also tried VFDMOD, that looks very easy, but, there is no ARM64 version.

Sometimes I wonder why I started to use linuxcnc.... but I've come so far, I've learned a lot and my cnc is running but not the way I want...

To start with, which route do I have to take to get my VFD running on my Linux2.9/RPI4 arm64 machine?

In this topic there is information about adresses. forum.linuxcnc.org/24-hal-components/387...modbus-rtu?start=100

I've tried vfdb_vfd too, but the reverse and forward pins are missing.... ( linuxcnc.org/docs/html/man/man1/vfdb_vfd.1.html#PINS )


 
Last edit: 04 Jan 2024 11:20 by Calysto.

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

More
05 Jan 2024 10:51 #289847 by Calysto
okay... I'm reading about modbus, that helps. mb2hal is the best option I guess... future proof... I'm greating a config file now. Is there an artical about the relation between mb2hal and a vfd manual? That would be nice....

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

More
06 Jan 2024 05:09 #289926 by rodw
I don't think there is any specific standard for VFD modbus. I was lucky, the day I was going to resort to PWM spindle control, somebody posted a config for VFDMOD here on th eforum and it worked!

There should be some modbus data in your VFD terminal

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

More
06 Jan 2024 09:16 - 06 Jan 2024 11:48 #289935 by Calysto
VFD's are all different, but modbus has a cenrtain standard of data structure. I've copy paste a lot too, but I want to know what I'm doing. Only then I can create beter configs and fix things.
I'm now trying to figure out how I have to use the read/write/register/coil settings. It's part of how modbus in general works, but I don't understand how it's related to the VFD manual. Reading and writing is obvious, but coils and registers are getting more complicated, especialy when there are multiple settings on one address...
Last edit: 06 Jan 2024 11:48 by Calysto.

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

More
06 Jan 2024 11:43 #289950 by Calysto
I'm not sure of the MB_TX_CODE settings. And what about the new version 1.1 settings? The goal is to use as less as possible conversion functions in the hal file. And I just want normal readable names, version 1.1 should give me that option.

This is from the manual:
# 2000H (8192) 000001 Stop        
# 2000H (8192) 000010 Run
# 2000H (8192) 010010 FWD
# 2000H (8192) 100010 REV
# 2001H (8193) Freq xxx.xx Hz
# 2106H (8454) Output voltage xxx.x V
# 210AH (8458) Output current xx.xx A
# 210CH (8460) Actual motor speed RPM xxxxx

This is what I have now. I'm I doing something wrong? Can I do things beter to make it more logical (for a non-IT person :-))?
[MB2HAL_INIT]

INIT_DEBUG=3
VERSION=1.1
HAL_MODULE_NAME=mb2hal
SLOWDOWN=0.0
TOTAL_TRANSACTIONS=5

[TRANSACTION_00]

LINK_TYPE=serial
SERIAL_PORT=/dev/ttyACM0
SERIAL_BAUD=9600
SERIAL_BITS=8
SERIAL_PARITY=none
SERIAL_STOP=2
SERIAL_DELAY_MS=10
MB_SLAVE_ID=1

FIRST_ELEMENT=8192
PIN_NAMES=stop,run,reserved1,reserved2,run-forward,run-reverse
MB_TX_CODE=fnct_15_write_multiple_coils

MB_RESPONSE_TIMEOUT_MS=500
MB_BYTE_TIMEOUT_MS=500
HAL_TX_NAME=spindle
MAX_UPDATE_RATE=0.0
DEBUG=1

[TRANSACTION_01]
MB_TX_CODE=fnct_06_write_single_register
FIRST_ELEMENT=8193
PIN_NAMES=frequency-in

[TRANSACTION_02]
MB_TX_CODE=fnct_03_read_holding_registers
FIRST_ELEMENT=8454
PIN_NAMES=volt

[TRANSACTION_03]
MB_TX_CODE=fnct_03_read_holding_registers
FIRST_ELEMENT=8458
PIN_NAMES=amps

[TRANSACTION_04]
MB_TX_CODE=fnct_04_read_input_registers
FIRST_ELEMENT=8460
PIN_NAMES=rpm-out
 

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

More
06 Jan 2024 17:32 - 06 Jan 2024 17:37 #289982 by Calysto
usefull information I got from another topic:

The names and types of pins created by Mb2hal is determined by what you put in the Mb2hal ini file. Specifically the transactions that you define there. 
There are at least 5 different transaction types that can be used. And these  determine if the pins created are boolean, floats, # inputs or outs.
fnct_02_read_discrete_inputs: creates boolean output HAL pins.
fnct_03_read_holding_registers: creates a floating point output HAL pins. also creates a u32 output HAL pins.
fnct_04_read_input_registers: creates a floating point output HAL pins.also creates a u32 output HAL pins.
fnct_15_write_multiple_coils: creates boolean input HAL pins.
fnct_16_write_multiple_registers: creates a floating point input HAL pins.

The number of hal pins created by each "transaction" is determined by the number of "elements" in that transaction.

The names of the hal pins created are the default name:
Example pin name for the 1st transaction 2nd element would be:
mb2hal.00.01 (transaction=00, second register=01 (00 is the first element))
or the transaction number can be replaced by name you define with
HAL_TX_NAME=name
Would give: mb2hal.name.01

and:

Setting up modbus communication for a new device you aren't familiar with is always a pain. (even when you do know what you're doing.) The documentation for the device is almost always universally awful, worse if it is Chinglish. From the looks of it your life is going to be made difficult by the fact that according to that document the drive only supports modbus functions 3 and 6. So you won't be able to address individual bits directly or read/write to multiple addresses. The first issue will result in you having to set up hal components to translate bit io to and from S32 integer numbers. The second problem will make you have to set up individual transactions for each different register you may need to access on the drive. That can lead to slower communications, especially if you must communicate with multiple devices.

So for example you'll need to set up a transaction that writes to 1000h (That would be 4096 in dec and I think the address number you'll need to use in your modbus ini file.) But you will have to send to that transaction an integer number representing the state that you want the drive set to, fwd=1, rev=2, stop=5... One of the mux hal components might be useful for setting the value you want for the appropriate bit inputs. (It doesn't look like simple binary bit/coil translation will work for this register.)


 
Last edit: 06 Jan 2024 17:37 by Calysto.

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

More
06 Jan 2024 18:04 - 06 Jan 2024 18:18 #289984 by Calysto
I'm just talking to myself, that helps too :-)

So, it depends on your VFD what kind of read/write types are supported. In my manual there is no paragraph about that, but there is something that looks like it. They are talking about the following functions:

fnct_03_read_holding_registers (03 = 0x03)
fnct_06_write_single_register (06 = 0x06)
fnct_16_write_multiple_registers (16 = 0x10)

So, that's where I have to deal with.
I'm afraid that I need conversions in my HAL-file then....
 
Last edit: 06 Jan 2024 18:18 by Calysto.
The following user(s) said Thank You: tommylight

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

More
06 Jan 2024 21:07 #290002 by tommylight

I'm just talking to myself, that helps too :-)

I did read it :)
I try to read everything, not always possible.
The following user(s) said Thank You: Calysto

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

More
07 Jan 2024 15:01 #290101 by Calysto
:-) Maybe I want to much....  I found this on the printnc discord. I guess I have to do it like this.... Although my brain says: that can't be in 2024!!! :-) Mux-ing and scaling should be done bij mb2hal, but that's my opinion.
#*******************
#  SPINDLE
#*******************

# Start/Stop -- Command Selector Mux

loadrt mux4 names=mux4.runmode
addf mux4.runmode servo-thread

# bit 0-1 : Stop=0b01, Run=0b10
# bit 2-3 : reserved
# bit 4-5 : Fwd=0b01, Rev=0b10
# Fwd command: 0x0012 -> 18
# Rev command: 0x0022 -> 34
# Stop command: 0x0001 -> 1

setp mux4.runmode.in0 1        # Stop
setp mux4.runmode.in1 34    # Reverse
setp mux4.runmode.in2 1        # Stop
setp mux4.runmode.in3 18    # Forward
net spindle-on        spindle.0.on => mux4.runmode.sel0
net spindle-fwd        spindle.0.forward => mux4.runmode.sel1
net spindle-runmode    mux4.runmode.out => mb2hal.spindle_runmode.command

# Speed

loadrt mult2 names=mult2.speedmult,mult2.fbspeedmult
addf mult2.speedmult servo-thread
addf mult2.fbspeedmult servo-thread

loadrt near
addf near.0 servo-thread

setp mult2.speedmult.in0 100
net spindle-setpoint    spindle.0.speed-out-rps-abs => mult2.speedmult.in1
net spindle-freq    mb2hal.spindle_speed.freq_hz <= mult2.speedmult.out

setp mult2.fbspeedmult.in0 0.6
net spindle-freq-fb    mult2.fbspeedmult.in1 <= mb2hal.spindle_speed_feedback.fb_freq_hz.float
net spindle-speed-fb    <= mult2.fbspeedmult.out

setp near.0.scale 1.01
net spindle-setpoint-rpm    spindle.0.speed-out-abs    => near.0.in1
net spindle-speed-fb        => near.0.in2
net spindle-at-speed    spindle.0.at-speed <= near.0.out
 

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

More
07 Jan 2024 15:25 #290106 by pawel77
Hi Calysto,
before communicating with VFD via Modbus I would buy a simple modbus input/output relay and start practicing modbus and MB2hal.

Do you know if is it possible to position spindle with MS300?


 

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

Time to create page: 0.093 seconds
Powered by Kunena Forum