EMC2 and UART

  • grawp
  • grawp's Avatar Topic Author
  • Visitor
  • Visitor
23 Jul 2010 17:47 #3473 by grawp
EMC2 and UART was created by grawp
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.

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

More
24 Jul 2010 15:50 #3475 by PCW
Replied by PCW on topic Re:EMC2 and UART
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.

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

  • grawp
  • grawp's Avatar Topic Author
  • Visitor
  • Visitor
27 Jul 2010 08:56 #3494 by grawp
Replied by grawp on topic Re:EMC2 and UART
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.

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

More
27 Jul 2010 12:33 #3495 by andypugh
Replied by andypugh on topic Re:EMC2 and UART
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.

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

  • grawp
  • grawp's Avatar Topic Author
  • Visitor
  • Visitor
28 Jul 2010 20:24 - 31 Jul 2010 12:47 #3511 by grawp
Replied by grawp on topic Re:EMC2 and UART
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 Jul 2010 12:47 by grawp.

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

Time to create page: 0.234 seconds
Powered by Kunena Forum