Problem with Huanyang VFD communication via RS485 in LinuxCNC

More
2 years 1 week ago #312780 by deltafox24
Hello everyone!. please help me to customize the inverter under linuxcnc. i've been struggling for 2 weeks. I’m facing an issue with connecting my Huanyang VFD to LinuxCNC via RS485. It works perfectly in Windows, but I’m having trouble in Linux. I’m using an RS485-RS232 converter through the COM port, and despite configuring everything, the spindle does not respond, and the program either hangs or there’s no communication with the VFD.System:
  • LinuxCNC  2.9.3(Debian 12)
  • RS485-RS232 converter
  • Huanyang VFD configured for Modbus RTU
  • What I’ve done so far:
  • VFD Settings:
    • The following settings are configured on the VFD:
      • PD001 = 2 — control via Modbus.
      • PD002 = 2 — frequency via Modbus.
      • PD163 = 1 — device address.
      • PD164 = 9600 — baud rate.
      • PD165 = 3 — 8 data bits, no parity, 1 stop bit (8N1).
  • Using
    Code:
    hy_vfd
    : I tried running
    Code:
    hy_vfd
    , but the program hangs when opening the port. Here’s the command:
     bash
    Копировать код
    Code:
    hy_vfd -d /dev/ttyS0 --rate 9600 --parity none --stopbits 1 --target 1 -g
    Log output:
     bash
    Копировать код
    Code:
    hy_vfd: device='/dev/ttyS0', baud=9600, bits=8, parity='none', stopbits=1, address=1, debug=1, PID=1586 Opening /dev/ttyS0 at 9600 bauds (none)
    The program hangs at the stage of opening the port.
  • Checking the port via
    Code:
    minicom
    : I connected to the port via
    Code:
    minicom
    :
     bash
    Копировать код
    Code:
    sudo minicom -D /dev/ttyS0
    The port settings are 9600 8N1, but in the terminal, commands do not send and there’s no response from the VFD. The port is not occupied:
     bash
    Копировать код
    Code:
    lsof /dev/ttyS0
    The output is empty, meaning nothing is occupying the port.
  • Testing with
    Code:
    mbpoll
    : I also tried using
    Code:
    mbpoll
    to send Modbus messages:
     bash
    Копировать код
    Code:
    mbpoll -a 1 -b 9600 -P none -d 8 -s 1 -t 3 /dev/ttyS0
    I get the following error:
     objectivec
    Копировать код
    Code:
    Read input register failed: Connection timed out
  • What I’ve tried so far:
  • Double-checked all wiring (Data+ and Data-).
  • Tried changing the baud rate to 19200, but the result was the same.
  • Tried different ports, including
    Code:
    /dev/ttyUSB0
    (if using a USB-RS485 converter).
  • Added my user to the
    Code:
    dialout
    group:
     bash
    Копировать код
    Code:
    sudo usermod -aG dialout $USER
  • Attempted to reload HAL with
    Code:
    halrun
    and manually load
    Code:
    hy_vfd
    :
     bash
    Копировать код
    Code:
    halrun loadusr -W hy_vfd -d /dev/ttyS0 --rate 9600 --parity none --stopbits 1 --target 1 -g
  • Questions:
  • What else can I do to debug the connection with the VFD?
  • Could my RS485-RS232 converter be the problem? Could you recommend any converters that are known to work well with Linux?
  • Are there any special settings for serial ports or Modbus in LinuxCNC that might be causing this issue?
  • Thanks for your help! I’d appreciate any advice or recommendations.Additional Info:
  • RS485-RS232 converter: Works perfectly in Windows Mach3.
  • Linux: Debian 12 running LinuxCNC.

Please Log in to join the conversation.

More
2 years 4 days ago #313325 by deltafox24

Please Log in to join the conversation.

More
2 years 4 days ago #313331 by besriworld
I don't know much, but a few days ago I also worked with modbus and mb2hal.  One really useful thing is to turn on debug mode and run linuxcc through the terminal.  You will see error messages.

Please Log in to join the conversation.

More
2 years 4 days ago #313339 by MarkoPolo
is your RS485-RS232 converter a usb device?

First make sure that the system creates a device file in /dev/ and what its name is.

My Huanyang YL-620 works very well, but with a usb rs-485 converter

Please Log in to join the conversation.

More
2 years 3 days ago #313374 by wusel0464

Please Log in to join the conversation.

Time to create page: 0.150 seconds
Powered by Kunena Forum