LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)

More
09 Aug 2024 11:29 #307345 by meister
On the TangNano9k, 13&15 are LED's and they work fine

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

More
09 Aug 2024 11:43 - 09 Aug 2024 11:44 #307349 by epineh
Thanks for the earlier reply meister, regarding using extra pins on your Tangoboard, I downloaded the datasheet for the nano 9K and that also cleared up a few things.

I was thinking, since you are already using SPI for your expansion IO boards, would it be feasible to use a hardware quadrature decoder chip, or something along the lines of DigitalChicken's OctoQuad code running on a Pi-Pico? Basically it will read 8 high speed quadrature signals (1MHZ) and convert each to a 32 bit position value per encoder that the controller calls for via SPI when the servo loop is required to be updated.

The idea is to have a dedicated expansion board for this, with 8 RJ45 connectors, associated line receivers and the decoding hardware. I know closed loop to LinuxCNC isn't everybody's cup of tea but you could also use it for spindle encoders, MPG's etc.

Cheers.
Russell.
Last edit: 09 Aug 2024 11:44 by epineh.

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

More
09 Aug 2024 11:55 #307350 by meister
you can simply use shiftregisters,
it's faster than going via a microcontroller and spi, and cheaper too. i always say that you shouldn't run encoders via the expansions, but it's still faster than using an MCU. and as long as the encoders aren't connected to an hf-spindle, it works too

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

More
09 Aug 2024 13:32 #307357 by Mecanix
Oliver, bit of a heads up; I'm keeping all of Sunday free to play RIO and motion controls (way too fun man). On that great Sunday agenda is this MPG implementation!!

When you have time to think about it, I'd love to hear about creative way(s) to implement this MPG into Rio in the most simplistic possible way (aka for noob!). At least some hints as to where to begin with this, and I'll figure out the rest (coughs lol).

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

More
09 Aug 2024 14:47 #307364 by cornholio
I made a custom component for my mill that basically takes all the inputs works out the step size per click and what not.
Instead of having a mess of Hal logic it’s all self contained.
I’ll drag it out over the weekend.
The following user(s) said Thank You: Mecanix

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

More
09 Aug 2024 16:34 #307368 by Mecanix

I’ll drag it out over the weekend.

Give us the heads up and hint us rather, i.e where to start to get a module written (template/example?). If we are to be using RIO for the next decade then it's imperative we know how to implement one of those cool plugin/module (not even sure of the difference between both, goes to show). So much to learn and fun ahead I'm sure. 

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

More
09 Aug 2024 16:51 #307371 by meister
ok, jogging, grrrrrrrrrrrrrr

in general, everything can be configured as with mesa at the end via hal, the only problem is that this is overwritten when regenerating :(

To make simple assignments, there are the 'signal' -> 'net' options.
A strength of RIO is that even double assignments are recognised and if possible an AND/OR is built in between.

When it gets more complicated, for example when jogging (switching axes / speed / ..) the 'net' option no longer helps :(

but then there is the 'signal' -> 'function' option :)

there are a few predefined options

Examples 1:

2 Encoder
1. for Axis X / joint0
2. for Axis Y / joint1
        {
            "type": "quadencoder",
            "pins": {
                "a": {
                    "pin": "SHIFT_INPUT[0]"
                },
                "b": {
                    "pin": "SHIFT_INPUT[1]"
                }
            },
            "signals": {
                "position": {
                    "function": "jog.wheel_x"
                }
            }
        },
        {
            "type": "quadencoder",
            "pins": {
                "a": {
                    "pin": "SHIFT_INPUT[2]"
                },
                "b": {
                    "pin": "SHIFT_INPUT[3]"
                }
            },
            "signals": {
                "position": {
                    "function": "jog.wheel_y"
                }
            }
        },

Examples 2:

1 Encoder for all axis
joint/axis selection can be done in the AXIS gui
        {
            "type": "quadencoder",
            "pins": {
                "a": {
                    "pin": "SHIFT_INPUT[0]"
                },
                "b": {
                    "pin": "SHIFT_INPUT[1]"
                }
            },
            "signals": {
                "position": {
                    "function": "jog.wheel"
                }
            }
        },

Mixing Example 1 and 2 is not possible :(

this is a list of some rio functions:
RIO_FUNCTIONS = {
    "inout": {},
    "output": {
        "jog.selected-x": {"help": "X is the selected axis", "type": bool},
        "jog.selected-y": {"help": "Y is the selected axis", "type": bool},
        "jog.selected-z": {"help": "Z is the selected axis", "type": bool},
        "jog.position": {"help": "Position of selected axis", "type": float},
    },
    "input": {
        "jog.wheel": {"help": "Jog-Wheel", "type": float},
        "jog.wheel_x": {"help": "Jog-Wheel X-Axis", "type": float},
        "jog.wheel_y": {"help": "Jog-Wheel Y-Axis", "type": float},
        "jog.wheel_z": {"help": "Jog-Wheel Z-Axis", "type": float},
        "jog.select-x": {"help": "Jog-Select X-Axis", "type": bool},
        "jog.select-y": {"help": "Jog-Select Y-Axis", "type": bool},
        "jog.select-z": {"help": "Jog-Select Z-Axis", "type": bool},
        "jog.plus": {"help": "Jog selected axis plus", "type": bool},
        "jog.minus": {"help": "Jog selected axis minus", "type": bool},
        "jog.fast": {"help": "Jog set fast", "type": bool},
    },
}

i think we need a documentation for this, there are other function but i have also need to check what i have done there :)

last but not least, there are also a few add-ons that can be configured via the setup-gui:
riocore# ls riocore/generator/addons/
camera  classicladder  hy_vfd  joypad  mxmpg  README.md


it doesn't seem like much now, but we can still expand it and with the automatic links it is already very powerful and can create hal's that nobody would have to create by hand :P



The following user(s) said Thank You: Mecanix, Bongo

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

More
09 Aug 2024 16:54 - 09 Aug 2024 17:03 #307372 by Mecanix
Oh and errr... now that I have the rio stepgens buzzing I hooked up a signal wire to my mill X step drive and, and ... Ready for it??

The Nasty Resonance Is Gone!!! Man those RIO stepgens are good. Used to sound like a freight train at several velocities before, so much so I bet my great great great neighbor half a mile away was hearing my sheet metal panels rattling. That mess will soon be resolved!!

Edit: as I was typing this, the awesome support from meister manifested itself once again. Not surprised though. That is so cool, great and spot on info - I look forward learning this 
Last edit: 09 Aug 2024 17:03 by Mecanix.
The following user(s) said Thank You: meister

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

More
09 Aug 2024 17:09 #307373 by meister
by the way, if you were wondering why there are such strange pin names at the top of the quadencoder:
        {
            "type": "quadencoder",
            "pins": {
                "a": {
                    "pin": "SHIFT_INPUT[2]"
                },
                "b": {
                    "pin": "SHIFT_INPUT[3]"
                }
            },
            "signals": {
                "position": {
                    "function": "jog.wheel_y"
                }
            }
        },

these are 'virtual' pins that are created when an expansion plugin is loaded:
        {
            "type": "shiftreg",
            "pins": {
                "out": {
                    "pin": "PMOD:P1"
                },
                "in": {
                    "pin": "PMOD:P2"
                },
                "sclk": {
                    "pin": "PMOD:P3"
                },
                "load": {
                    "pin": "PMOD:P4"
                }
            },
            "name": "shift",
            "speed": 5000000
        },

the expansion pins can be used in the same way as real pins in the configuration, except that they are limited to one direction.

Otherwise you can use them in pretty much any other plugin
even PWM or stepper if they don't need to be ultra fast
The following user(s) said Thank You: Mecanix

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

More
09 Aug 2024 17:22 #307374 by Mecanix
I was shy to ask where those shift arrays came from. So glad you've explained.

I hope for lightnings, thunder, heavy rain and a dozen typhoons all of Sunday. I'll cave under and get it done. Thanks a-mil again Oliver.
The following user(s) said Thank You: meister

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

Time to create page: 0.128 seconds
Powered by Kunena Forum