Problem with Huanyang VFD communication via RS485 in LinuxCNC

More
21 Oct 2024 17:57 - 21 Oct 2024 18:04 #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
    hy_vfd
    : I tried running
    hy_vfd
    , but the program hangs when opening the port. Here’s the command:
     bash
    Копировать код
    hy_vfd -d /dev/ttyS0 --rate 9600 --parity none --stopbits 1 --target 1 -g
    Log output:
     bash
    Копировать код
    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
    minicom
    : I connected to the port via
    minicom
    :
     bash
    Копировать код
    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
    Копировать код
    lsof /dev/ttyS0
    The output is empty, meaning nothing is occupying the port.
  • Testing with
    mbpoll
    : I also tried using
    mbpoll
    to send Modbus messages:
     bash
    Копировать код
    mbpoll -a 1 -b 9600 -P none -d 8 -s 1 -t 3 /dev/ttyS0
    I get the following error:
     objectivec
    Копировать код
    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
    /dev/ttyUSB0
    (if using a USB-RS485 converter).
  • Added my user to the
    dialout
    group:
     bash
    Копировать код
    sudo usermod -aG dialout $USER
  • Attempted to reload HAL with
    halrun
    and manually load
    hy_vfd
    :
     bash
    Копировать код
    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.
Last edit: 21 Oct 2024 18:04 by deltafox24.

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

More
27 Oct 2024 19:06 #313325 by deltafox24

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

More
27 Oct 2024 19:56 - 27 Oct 2024 19:58 #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.
Last edit: 27 Oct 2024 19:58 by besriworld.

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

More
27 Oct 2024 23:35 #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 or Create an account to join the conversation.

More
28 Oct 2024 15:31 #313374 by wusel0464

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

Time to create page: 0.079 seconds
Powered by Kunena Forum