Raspberry Pi3 GIPO & Single axis
07 Mar 2020 21:43 #159439
by Sturmer
Raspberry Pi3 GIPO & Single axis was created by Sturmer
Hello ,every one this is my first post here.
Im total noob in LinuxCNC configuration. I know about this for good 10 years but never had a chance to play with it.
Now i finaly got some hardware , and i have an idea of making my life easier by using LinuxCNC on raspbery pi3 with touch screen.
Idea is to use Raspberry pi to run one axis , and have a DRO type of screen. I have a SC5780 stepper driver with stepper that has encoder and brake on it self. As i really don't know where to start. Im asking here. Can i just drive the driver directly from the RPI GIPO ?
I have managed to install LinuxCNC on to the raspberry Pi using this tutorial.
wiki.linuxcnc.org/cgi-bin/wiki.pl?RPi3BPreemptRT#buildhalgpio
And by some reading and playing managed to find this link to enable the working of the GPIO
erste.de/linuxCNC_raspberry_PI4.html
But im stuck for now , and need some guidance to where to go next after the fist install , and how to create single axis display - and how to even create the nesecery HAL and INI files to run only one stepper motor with brake.
Any help would be appreciated , and i hope i have posted this into the correct topic.
Thank you in advance , Stephan!
Im total noob in LinuxCNC configuration. I know about this for good 10 years but never had a chance to play with it.
Now i finaly got some hardware , and i have an idea of making my life easier by using LinuxCNC on raspbery pi3 with touch screen.
Idea is to use Raspberry pi to run one axis , and have a DRO type of screen. I have a SC5780 stepper driver with stepper that has encoder and brake on it self. As i really don't know where to start. Im asking here. Can i just drive the driver directly from the RPI GIPO ?
I have managed to install LinuxCNC on to the raspberry Pi using this tutorial.
wiki.linuxcnc.org/cgi-bin/wiki.pl?RPi3BPreemptRT#buildhalgpio
And by some reading and playing managed to find this link to enable the working of the GPIO
erste.de/linuxCNC_raspberry_PI4.html
But im stuck for now , and need some guidance to where to go next after the fist install , and how to create single axis display - and how to even create the nesecery HAL and INI files to run only one stepper motor with brake.
Any help would be appreciated , and i hope i have posted this into the correct topic.
Thank you in advance , Stephan!
Please Log in or Create an account to join the conversation.
09 Mar 2020 00:20 - 09 Mar 2020 00:22 #159537
by andypugh
Probably.
You will need at least version 2.8 of LinuxCNC as that included the hal_pi_gpio driver.
I have also just noticed that the driver has no documentation, which is a bit unhelpful. There is some info in the sample HAL file, though.
github.com/LinuxCNC/linuxcnc/blob/master...hal_pi_gpio_demo.hal
(note that that HAL file is actually an example using the Pi to drive two axis of steppers)
Replied by andypugh on topic Raspberry Pi3 GIPO & Single axis
Can i just drive the driver directly from the RPI GIPO ?
Probably.
You will need at least version 2.8 of LinuxCNC as that included the hal_pi_gpio driver.
I have also just noticed that the driver has no documentation, which is a bit unhelpful. There is some info in the sample HAL file, though.
github.com/LinuxCNC/linuxcnc/blob/master...hal_pi_gpio_demo.hal
(note that that HAL file is actually an example using the Pi to drive two axis of steppers)
Last edit: 09 Mar 2020 00:22 by andypugh.
Please Log in or Create an account to join the conversation.
10 Mar 2020 11:48 #159644
by Sturmer
Replied by Sturmer on topic Raspberry Pi3 GIPO & Single axis
I have used the script from the first link to install the Linuxcnc , so the installed version is 2.9.0 ... (newest version i think?).
The problem is that my hal that im using is telling me im "pumping" step signal to the PIN 5 for the Y axis - but using my oscilloscope i do not get any signal.
I have tried to probe all of the GIPO pins to make sure that the HAL config and GIPO driver do not spit out the data on some different pin. But in no avail.
As i see that ppl have managed to run 3 axis mini mills - i really don't see any reason i would not manage to run only one axis.
My reasoning is to learn the linux software and configuration on this simple system so in the long run it will be easier to configure my future DIY mill.
I have watched few youtube videos to get the grasp on the basics ...
Do you maybe have any good links to HAL tutorials i should watch? Or read?
As im still quite noobish in understanding the HAL code to generate one axis.
I don't ask for full solutions just a nudge in the right direction or good pdf/video i need to watch to "get it"![:) :)](/media/kunena/emoticons/smile.png)
Learning all of this stuff is the fun part!
The problem is that my hal that im using is telling me im "pumping" step signal to the PIN 5 for the Y axis - but using my oscilloscope i do not get any signal.
I have tried to probe all of the GIPO pins to make sure that the HAL config and GIPO driver do not spit out the data on some different pin. But in no avail.
As i see that ppl have managed to run 3 axis mini mills - i really don't see any reason i would not manage to run only one axis.
My reasoning is to learn the linux software and configuration on this simple system so in the long run it will be easier to configure my future DIY mill.
I have watched few youtube videos to get the grasp on the basics ...
Do you maybe have any good links to HAL tutorials i should watch? Or read?
As im still quite noobish in understanding the HAL code to generate one axis.
I don't ask for full solutions just a nudge in the right direction or good pdf/video i need to watch to "get it"
![:) :)](/media/kunena/emoticons/smile.png)
Learning all of this stuff is the fun part!
Please Log in or Create an account to join the conversation.
10 Mar 2020 12:00 #159645
by andypugh
Replied by andypugh on topic Raspberry Pi3 GIPO & Single axis
Can you attach the HAL and INI files?
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 18563
- Thank you received: 6220
10 Mar 2020 12:52 #159647
by tommylight
Much better choice would be an old computer with a parallel port, it takes about 5 to 10 minutes to set up and use a simple 3 axis machine using stepconf that is included with Linuxcnc.
Replied by tommylight on topic Raspberry Pi3 GIPO & Single axis
RPI is not a good place to start learning Linux or Linuxcnc due to many reasons, but it is good for learning how to compile and use Linux stuff.My reasoning is to learn the linux software and configuration on this simple system so in the long run it will be easier to configure my future DIY mill.
Much better choice would be an old computer with a parallel port, it takes about 5 to 10 minutes to set up and use a simple 3 axis machine using stepconf that is included with Linuxcnc.
Please Log in or Create an account to join the conversation.
10 Mar 2020 15:07 #159661
by Sturmer
Replied by Sturmer on topic Raspberry Pi3 GIPO & Single axis
Yes i understand that this is special hard way to make something - but not to learn. As for every little error i have to read the man files ...
(And if i get it to work like this - im sure it will work on simpler configurations (Parallel port or some kind of IO PCI Card ...)
I just copied my last two configurations i play with yesterday - as im currently at work - but using vpn to access my system at home - am not sure what changes are currently active.
But in general this two set of files were used to try to run GPIO ... I have tried to run step config just to get the feeling for generated files.As for simple one to two axis systems or some kind of a HMI panels for machines i see linux cnc as a great system for this type of configuration.
I was hoping to get the first blank configuration to gather some more know how.
Ps. I will watch this series on YouTube - to help me some in understanding the basics of logic
(And if i get it to work like this - im sure it will work on simpler configurations (Parallel port or some kind of IO PCI Card ...)
I just copied my last two configurations i play with yesterday - as im currently at work - but using vpn to access my system at home - am not sure what changes are currently active.
But in general this two set of files were used to try to run GPIO ... I have tried to run step config just to get the feeling for generated files.As for simple one to two axis systems or some kind of a HMI panels for machines i see linux cnc as a great system for this type of configuration.
I was hoping to get the first blank configuration to gather some more know how.
Ps. I will watch this series on YouTube - to help me some in understanding the basics of logic
Please Log in or Create an account to join the conversation.
12 Mar 2020 10:14 - 12 Mar 2020 11:45 #159857
by Sturmer
Replied by Sturmer on topic Raspberry Pi3 GIPO & Single axis
After some playing around and goofing in side hal files. I found few stupid typo mistakes. I managed to get some kind of output from the GPIO pin 3 yesterday. But it looks jerky on my oscilloscope and not that usable i think. I am attaching this half working hal and ini file.
I have tried to home the axis by clicking home ,and activating the GPIO pin 11 but to no avail. Really need some more reading and watching time on basics of configuration.
I have attached the video of the captured signal with oscilloscope, as for now im not willing to attach this to the stepper motor driver until im sure the signal is ok.
www.dropbox.com/s/dvqs8k88387c6fv/Video.avi?dl=0
Any advice on reading material , or video material would be highly appreciated!
I have tried to home the axis by clicking home ,and activating the GPIO pin 11 but to no avail. Really need some more reading and watching time on basics of configuration.
I have attached the video of the captured signal with oscilloscope, as for now im not willing to attach this to the stepper motor driver until im sure the signal is ok.
www.dropbox.com/s/dvqs8k88387c6fv/Video.avi?dl=0
Any advice on reading material , or video material would be highly appreciated!
Last edit: 12 Mar 2020 11:45 by Sturmer.
Please Log in or Create an account to join the conversation.
12 Mar 2020 13:11 - 12 Mar 2020 13:12 #159868
by thadwald
Replied by thadwald on topic Raspberry Pi3 GIPO & Single axis
Here is a working config. Some caveats: I only tested the x and y motion; I didn't test any inputs.
I do have a pair of NEMA 23 motors spinning, powered by Trinamic TMC2209 stepsticks. I think good drivers are a key part to getting good motion with the limited step rate from software. These drivers turn step information into sine wave "steps." They can even do 1/4 pulses per step, meaning they will run a full 360deg electrical commutation with one step signal. This can raise step size to machine positioning accuracy requirements.
Note that the pin mask section refers to the Broadcom GPIO numbers, whereas hal_pi_gpio.pin.-N-in/out refer to the raspberry pi header PIN numbers on the board.
For example, GPIO2 is used as output for the x axis step pulses and it is physically located on pin3 on the pi header.
Thus:
the bit mask masks gpio pin 2 as output
Xstep is the net or "wire" that connects the step generator to header pin 3
The above HAL code is located in two different files, presumably to make the HAL system more modular.
I started this config from the parport stepper config in the samples, then I replaced all the parport IO section with relevant parts from the hal_pi_gpio_demo.hal.
I do have a pair of NEMA 23 motors spinning, powered by Trinamic TMC2209 stepsticks. I think good drivers are a key part to getting good motion with the limited step rate from software. These drivers turn step information into sine wave "steps." They can even do 1/4 pulses per step, meaning they will run a full 360deg electrical commutation with one step signal. This can raise step size to machine positioning accuracy requirements.
Note that the pin mask section refers to the Broadcom GPIO numbers, whereas hal_pi_gpio.pin.-N-in/out refer to the raspberry pi header PIN numbers on the board.
For example, GPIO2 is used as output for the x axis step pulses and it is physically located on pin3 on the pi header.
Thus:
the bit mask masks gpio pin 2 as output
Xstep is the net or "wire" that connects the step generator to header pin 3
net Xstep <= stepgen.0.step
net Xstep => hal_pi_gpio.pin-03-out
The above HAL code is located in two different files, presumably to make the HAL system more modular.
I started this config from the parport stepper config in the samples, then I replaced all the parport IO section with relevant parts from the hal_pi_gpio_demo.hal.
Attachments:
Last edit: 12 Mar 2020 13:12 by thadwald.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Away
- Platinum Member
-
Less
More
- Posts: 5000
- Thank you received: 1409
12 Mar 2020 20:55 #159931
by Todd Zuercher
Replied by Todd Zuercher on topic Raspberry Pi3 GIPO & Single axis
If your latency is bad, the step timing will be equally bad.
Please Log in or Create an account to join the conversation.
13 Mar 2020 12:49 #160007
by thadwald
I’m curious about this. Can you define bad step timing and good timing with some number? For example, if I run 250us base period with a 50us jitter, will that show up anywhere?
How tight does the timing need to be?
Replied by thadwald on topic Raspberry Pi3 GIPO & Single axis
If your latency is bad, the step timing will be equally bad.
I’m curious about this. Can you define bad step timing and good timing with some number? For example, if I run 250us base period with a 50us jitter, will that show up anywhere?
How tight does the timing need to be?
Please Log in or Create an account to join the conversation.
Time to create page: 0.754 seconds