Raspberry Pi with Gecko G540 drivers via GPIO pins only

More
05 Dec 2022 15:02 #258602 by dloranger
Hello All,

After years of attempting to get my CNC running properly, I am moving to the next iteration as we move into colder weather, thus indoor projects preferred.

I have historically been using the parallel port on an old dell optiplex to drive the gecko controller, but have been chasing missing steps on the -y axis the whole time.  It loses about 0.5 inches in the -Y direction over a job cutting 12 DSUB connectors and a few circle cutouts in a rack panel job.  I think I may have finally pinned down the problem, the G540 exerts enough of an electrical load on the parallel port that the voltage on the I/O is down to 3.0V when it gets to the controller, and thus violates the GPIO voltage requirements.  Ideally this controller wants 5V GPIO, so even just getting to the 3.3V does not give margin. I tried to buy a new parallel port card, but turns out it has the same behavior and further I couldn't set it as the primary, so pretty much wasted effort there.

I am reviewing this amplifier product as well for inplace amplification, but the specs are not available so I will need to contact the company to see if the output is 3V3 or 5V0, I suspect 3V3 though so not anticipating this to be my solution although it would be a lot cleaner for me.
www.sherline.com/product/8763-parallel-port-signal-booster

I have a new solution for this gpio voltage problem with the RPI to bring the gpio up to 5V via a level translator (ics-ctrl.com/product/logic_level_adapter/) (Full disclosure, I designed and retail this gpio adapter product, but it fits my needs well so I would have bought it just the same) and chopped parallel cable for the GPIO to interface with the Gecko.

I have tried a few images earlier this year from this forum, but have so far not been able to get anything working based on just the GPIO, everything I found was MESA card based.

Software environment: RPI image downloaded from here
forum.linuxcnc.org/9-installing-linuxcnc...cnc?start=150#253623

Hardware environment
Rpi 4, 4GB 3V3<->5V0 (GPIO adapter) <-> (Parallel port via chopped cable attached to adapter board) Gecko G540 interface
Display 1080p monitor (initially for travel monitor, then 27 inch display on CNC)
+48Vdc Power supply
variable speed spindle (Analog speed control via potentiometer initially)

Where I would like some help if possible, is to get a HAL file or hand holding guidance that gets the basic X/Y/Z axis defined with step, DIR, along with an e-stop (or similar) input and general output (initially for a light switch relay).  I don't expect to have a finished solution provided, just a template I can modify.  A full working image would not be refused, but doesn't help me learn how to make this all play nice either.  A working machine would be appreciate though!!

I will be travelling starting tomorrow for about 8 days, but will be taking the RPI, gpio adapter and a DMM with me so I can tinker as family time allows.

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

More
07 Dec 2022 01:00 #258775 by andypugh
Not really answering the question, but a 3.3V parallel port will be safe to 5V and can probably sink more current than it can source.
This means that you can probably pull-up each pin to 5V and then let the port pull it down. Something like 500 ohms will probably work, but maybe start at 1k and see what swing you get.

For Pi level shifting I found a single-chip solution when I built some Rpi - Parallel adaptors, using the GTL2000 series. However I can't find them any more, but there is www.nxp.com/products/peripherals-and-log...ion-sensing:NTS0308E
What is fun about these is that they are bidirectional, so you still get the G in GPIO.

To actually answer the question, you should be able to just modify a copy of your parallel port config to use the Pi GPIO instead. The Pi GPIO driver taks a bit of figuring out and there doesn't seem to be any proper docs. But there is a basic sample config here:
github.com/LinuxCNC/linuxcnc/blob/master...hal_pi_gpio_demo.hal

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

More
17 Dec 2022 23:35 #259780 by dloranger
Sorry for the delayed response, I have found the demo hal file, but I can't seem to make it work. Again, the lack of a fully specified file I suspect is the root cause.

I go thru the step-conf wizard which nicely has the g540 as a preconfigured option, not much to go wrong there at least :-)

Now comes my question. What do I comment out of that file, and what parts of the demo do I install? Further to that, I am assuming this all happens in the my-mill.hal file correct?

If you have anything that is working for this, I would be grateful to get a copy of the file as what I have done prevents the linuxCNC from even launching so far.

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

More
19 Dec 2022 23:01 #259905 by andypugh
Paste the error report here, we can identify what is wrong with the config.

Sorry, I don't have any working Pi config myself, I don't think that I have ever moved real hardware with a Pi.

But, basically, you need to replace the "loadrt hal_parport" line with a "loadrt hal_pi_gpio" (with the correct parameters) and then swap all the "net .... parport.0...." lines in the HAL to hal_pi_gpio ones.

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

More
22 Dec 2022 18:21 #260087 by elovalvo

Sorry for the delayed response, I have found the demo hal file, but I can't seem to make it work. Again, the lack of a fully specified file I suspect is the root cause.

I go thru the step-conf wizard which nicely has the g540 as a preconfigured option, not much to go wrong there at least :-)

Now comes my question. What do I comment out of that file, and what parts of the demo do I install? Further to that, I am assuming this all happens in the my-mill.hal file correct?

If you have anything that is working for this, I would be grateful to get a copy of the file as what I have done prevents the linuxCNC from even launching so far.


I advise you to read this

forum.linuxcnc.org/9-installing-linuxcnc...ware-stepping#260086

and you will probably be able to modify the test_arpi600.hal file adequately for your needs

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

Time to create page: 0.203 seconds
Powered by Kunena Forum