Serial port driver for the MESA 7i96?
- thadwald
- Offline
- Premium Member
-
- Posts: 111
- Thank you received: 10
I am working on a 24" x 24" engraver retrofit project. The reason being, the original driver for it was basically a printer driver, which is quite limited as a CNC controller. This machine has a 1HP spindle motor that is controlled by a Toshiba VF-S9 inverter. I would like to interface it with LinuxCNC using the MODBUS protocol.
I started this project with a MESA 7i96 because I have an older decommissioned iMac Core 2 Duo that I wanted to use. (As an aside, this is working nicely so far; Linux Mint 18, Preempt-RT kernel, 22000 max latency, if I keep the wifi off.)
I am using about half of the I/Os on the card so far. My question is, is it possible for the card to expose some pins as a serial port?
If this is not possible, my other option is to use a USB-Serial adapter. Are there issues with these kinds of adapters for spindle control?
I am referring this documentation: VFs11 driver
The documentation refers to a wiring schematic for converting the link to RS232. Unfortunately, the links to those schematics are broken. Could anyone provide those again here?
Thanks!
Please Log in or Create an account to join the conversation.
- andypugh
-
- Offline
- Moderator
-
- Posts: 23320
- Thank you received: 4946
Yes, it is possible to use _some_ pins as a serial port, on _some_ cards.I am using about half of the I/Os on the card so far. My question is, is it possible for the card to expose some pins as a serial port?
Mesa has a UART (and pktUART) module in the firmware options.
In the case of the 7i96 you will not be able to use the IO pins as a serial UART because these are, themselves, serially addressed and only update once per mS. The existing RS485 port can be used (you would need a firmware that puts a UART on those pins in place of the smart-serial module) and also some of the pins on the expansion port could be re-allocated (by a firmware change).
I use a USB dongle on my lathe to control the VFD and it does not seem to cause any problems. It might not be ideal if you wanted to use spindle orientation.If this is not possible, my other option is to use a USB-Serial adapter. Are there issues with these kinds of adapters for spindle control?
FWIW I found a hacky way to mount the adaptor directly to a motherboard header: forum.linuxcnc.org/forum/18-computer/306...485-connection#72351
Please Log in or Create an account to join the conversation.
- persei8
-
- Offline
- Platinum Member
-
- Posts: 391
- Thank you received: 124
"The existing RS485 port can be used (you would need a firmware that puts a UART on those pins in place of the smart-serial module) and also some of the pins on the expansion port could be re-allocated (by a firmware change)."
How would I go about getting this firmware? Do I have to write VHDL source code myself and reflash the FPGA? (geez, I hope not)
The reason I ask is that I would like to control my Huanyang GT series VFD via RS-485 directly from the 7i96 board. That is, without a USB to RS-485 dongle.
Please Log in or Create an account to join the conversation.
- PCW
-
- Offline
- Moderator
-
- Posts: 18541
- Thank you received: 5090
7i96_pktd.bit
I notice that a new hal type has been added that
might make writing a clean hal interface to the UART easier:
hal_port
Please Log in or Create an account to join the conversation.
- persei8
-
- Offline
- Platinum Member
-
- Posts: 391
- Thank you received: 124
Please Log in or Create an account to join the conversation.
- AgentWD40
-
- Offline
- Platinum Member
-
- Posts: 334
- Thank you received: 92
Please Log in or Create an account to join the conversation.
- PCW
-
- Offline
- Moderator
-
- Posts: 18541
- Thank you received: 5090
If you connect to a voltage outside the range of about -0.8V to 7V
you will destroy the bus switch and possibly the FPGA.
You can use one of the cheap "5 AXIS MACH" breakout boards to
protect the I/O
If you use bare pins, include a 220 Ohm or so series resistor to protect the
negative input clamp diodes from excessive current.
Please Log in or Create an account to join the conversation.
- persei8
-
- Offline
- Platinum Member
-
- Posts: 391
- Thank you received: 124
Thankyou.
Please Log in or Create an account to join the conversation.
- andypugh
-
- Offline
- Moderator
-
- Posts: 23320
- Thank you received: 4946
linuxcnc.org/docs/2.7/html/man/man3/hm2_uart_read.3hm2.html
linuxcnc.org/docs/2.7/html/man/man3/hm2_uart_send.3hm2.html
linuxcnc.org/docs/2.7/html/man/man3/hm2_uart_setup.3hm2.html
Unfortunately you will need to write a .comp to assemble and interpret the packets.
pktuart is only present in v2.8+
linuxcnc.org/docs/2.8/html/man/man3/hm2_pktuart_read.3hm2.html
linuxcnc.org/docs/2.8/html/man/man3/hm2_pktuart_send.3hm2.html
linuxcnc.org/docs/2.8/html/man/man3/hm2_pktuart_setup.3hm2.html
In what way is mesa_uart.comp a bad example?
Please Log in or Create an account to join the conversation.
- persei8
-
- Offline
- Platinum Member
-
- Posts: 391
- Thank you received: 124
jim@LinuxCNC:~/linuxcnc/configs/mesa_uart$ halrun
halcmd: loadrt hostmot2
Note: Using POSIX realtime
hm2: loading Mesa HostMot2 driver version 0.15
halcmd: loadrt hm2_eth
hm2_eth: loading Mesa AnyIO HostMot2 ethernet driver version 0.2
halcmd: loadrt mesa_uart names=hm2_7i96.0.uart.0
hm2: Can not find UART instance hm2_7i96.0.uart.0.
Please Log in or Create an account to join the conversation.