microcontroller vs parallel port

More
28 Mar 2021 19:26 #203930 by rodw

It comes to mind that using the ethernet port or a pci/pcie card is no different than what I was suggesting in the first place. Your main pc running linuxcnc is talking to a peripheral that is controlling the stepper drivers. I wonder what sort of information is going through the ethernet cable?


Thats not how it is. The steppens always remain under LinuxCNC control. LinuxCNC tells the Mesa stepgens to operate at a specific frequency and the Mesa stepgen will do so until eternity unless its told (by Linuxcnc) to stop or change to a different frequency. But becasue the servo thread is running at 1 kHz, Linuxcnc can vary that frequency 1000 times a second. The stepgens can operate at up to 10 Mhz so this results in smoother operation/ It also removes the need for Linuxcnc to generate the step pulses in software so it much reduces demand on the latency and performance of the Linuxcnc PC.
The following user(s) said Thank You: iplayfast

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

More
28 Mar 2021 20:24 #203940 by andypugh
[quote="iplayfast" post=203919 I wonder what sort of information is going through the ethernet cable?[/quote]

The information is step-rate, or PWM frequency, and values to write to GPIO pins.
Encoder counts and GPIO input data comes back.

What isn't sent / received is any kind of G-code or motion information that needs to be interpreted on the boards.
The following user(s) said Thank You: iplayfast

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

More
29 Mar 2021 03:29 #203976 by iplayfast
OK, so if I'm understanding, linuxcnc sends a low level command to the stepgens and they carry it out. That's quite possible to do with an atmega 2560 arduino, much easier than interpreting gcode. If speed is needed, some other microcontroller with a higher clock rate. $12 is much cheaper than $200 and the same job is accomplished.

I followed the other thread where someone was designing a custom controller. I'll have to read it again. The big problem sounded like dealing the linuxcnc and not the controller.

Are the low level commands documented somewhere, and could they be sent over the serial port?

I have several little machines that might benefit from running linuxcnc so this is interesting to me.

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

More
29 Mar 2021 09:04 #203996 by rmu

Are the low level commands documented somewhere, and could they be sent over the serial port?

I have several little machines that might benefit from running linuxcnc so this is interesting to me.


There are a number of projects that just do something like that. I'm aware of github.com/scottalford75/Remora and of github.com/kinsamanka/PICnc-V2.

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

More
29 Mar 2021 11:13 - 29 Mar 2021 11:14 #204014 by andypugh

Are the low level commands documented somewhere


They are lower-level than you seem to be imagining.

In the case of the Mesa cards the step rate (etc) is controlled by values written to registers:
github.com/LinuxCNC/hostmot2-firmware/bl...ster/src/regmap#L225

The HAL driver receives position or velocity commands through HAL pins, and writes integer values to the registers on the FPGA accordingly:
github.com/LinuxCNC/linuxcnc/blob/master...tmot2/stepgen.c#L325

If speed is needed, some other microcontroller with a higher clock rate. $12 is much cheaper than $200 and the same job is accomplished.

Though some of the Mesa cards are a lot less than $200. The 7i90 is $59.
But, as PCW has pointed out in another thread , it should be possible to send SPI commands direct to a Trinamic stepper drivers (eg the silentstepstick) , and use no microcontroller or FPGA at all.
Last edit: 29 Mar 2021 11:14 by andypugh.

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

More
29 Mar 2021 14:59 #204049 by iplayfast


There are a number of projects that just do something like that. I'm aware of github.com/scottalford75/Remora and of github.com/kinsamanka/PICnc-V2.


I was thinking more along the lines of github.com/dewy721/EMC-2-Arduino

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

More
29 Mar 2021 16:38 #204067 by rmu


There are a number of projects that just do something like that. I'm aware of github.com/scottalford75/Remora and of github.com/kinsamanka/PICnc-V2.


I was thinking more along the lines of github.com/dewy721/EMC-2-Arduino


It looks like this is based on a userspace python hal component that talks to arduino via serial port at 115200 bps. This architecture is a dead end, you would be better off using grbl or some derivative. IMHO. Comment in the code:
#    Note: This interface will always have (at least) serveral milliseconds of
#    lag, compared to the standard parallel port latency with lag times of just
#    nanoseconds.

Whereas with the approach in the two projects I linked in my earlier post, you do get decent performance.
The following user(s) said Thank You: iplayfast

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

More
10 Mar 2024 21:49 - 10 Mar 2024 22:11 #295601 by andrei
Summary of the conversation above. Maybe it will help someone like me. (For example it was extremely hard to understand what Mesa is etc.)
  • MCU over USB as step generator   breaks the idea of the project
    • This way the MCU will inevitably become a motion controller (you will port features from linuxcnc into MCU) instead of being a simple hardware
    • The main concern is the latency    (USB is not designed for realtime. Other projects using USB have a different architecture.)
    • Though it looks possible to use linuxcnc + MCU. There are some linuxcnc forks that use external MCU over SPI as simple hardware interface (for example      github.com/scottalford75/Remora  )
  • LinuxCNC supports many different hardware interfaces
  • Mesa is programmable configurable hardware device
    • usually PC (personal computer) does not have dedicated hardware (like PWM etc.) for generating stepper pulses etc. but it has PCI/Ethernet/etc. to attach hardware to
    • FPGA is configurable i.e. any device can be configured (MCU on the opposite has fixed hardware structure for example it is not possible to add/reconfigure second/third PWM to MCU)
    • Mesa allows to configure devices to generate pulses, read encoders etc. (This does not make Mesa board a motion controller, linuxcnc still controls everything)
  • Linux can run on a wide variety of hardware platforms. For example      LinuxCNC at RPI4 with using IO Pins only
    • Maybe even some exotic use cases are possible today e.g. converting modern fridge with performant hardware into cnc lathe controller
For me it looks like the best "batteries included" solution is to use PC + Mesa card(s) (it is FPGA, maybe ethernet version is better)
Last edit: 10 Mar 2024 22:11 by andrei.
The following user(s) said Thank You: tommylight

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

More
11 Mar 2024 10:29 #295625 by andrei

I just read the replies again and now interested in the idea.
  • Could someone please tell whether the same is doable with PC?
    • not RPi gpio
    • does it sound like poor man's hardware acceleration?
paraport >> software SPI >> AVR PWM1
              >> software SPI >> stm32 PWM2
              etc.

instead of

PCI/whatewer >> Mesa (PWM1, PWM2 etc.)

I would appreciate any help. (It would be great if someone can tell what source code files to start with. Being a web developer I'm overwhelmed a little bit with all low level stuff at the moment. I cannot even understand whether the idea above will work or not. I just have many of arduino-like boards and would like to utilize them somehow...)

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

More
11 Mar 2024 10:52 #295626 by meister
Hi andrei,
you can use an older version of remora (over SPI) as base/template for the hal-component.
and porting the spi part to parport (soft-spi).

there are already ports of remora to stm32, so you need only to replace the SPI part on the PC side.

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

Time to create page: 0.179 seconds
Powered by Kunena Forum