Raspberry Pi GPIO Performance? (I want to design a driver board)

More
5 years 10 months ago #191287 by T.T.
First, off, I'm new here, so I'll give a quick intro.
I'm T.T. most of my experience in cnc is with simple 3d printer stuff, so most of this will be pretty new to me. My strong suit is definitely electronics hardware design though, which brings me into my question.

I found out just yesterday that the Raspberry Pi can run LinuxCNC, and furthermore, it looks like it's capable of running a CNC directly with its GPIO pins.

My thought is this. I'd love to design a board that is can accept a Compute Module 4 (and release it as open hardware of course). My thinking is since the Pi already has a sufficient number of GPIO pins, that I'd design this board to leverage those. Before I dive into designing hardware, I wanted to make sure what I had in mind is reasonable.

My thinking is to use the GPIO to control the stepper drivers directly, and I was thinking of making the board be 5 axis capable. So, 5 sets of Step and Direction pins being controlled directly by the Pi. I know that these signals would be timing sensitive, so would the Pi even be capable of directly driving 5 axes with its GPIO?

If the Pi happens to be capable of doing the above, is it possible to use the GPIO pins in conjunction with the Pi's SPI interface? My reasoning here is to let the Pi handle all digital signals, and then for things like analog inputs or outputs, the SPI interface could simply be used. Plus, that would allow a great deal of flexibility in the design as well.

My goal is to design a sort of "all in one" solution control board. One would simply get the board, slap a CM4 in it, configure it, and it would be ready to go.

I'd love to hear the thoughts of the people who know more than me regarding this (which would probably be all of you :P )

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

More
5 years 10 months ago #191341 by tommylight

T.T. wrote: I found out just yesterday that the Raspberry Pi can run LinuxCNC, and furthermore, it looks like it's capable of running a CNC directly with its GPIO pins.

Yes it can, and no it can not.
RPI4 can run LinuxCNC, quite successfully from what i read, but it uses one of the Mesa boards for the actual step generation.
Pretty sure the GPIO can be used, but i would not call that useable.

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

More
5 years 10 months ago #191381 by wurdack
I'm in the same boat as T.T. Astonishingly, I was about to ask the same question, searched, and found the question had been asked only a few hours ago.

For educational purposes, I've decided to cobble together a CNC controller from a Raspberry. I literally just got linuxcnc building there and running against the simulated machine about 15 minutes ago.

I'm assuming the obstacle between that and a real set of stepper motors (and limit switches, and e-stop, and etc etc etc) is building the suitable interface on top of the Pi's gpio. To me that sounds like a fun project, even if that isn't practical or "useable". I'd be deeply appreciative of any pointers to where one would start with this, even if it is folly.

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

More
5 years 10 months ago #191426 by jmelson
There is also the Machinekit port of LinuxCNC for the Beagle Bone, which takes advantage of the PRU processors to do encoder counting and step generation.
While it is not as capable as outboard FPGA hardware, it is MANY times better than main-CPU software stepping.

Jon

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

More
5 years 10 months ago #192267 by T.T.
Shortly after I made this post, I actually found some info somewhere that the Pi's GPIO max theoretical step rate is something like 5kHz or so. So I realize if I do a driver board for the CM4, a different approach will need to be taken.

Correct me if I'm wrong, with the Mesa boards, the Pi handles all the motion planning, and then the mesa cards handle the raw step generation, correct?

I'm thinking what I may try is to be a step below the Mesa boards (as much as I'd love to use an FPGA, that is not a skill I have learned yet), and be a step above a regular parallel port.

The approach I was thinking was to have the Pi handle motion planning and step generation, similar to how a regular PC with a parallel port would operate. Rather than using a parallel port, I could use the Pi's hardware SPI interface and a port expander to essentially give the Pi a very fast parallel port. I've found a port expander that can operate close to a 50MHz clock rate on the SPI bus.

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

More
5 years 10 months ago #192292 by PCW
A port expander will give you more I/O pins but it will not improve
the software step rate (compared to GPIO access)

This is dependent on the OS latency.

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

Moderators: PCW, jmelson
Time to create page: 0.422 seconds
Powered by Kunena Forum