HAL CiA402 Drive Interface for Can Bus,Ethercat etc...

More
19 Mar 2022 22:19 #237750 by sqmathlete
edit that, source file is too large. PM me so I can send you the files if your interested.
 

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

More
20 Mar 2022 00:50 #237758 by sqmathlete
I made a short video to demonstrate the homing procedure as previously discussed .

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

More
20 Mar 2022 01:19 #237765 by tommylight
The video is private, you have to make it public for other to watch it.

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

More
20 Mar 2022 01:45 #237767 by sqmathlete
The following user(s) said Thank You: tommylight

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

More
20 Mar 2022 07:18 #237774 by rodw
Dan, first thing first.
To install linuxcnc on Bullseye, follow the instructions here
www.qtpyvcp.com/install/bullseye.html
You can upgrade to unstable and then install linuxcnc from the Debian repos but to upgrade master branch from the snapshot given to Debian, you need to compile from source, so you might as well go this way.

I did explain how to use unstable here (but it is untested):
forum.linuxcnc.org/9-installing-linuxcnc...ling-linuxcnc#237671

The traditional method of ec-debianize will not work on Bullseye as it relies on a now obsolete mercurial repository, IgH moved to using gitlab and life is now simple!! They have an unofficial repository that lets you use apt install to install etherlabmaster

I have documented the process here (now a sticky in the ethercat section):
forum.linuxcnc.org/ethercat/45336-etherc...-how-to-step-by-step

I think I will add another post in response to your homing questions.
My website is www.vmn.com.au/
The using contact us page will get to me in the absence of PM's

 

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

More
20 Mar 2022 07:44 - 20 Mar 2022 07:45 #237776 by rodw
Dan, 
I watched your video. I put a fair bit of effort to try and get Dominc's cia402.comp to home my drives but in the end I gave up and reverted to the linuxcnc way. I don't think its possible to home without modifying homing.c as the LCNC velocities seem to override the internal ones.

What Dominc has provided though is a way to eliminate using M codes to change modes by  tying the mode changes with a home to index signal.

I did have one go at changing homing.c in a branch called rodw-home-external on my fork of linuxcnc here
github.com/rodw-au/linuxcnc/tree/rodw-home-external

My thought was to add a new flag to homing configuration called HOME_EXTERNAL that bypassed all of the stuff linuxcnc does in homing.c until homing is completed except all the homing  offsets etc. To do this I modified the bitmap in homing.h 
github.com/rodw-au/linuxcnc/blob/rodw-ho.../emc/motion/homing.h
Then in homing.c, I jump down the homing sequence_state if this flag is set.
github.com/rodw-au/linuxcnc/blob/0ae7bb1...motion/homing.c#L628
I might add, I had to dig deep to remember how bitmaps worked!

I would be interested in looking at your changes to homing.c and homing.h
I think with some extension to  dominc's component and similar modifications to homing.c I did, this could be solved quite neatly.

To contribute to linuxcnc code, you need to learn how to use github. I am an absolute novice. Create an account, fork linuxcnc, create a new branch in your repo, clone your repo to your PC, add your changes in and push back to your repo. Then you can create a pull request to linuxcnc.

With regards to incorporating  ethercat into linuxcnc, there are some licensing issues preventing some of it. Now there is a repo for etherlabmaster, I would like to See sittner's hal driver turned into a deb file. I don't think that would be too hard to do. IgH's new repo clearly states it is open source so I see no reason why that deb file written by linuxcnc (eg based on sittner's work) could not be included in the debian repos in the same way mesaflash is.

Anyway, please contact me via my website as suggested in the last post.
Last edit: 20 Mar 2022 07:45 by rodw.

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

More
22 Mar 2022 22:41 #238047 by sqmathlete
Hi Rod,

My apologies for not responding earlier, work interrupted. That being said,  I have managed to create my own fork but I was having difficulty getting an rip version to build in Bookworm and I think that ethercat master doesn't play well the 5.16 Kernel.  Doing a  fresh install of Bullseye
as we speak.
 

  I don't think its possible to home without modifying homing.c as the LCNC velocities seem to override the internal ones.

I would agree with this. The code that controls homing is spread around 10 or so files. Not much editing/addition is required but it is quite a tangled web.

My thought was to add a new flag to homing configuration called HOME_EXTERNAL that bypassed all of the stuff linuxcnc does in homing.c until homing is completed except all the homing  offsets etc. To do this I modified the bitmap in homing.h 

Then in homing.c, I jump down the homing sequence_state if this flag is set.

I might add, I had to dig deep to remember how bitmaps worked!
 

That's basically what is required. You create the variable HOME_EXTERNAL or in my  HOME_AUTO =1 for the .ini  file then you can use that to set a bit (that you have created), then in the homing file LinuxCNC knows to ignore the error during homing. It may not be that elegant but it works.

  What Dominc has provided though is a way to eliminate using M codes to change modes by  tying the mode changes with a home to index signal.

I will have to have a look at this. A  comp file that handles the mode switching and brake at the appropriate time would be nice. Might even be able to delete a few rungs on the ladder. 

Will let you know when I get the changes uploaded to my fork. I'm going to clean them up a bit, there is a lot of stuff left over from previous attempts that may be confusing.

Kind regards,
Dan 

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

More
23 Mar 2022 01:09 #238060 by rodw
Dan, The sittner repo and use of obsolete mercurial repos is a problem from Bullseye and on. The solution is to use an unofficial repo created by the IgH Etherlabmaster team. It includes nightly build for many platforms

I documented how to do this in this thread which is now a  sticky in the ethercat section.
forum.linuxcnc.org/ethercat/45336-etherc...-how-to-step-by-step

I was able to install bullseye, change the sources.list to point to unstable, upgrade Bullseye to testing, Install lcnc and Ethercat without compiling any code (except the hal driver)

Try this:
Install Debian Bullseye from an ISO
open a terminal
sudo apt install geany curl
sudo geany /etc/apt/sources.list
make sure any lines containing cd are commented out with a #
replace any reference to bullseye or stable with unstable eg.
deb http://deb.debian.org/debian/ unstable main non-free contrib
deb-src http://deb.debian.org/debian/ unstable main non-free contrib

Note that unstable should be replaced with testing when Linuxcnc gets there (soon)

If you are an ETHERCAT user insert this line at the end of the file 
deb [allow-insecure=yes] https://download.opensuse.org/repositories/home:/bone11111:/branches:/science:/EtherLab/Debian_10/ ./

Save and close geany

If you are an ETHERCAT user enter these two commands to create a security key
KEYRING=/usr/share/keyrings/ethercat.gpg
curl -fsSL https://download.opensuse.org/repositories/home:/bone11111:/branches:/science:/EtherLab/Debian_10/Release.key | gpg --dearmor | sudo tee "$KEYRING" >/dev/null

Upgrading your Debian to unstable branch becasue Linuxcnc is packaged there

sudo apt update
sudo apt full-upgrade
sudo apt install linuxcnc-uspace linuxcnc-uspace-dev
reboot
type uname -a  (to check PREEMPT-RT kernel is running)
Linuxcnc should be in the menus or open a terminal and type: linuxcnc

Then 
udo apt install -y linux-headers-rt-amd64 grub-customizer
sudo apt-get install ethercat-dkms libethercat libethercat-dev ethercat-master
ip a (and save MAC address of the NIC used for ethercat)
sudo geany /etc/ethernet.conf
set your Master0 device to your MAC address and device modules to generic
MASTER0_DEVICE="xx:aa:yy:zz:bb:cc"
DEVICE_MODULES="generic"
save and close geany
sudo systemctl enable ethercat.service
sudo systemctl start ethercat.service
sudo systemctl status ethercat.service
sudo chmod 666 /dev/EtherCAT0
Ethercat should be running. If the above command is not found, you have a problem
You can list the slaves if you type
ethercat slaves

mkdir dev
cd dev
git clone https://github.com/sittner/linuxcnc-ethercat.git
cd linuxcnc-ethercat
make clean
sudo make install
cd ..
git clone https://github.com/dbraun1981/hal-cia402
cd hal-cia402
sudo halcompile --install cia402.comp

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

More
23 Mar 2022 01:10 #238061 by rodw
oops, the second block of code should start with sudo not udo

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

More
23 Mar 2022 01:15 #238063 by rodw

oops, the second block of code should start with sudo not udo



Actually, sometimes, ethercat gets confused with the kernel versions so with preempt_rt running replace the first line with 
sudo apt install -y linux-headers-rt-$(uname -r) grub-customizer

This will install the correct headers.

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

Time to create page: 0.143 seconds
Powered by Kunena Forum