To try to meet those who want to use LinuxCNC a Raspberry Pi 4 via GPIO only I can describe my approach, starting from which many variants can be studied.
For convenience and in view of future expansions, rather than a classic breadboard where to connect the stepper motor drivers and other devices (limit switches, spindle relay and coolant) I preferred to use an ARPI600 board
(
it.aliexpress.com/item/1005004137466369.html
)
The choice of the ARPI600 is also linked to the fact that this board supports Arduino shields, including the CNCShield, which is widely used for driving mini milling machines via the GRBL protocol.
(
it.aliexpress.com/item/1005002807506440.html
)
However, nothing prevents you from connecting the CNCShield pins to the Raspberry pins without the ARPI600.
For this configuration (ARPI600 + CNCShield) the pins used are the following:
First you need to identify which pins of the raspberry will be used as input and output to define the command loadrt hal_pi_gpio.
For this you can use the rpi4_gpio utility (
github.com/jethornton/rpi_gpio
)
The arm64 version is available here (
forum.linuxcnc.org/18-computer/43353-rpi4-hal-question?start=10
)
Once this is done, you need to initialize the pins with the raspi-gpio command.
At this point, to verify the connections before using LinuxCNC, I used the following HAL program:
with the command
halrun -I -f test_arpi600.hal
In this file the values of period1 and period2 are chosen conservatively but can be varied in relation to the latency values.
Similarly the position-cmd values must be adjusted in relation to the step/rev values of the motor and the microsteps to which the drivers are configured.
At this point at the halrun prompt it is possible to verify the operation of the motors in position via various commands like:
sets X-pos 3
sets Y-pos 2
sets Z-pos -1
Also you can check the operation of the relays with commands as:
sets COOL True
sets SPINDLE 1
Finally, the operation of the switches is visible with the halmeter.
If everything works, you can configure LinuxCNC with the files in the arpi600.zip attachment :
Just copy the arpi600 folder in the linuxcnc/configs folder to find it in the LinuxCNC menus
In any case it is my intention to prepare soon an image with all these files ready for use