hy_vfd and RS485 USB dongle
19 Oct 2020 19:15 #186608
by Wirewrap
hy_vfd and RS485 USB dongle was created by Wirewrap
My HuanYang has been lying around for some years. Now I am trying to start it.
I cannot connect to hy_vfd using
halrun
loadusr -Wn hy hy_vfd -g -p none -r 19200 -s 1 -d /dev/ttyUSB0
or
loadusr -Wn hy hy_vfd -g -p none -r 19200 -s 1 -d /dev/ttyACM0
Waiting for component 'hy' to become ready .................
I seriously think all parameters in the controller are set as per instructions. Checked several times.
My system is
Linux debianRT 3.4-9-rtai-686-pae #1 SMP PREEMPT Debian 3.4.55-4linuxcnc i686 GNU/Linux
I have two dongles
ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter as /dev/ttyUSB0
ID 04e2:1411 Exar Corp. XR21B1411 as /dev/ttyACM0
First I try to send from one dongle to another
stty -F /dev/ttyACM0 19200
stty -F /dev/ttyUSB0 19200
cat /dev/ttyACM0 &
echo "1234567890" > /dev/ttyUSB0
This works as seen in terminal and on oscilloscope connected to , the other way from ACM0 to USB0 does not work.
I guess the USB0 is stuck in half duplex send mode and ACM0 in receive mode.
I suspect the CDC ACM driver is not right for the Exar device, I have tried to compile a driver from Exar but they give compile errors that I do not understand.
Any ideas to help me?
I cannot connect to hy_vfd using
halrun
loadusr -Wn hy hy_vfd -g -p none -r 19200 -s 1 -d /dev/ttyUSB0
or
loadusr -Wn hy hy_vfd -g -p none -r 19200 -s 1 -d /dev/ttyACM0
Waiting for component 'hy' to become ready .................
I seriously think all parameters in the controller are set as per instructions. Checked several times.
My system is
Linux debianRT 3.4-9-rtai-686-pae #1 SMP PREEMPT Debian 3.4.55-4linuxcnc i686 GNU/Linux
I have two dongles
ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter as /dev/ttyUSB0
ID 04e2:1411 Exar Corp. XR21B1411 as /dev/ttyACM0
First I try to send from one dongle to another
stty -F /dev/ttyACM0 19200
stty -F /dev/ttyUSB0 19200
cat /dev/ttyACM0 &
echo "1234567890" > /dev/ttyUSB0
This works as seen in terminal and on oscilloscope connected to , the other way from ACM0 to USB0 does not work.
I guess the USB0 is stuck in half duplex send mode and ACM0 in receive mode.
I suspect the CDC ACM driver is not right for the Exar device, I have tried to compile a driver from Exar but they give compile errors that I do not understand.
Any ideas to help me?
Please Log in or Create an account to join the conversation.
19 Oct 2020 20:03 #186611
by rollfree
Replied by rollfree on topic hy_vfd and RS485 USB dongle
Try running 2 terminal emulators (such as picocom) against each other.
Please Log in or Create an account to join the conversation.
20 Oct 2020 19:40 #186735
by Wirewrap
Replied by Wirewrap on topic hy_vfd and RS485 USB dongle
Great advice.
Running two picocom against each other cleared up several points.
The CH340 + MAX485 dongle can send and receive half duplex with the default driver. RTS is magically toggled somehow.
On the Exar dongle RTS has to be manually toggled to switch between send and receive.
Now I know I have one working RS485 dongle.
I wonder if hy_vfd operates the RTS line?
Running two picocom against each other cleared up several points.
The CH340 + MAX485 dongle can send and receive half duplex with the default driver. RTS is magically toggled somehow.
On the Exar dongle RTS has to be manually toggled to switch between send and receive.
Now I know I have one working RS485 dongle.
I wonder if hy_vfd operates the RTS line?
Please Log in or Create an account to join the conversation.
21 Oct 2020 21:19 #186842
by rollfree
Replied by rollfree on topic hy_vfd and RS485 USB dongle
Not by default, in my opinion.
Look at github.com/LinuxCNC/linuxcnc/blob/master...anyang-vfd/hy_comm.c .
Most universal USB / RS485 adapters use automatic Tx / Rx direction control. They do this very simply - the arrival of the first logical 0 sets the Tx mode, the switch back to Rx then takes place with a delay.
Because this delay cannot be accurately estimated in advance (it must be different for different baudrates), automatic switching is not perfect. But mostly they will.
Look at github.com/LinuxCNC/linuxcnc/blob/master...anyang-vfd/hy_comm.c .
Most universal USB / RS485 adapters use automatic Tx / Rx direction control. They do this very simply - the arrival of the first logical 0 sets the Tx mode, the switch back to Rx then takes place with a delay.
Because this delay cannot be accurately estimated in advance (it must be different for different baudrates), automatic switching is not perfect. But mostly they will.
Please Log in or Create an account to join the conversation.
Time to create page: 0.198 seconds