IO interface with Arduino over Ethernet

More
9 years 7 months ago #89082 by DocStein99
I'm clocking great speeds now, through the ESP 8266, using Arduino into the python script, to the HAL pins. Mesa cards solve problems for people with more money than time.

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

More
9 years 7 months ago #89086 by M4MazakUser
so.. going to post any code/setup notes? ---very keen.

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

More
9 years 7 months ago #89097 by DocStein99
My code is modified from the original project from this thread. I use the esp-8266-1, in an Arduino uno (which will eventually be a nano - when I can find a suitable enclosure to fit the hardware buttons - but that's another struggle)....

The difference in my project, is that it does not re-assign input/output pin mapping on each packet exchange. My project sets up inputs and outputs one time in the setup function. I am not sure how much time is gained with that - but I can't see it being so latent to notice without gauging with a scope or a timed circuit.

The second difference in my project from the original posting on the thread, is my encoder handling procedure. I send the difference in movement of the MPG dial encoder to HAL, instead of updating the A/B hardware pins into HAL copying the Arduino hardware pins. If somebody was really wrenching fast on the encoder, faster than the latency of the processing in packets - my code only sends the difference in position from the last packet - VS - copying each signal from the encoder.

I only intended to use this project to toggle all the user input MPG jogging buttons, run, stop, home, zero. All the basic manual navigating & targeting to setup the machine. If code was not executed in the time it takes to send 1/2 of a packet and transfer that information to handle other cycles - it would be so small, I would again need a scope to measure that difference in time since it could be in microseconds. The speed of my hand & eyes to press emergency-stop is a whole lot more time, than it takes to transfer that signal from the Arduino button - through WIFI, to ethernet - into HAL.

If by comparison to a MESA card in terms of speed of I/O from motor positioning encoder feedback, the MESA card would be faster. I can't give you any statistical figures on tests for any of that since I do not own any MESA cards. For the last 9 years I've done everything I needed to do with dozens of machines I built - and 2 Bridgeport Boss retrofits using only parallel interface cards and a heap of wires, switches and lights.

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

More
9 years 7 months ago #89132 by andypugh

DocStein99 wrote: The second difference in my project from the original posting on the thread, is my encoder handling procedure. I send the difference in movement of the MPG dial encoder to HAL, instead of updating the A/B hardware pins into HAL


Sending absolute counts would probably be more robust, and is what the Mesa and Pico cards do. The wheel-jog inputs to LinuxCNC expect a counts value, so this also save HAL complexity.

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

More
9 years 7 months ago #89182 by DocStein99
Well that's interesting. Again, I don't know how the Mesa or Pico cards work - but I assume they have their own assembler compiled drivers that lace directly into HAL pins, using whatever they do to pass data between the devices. I don't know how fast the data is passed between Python and HAL, I just assume it's probably measured in machine cycles faster than the time between a step pulse.

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

More
9 years 7 months ago #89194 by andypugh

DocStein99 wrote: Well that's interesting. Again, I don't know how the Mesa or Pico cards work - but I assume they have their own assembler compiled drivers that lace directly into HAL pins, using whatever they do to pass data between the devices.


They work reasonably straightforwardly. The LinuxCNC HAL driver reads register values on the FPGA on the card through PCI, EPP, SPI, Ethernet etc. These numbers are converted to "engineering units" in the HAL driver. Also, most encoder counters are extended to 64 bits to make wrapping unlikely.
This is the code that reads Mesa encoder values:
github.com/LinuxCNC/linuxcnc/blob/master...tmot2/encoder.c#L862

And, if you care, this is the vhdl that defines the encoder on the FPGA
github.com/LinuxCNC/hostmot2-firmware/bl...r/src/qcountersf.vhd

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

Time to create page: 0.455 seconds
Powered by Kunena Forum