NEWS
LinuxCNC 2.5.2 Release
There are no translations available.

LinuxCNC 2.5.2 Update Released (changelog).
 
LinuxCNC 2.5.1 Release
There are no translations available.

LinuxCNC 2.5.1 Update Released (changelog). If the Package Manager does not prompt you to upgrade see this page.

 
LinuxCNC 2.5.0 Release
There are no translations available.

New major release (changelog). See the instructions to update your system from EMC 2.4 to LinuxCNC 2.5.
 

Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: EMC2 and UART

EMC2 and UART 23 Lug 2010 10:47 #3473

  • grawp
  • grawp's Avatar
Can be UART used with EMC? I'm in process of making very simple CNC mill for PCB creation. I don't have stepper motors by my hand so I'm going to use ordinary DC motors with optical rotary encoders (from printers). I want to control it with MCU interfaced with EMC by UART. The MCU would accept commands like goto xyz (stright line), stop, check current position.

1. Is it possible to easily write interface between EMC and MCU? or is there any already written for UART?
2. If not or if it is extremely hard could be some simple MCU like PIC used as GPIO? Most of today UARTs handle 1Mbps without problem.
The administrator has disabled public write access.

Re:EMC2 and UART 24 Lug 2010 08:50 #3475

  • PCW
  • PCW's Avatar
  • OFFLINE
  • Moderator
  • Posts: 1717
  • Thank you received: 92
  • Karma: 116
I think its possible but probably much more work than its worth...

First, EMC is not a good match for smart motion controllers. EMC works best when its in contol of motion

It may be possible to have a UART/Micro based system if the micro just read encoders and output PWM (or controlled current). This way EMC can run the PID control loop
so you have access to the following error and all tuning is in EMC. You could also build the PID loop into your micro and just output position
commands at each servo period, but then you would lose the use of EMCs tools for tuning and you would have to implement you own following error logic.

The first roadblock here would be a real time serial port driver. I believe one of EMCs developers has a real time serial driver but its not integrated into EMC yet.
In addition to the low level driver you would need to implement your communication protocol. 1 Mbps may be a little slow (10 uSec/byte) if you have multiple axis,
so you would have to use a minimum of data say 1 byte per encoder count (leading to a 128 KHz maximum count rate at 1 KHz servo rate) You need the returned data to be small
because EMCs control loop runs like this:

Read
Process
Write

So when EMC asks the micro for the encoder position (Read) it will have to busy wait until the data thats needed for the Process section
is returned. There are better schemes than busy waiting but they all require finer time resolution than the servo thread

If you just want a minimal servo system, you could start with a couple parallel ports. you can read the encoders (up to you base thread limits)
and output PWM / direction for your motor drivers with nothing but the parallel port(s). This has the advantage of being supported by EMC
now so you can start checking out your hardware immediately.
The administrator has disabled public write access.

Re:EMC2 and UART 27 Lug 2010 01:56 #3494

  • grawp
  • grawp's Avatar
Thank you for you reply.

Now I understand that EMC is designed as motion controller itself. I left the idea about using MCU as controller. But there's a problem for me with obtaining suitable parallel port. I had a few old computers but I thrown them away because of their high power consumption and size thinking that router-board or small ARM computer could do the same....... but they usually don't have much beloved parallel port and have limited number of I/O ports.

So I'm going to search something about RTAI real-time USB support and check Git for newest EMC code and hopefully use USB to parallel port as solution.
The administrator has disabled public write access.

Re:EMC2 and UART 27 Lug 2010 05:33 #3495

  • andypugh
  • andypugh's Avatar
  • OFFLINE
  • Moderator
  • Posts: 4244
  • Thank you received: 152
  • Karma: 130
grawp wrote:
So I'm going to search something about RTAI real-time USB support and check Git for newest EMC code and hopefully use USB to parallel port as solution.

USB is not Real-Time and as far as I know EMC2 does not support any USB devices (this includes USB-parallel converters).

Your best bet is either a PCI parallel port card (they are very cheap) or one of the dedicated PCI motion control cards from Mesa, Pico, Motenc etc.
The administrator has disabled public write access.

Re:EMC2 and UART 28 Lug 2010 13:24 #3511

  • grawp
  • grawp's Avatar
What about USB HID? Probably it isn't deterministic, but maybe it can conform to some soft-realtime timing. && Can it be used also for output?

(PCI card would be the best solution if I had PCI slot. I have only cheap MSI notebook without ability to connect some docking station with parallel port.. And I will have IGEPv2 which also doesn't have PCI)
Last Edit: 31 Lug 2010 05:47 by grawp.
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 1.354 seconds
Powered by Kunena Forum
© 2013 LinuxCNC.org
Joomla! is Free Software released under the GNU General Public License.