Delta MS300 VFD, RS485, RPI4, QTdragon, getting it to work
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 )
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
There should be some modbus data in your VFD terminal
Please Log in or Create an account to join the conversation.
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...
Please Log in or Create an account to join the conversation.
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.
and: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
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.)
Please Log in or Create an account to join the conversation.
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:
So, that's where I have to deal with.fnct_03_read_holding_registers (03 = 0x03)
fnct_06_write_single_register (06 = 0x06)
fnct_16_write_multiple_registers (16 = 0x10)
I'm afraid that I need conversions in my HAL-file then....
Please Log in or Create an account to join the conversation.
- tommylight
- Offline
- Moderator
- Posts: 19300
- Thank you received: 6462
I did read itI'm just talking to myself, that helps too
I try to read everything, not always possible.
Please Log in or Create an account to join the conversation.
#*******************
# 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.
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.